0
votes

I have an Android app which launches an asynctask to synchronyze files with a remote FTP. The syncing process is done on background so that we can still open and read files. For a reason that I don't understand after a few hours of testing my app keeps crashing randomly with the messages following :

04-21 14:26:47.926 SM-T585 : Warning 5355 ActivityManager Force removing ActivityRecord{easyDoc/md516a8905f8e96d5.MainActivity t1431}: app died, no saved state
04-21 14:26:47.926 SM-T585 : Info 5355 WindowState WIN DEATH: Window{47e1c65 u0 d0 easyDoc/md516a8905f8e96d5.MainActivity}
04-21 14:26:47.926 SM-T585 : Debug 5355 ActivityManager removeProcessNameLocked mProcessNames.remove pid=20496 ,hash=156239617 ,name=easyDoc
04-21 14:26:47.926 SM-T585 : Info 5355 ActivityManager Process easyDoc.easyDoc (pid 20496)(adj 0) has died(105,633)
04-21 14:26:47.926 SM-T585 : Debug 5355 ActivityManager isAutoRunBlockedApp:: easyDoc.easyDoc, Auto Run ON

What can I do to debug this and prevent my app to be killed by the activity manager ?

1
So when your app crash is it always in the background?Abbas
My app is open and I can use it but the process syncing files is running in background until everything crashes. If I open the multi-task I can still see it there though...SirPsycho
I see there, OS should not destroy your app. But perhaps this could be just something related to AsyncTask since they are not recommended to be used for long tasks. Try a sticky Service instead as @mVck has suggested.Abbas

1 Answers

3
votes

AFAIK there's nothing you can do to prevent the OS from killing your app, and you should not try to do that. Do not fight the system.

For such a big job (synchronizing files with an FTP server) you should try to use a Service instead of an AsyncTask. It's pretty simple to implement, check out the documentation of IntentService here