I have a similar problem. My native code spawns new threads which are not bound to any particular Activity. How can I know when the application teminates (not a particular Activity!), so that I can safely end those threads?
Looking around a little, I found this callback method: android.app.Application.onTerminate(), but according to the documentation:
"This method is for use in emulated process environments. It will never be called on a production Android device, where processes are removed by simply killing them"
From the 2nd sentence I take it that when an application terminates, its process is killed and therefore any resources that were allocated (new threads, memory allocations...), whether in the Java layer or Native layer, are freed.
Is that a correct assumption?