Reprator
Reprator

Reputation: 3069

start IntentService from onDestroy() of activity

Basically, i am implementing ONLINE and OFFLINE FEATURE in my app with parse...so when user starts the app his status goes to online but how to know when he is offline except of logout...if the user kill the app...that's is why i am asking this question...

I want to send a json to my server with intent service on activity onDestroy() method but that intent service is not fired on activity onDestroy() method..Or how can i detect the application kill

I had made my every effort but no results found on web even on stackverflow.

So any help would be greatly appreciated..

Upvotes: 0

Views: 325

Answers (1)

BladeCoder
BladeCoder

Reputation: 12929

You can't detect when an Application gets killed, you must save your data proactively.

Besides, it makes no sense to try to start a Service to perform a long-running task while your application gets killed, if it worked it would mean that your application would never get killed.

Try to save your data as soon as possible, in the worst case in Activity.onStop().

Upvotes: 1

Related Questions