Reputation: 31
I am working on Location based application ,which get the latitude and longitude by using android location services and sending it to the server by an asyncTask .The problem is when I start the application and press the home button the application is getting stopped .why ?? Please help me .
Upvotes: 0
Views: 991
Reputation: 17976
Try changing the activity declaration in the manifest and add the following attribute:
android:launchMode="singleTop"
It will prevent the activity from restarting.
See here for more information.
Upvotes: 1
Reputation: 582
This is old question and probably won't help OP, but maybe others might benefit from this answer. I noticed very similar behaviour when I had set android:noHistory on the activity that was behaving this way in Android Manifest file:
<activity
android:name="SomeActivity"
android:noHistory="true">
</activity>
Of course you may need this flag, in which case you need to find workaround if the behaviour (such as onSaveInstanceState()
being not called) causes you problems
Upvotes: 0
Reputation: 690
Go to Settings > Developer Options and Uncheck "Do not keep activities"
Upvotes: 0