Remove child devices with App

Is there an event that occurs when an app is being removed? I'd like to delete the child devices and other such clean up.

def uninstalled() {
	removeChildDevices(getChildDevices())
}

private removeChildDevices(delete) {
	delete.each {deleteChildDevice(it.deviceNetworkId)}
}
3 Likes

I thought child devices are automatically removed when the parent is deleted?

I think you have to make them components in order to have them auto removed. I do not want to do that, as I'd prefer to allow manipulation of the devices outside of the smartapp