Issue
I have been trying for hours to get my program to act right, by overriding both onStop() and onDestroy(), but these event's doesn't seem to fire just right when closing the apps on the Nexus by using the swipe technique like he does in this youtube video http://youtu.be/1HBW7FG-xcQ?t=22s
@Override
protected void onStop() {
super.onStop();
Log.d("onStop", "Yay, we are in!");
datasource.Open();
datasource.UpdateIsPlaying(0);
datasource.Close();
}
@Override
protected void onDestroy() {
super.onDestroy();
Log.d("onDestroy", "Yay, we are in!");
datasource.Open();
datasource.UpdateIsPlaying(0);
datasource.Close();
}
@Override
protected void onPause() {
super.onPause();
Log.d("onPause", "Yay, we are in!");
datasource.Open();
datasource.UpdateIsPlaying(0);
datasource.Close();
}
Solution
Are you sure you're Overriding correctly those methods?
If the Activity is finished, onDestroy method is triggered. It's impossible not to be triggered if its finished.
What I assume is happening, is that this gesture, isn't finishing the app as it should be finished, or maybe it's just going on background.
Have you tried overriding onPause?
http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
However, if you read Activity documentation:
There are situations where the system will simply kill the activity's hosting process without calling this method (or any others) in it, so it should not be used to do things that are intended to remain around after the process goes away.
Maybe this gesture clears RAM directly or whatever it does, without following Android standards. I guess that if this is happening, you will have troubles while trying to receive a callback.
Answered By - Reinherd
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.