Imagination PowerVR SDK Blog

powerVR SDK android native does not exit clean


#1

HI,



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.




  1. Execute application
  2. Press BACK key > Re-execute application
  3. 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 ?



    Please help !!!





#2

Hello



that sound pure business logic issue , the event concern is :AKEYCODE_BACK

the list of event are described here (http://developer.android.com/reference/android/view/MotionEvent.html)

two option are possible , via JNI you fired the right event or you shutdown your app DIRECTLY .

If you are already in Pause Mode (the next back should shutdown nicely ).



regards

david


#3

Hi Madan,



The engineer responsible for our Android SDK code is currently out of the office. We will look into the issue once he returns.



Regards,

Joe


#4

Hi,

Any update please ??? Samsung is not considering approving this app just for this bug !!

Please help !!


#5

Hi,



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.


#6

hello



Strange …



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 :wink:



By my side i solve it by re-implementing from scratch , not cool.



regards

david



#7

Hi Scott,



My device is samsung galaxy S1 (I-9000).



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.


#8
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.


onPause will get called when the app goes into the background. More detailed information can be found at http://developer.android.com/reference/android/app/NativeActivity.html#onPause().

If it ccan help , I can send the apk file for you to reproduce this problem

Feel free to send it to devtech@imgtec.com.

Could you confirm which SDK you're using. At the moment I'm assuming it is the latest one available (SDK 3.0).

Thanks,

Scott

#9

I am using SDK_OGLES2_ANDROID_ARMV7_REL_2.10@863987. I have emailed the apk and samsung test report.


#10

Thanks for the .apk, I was able to reproduce the problem. Unfortunately, the logcat output wasn’t very insightful on the cause.



For our 3.0 release we actually made some minor changes to the Android PVRShell. Could you give the newest version a try?


#11

Hi Scott,



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.