Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 941

Clean Exit - Question

$
0
0

Hi All, I have a gps app (github/pocojoe/playagps) that is processing 3.0 and ketai based. I need to stop listening to the GPS receiver when the app does not have focus (ie, activity is running, and processing owns the screen). In order to invoke the call to allow ketai location manager override to stop listening, I have overridden onStop(); and onDestroy() to a) buffer the state of the navigation function, and b) turn off the power supply to the reciever, to stop battery drain.

I did this because the back and home buttons, always displayed, are how the user exits a processing app.

In this manner, when home and back are pressed, the call to halt the gps occurs, and processing exits- but the OS complains with "Unfortunately, PlayaGPS has stopped".

My reading suggests that this is due to overriding onStop() and onDestroy(); resulting in Draw being interrupted, and when the activity changes state, the OS complains.

This may mean that to exit the user will just need to tap twice - once for either home or back, and again to close the "Unfortunately" dialog box. If this is the case, I am fine with it- it is just a cost of the convenience of having all the cool functionality that Processing affortds.

On the other hand, if I am missing some call that Processing ALWAYS INVOKES upon getting tapped on the shoulder with a back or home tap, please let me know. Perhaps there is a call (?exit()) where I should put my "turn off the reciever code".

Thanks to all the developers.

Joe


Viewing all articles
Browse latest Browse all 941

Trending Articles