I am having problems in doing a clean exit/quit of a native application in android.
Calling finish() seems to take time and even after exit, if the user was to click the application icon within 5 seconds or immediately , the app crashes or launch fails.
Ofcourse, if suficient time is given or user does something else and trys to run the app, it launches fine.
This problem is causing my application to get rejected in the samsung store and this is the message from them.
"
*This defect was detected in the previous test.
Application force closes when re-executing it.
Execute application
Press BACK key > Re-execute application
Check the screen
Application should be able to re-execute after the termination.
"
I understand that it would be hard to analyze this as its quite complicated and also related to android OS. But what I want to know is your suggestions and practiced
methods of doing a clean exit which won’t cause these such problems. I have experienced the same problem while experimenting with the powerVR android samples without any change and hence the samples won’t help.
Also when I return false in RenderScene(), what kind of a call back I can expect in the NativeActivity in Java ?
Which version of the SDK are you using? Also, which device and version of Android are you seeing this on? Does logcat show any errors?
I’ve tried to see if I could reproduce the issue with one of our examples* to better understand the problem but I wasn’t able to reproduce it.
As for the kind of callback you can expect in Java when returning false from RenderScene, you should get a call to onPause(), followed by onStop() and then onDestroy().
Cheers,
Scott
*Done by making it return false from RenderScene. The BACK key doesn’t exit for me on the devices I’ve tried.
As always on android, i have different behavior depending the constructor:
On Nexus 7 , the app never do clean exit so i share the opinion of Mister Mkandula . ( i even don’t speak about the crash with the Chicago navigation demo 3 but maybe it s because it s the most complex demo…)
On other devices i am not able to have clean exit properly.
It will be nice to have a back action that pause the animation, and if we are in pause and we press back again the app ask us if we want to leave or not ( a bit like NVIDIA does in their sdk for android :-/ that just work fine ) .
Your demo are really cool , and with a bit of finition they will reach the perfection
By my side i solve it by re-implementing from scratch , not cool.
Can you confirm if onPause() is only called when we return false from RenderScene() or are they any other instances it can happen ? Like, when you receive a phone call , Home key pressed, Hold key pressed etc.
If it ccan help , I can send the apk file for you to reproduce this problem.
Can you confirm if onPause() is only called when we return false from RenderScene() or are they any other instances it can happen ? Like, when you receive a phone call , Home key pressed, Hold key pressed etc.
After a long time we solved this issue. The problem was with JNI_OnLoad which will be calld ONLY once (unless you go to processes and terminate the app). Any GlobalRefs which are created here will remain even after the app is closed and must be reused by declaring them as static’s.