Here is a way you can get uninstall event of your own app.
Using inotify
in native code.
For example: You can using inotify_add_watch
to monitor your application’s data cache folder like: /data/data/your-package-name/cache
.
When your application gets uninstalled, you can get the folder’s delete event.
Another key point is that inotify
should run in a seperate process from your own application.
You can invoke fork()
to do this.
I’ve already verified the logic. 🙂