App's Child Device Won't Delete - Get Off My Lawn!

Well, I tried a busy-wait loop (gotten from this thread) but no dice, no matter the delay I still got the same errors. My guess is the busy-wait loop is blocking the thread, so the unsubscribe or delete doesn’t happen until after the loop is over.

The runIn() idea works! Though that doesn’t fire for at least a minute (which is apparently a known issue talked about in the previously linked thread). I’m passing the deviceNetworkID through a state variable to the runIn() method. The first time I tried it I got

java.util.ConcurrentModificationException

which I guess is because I am using state. instead of atomicstate. I guess I need to update my app to use atomicstate now…

Still, this is a better solution than my backup plan, which was unsubscribe, save the deviceNetworkID in a state variable, and delete the child the next time the app was updated.

One more quick deleteChildDevice question:
Whenever a child device is trying to be deleted, if it is being used by any apps (not just the parent app), it will throw an error and not delete. Is there any way to test for these associations so I can report them to a user? Right now it’s so cryptic when you can’t uninstall an app due to this issue!

In other words, is there a property or method to get the “In Use By” data that we can see for a device in the device list?

1 Like