Android-job: Is service still schedule after swiping away app?

Created on 3 Feb 2017  路  8Comments  路  Source: evernote/android-job

Is service still schedule after swiping away app?
Is there a method similar to 'START_STICKY' parameter?

Thanks!

question

Most helpful comment

As I know normally it is not a issue. Normal phone doesn't kill alarms or services after swipe out from recent task. But some phones do that as I know for example Xiaomi phones. I tested Nexus, Sony Z4+ and also Huawei works correctly. But Huawei with A6 kill all the alarms after some time automatically, based on package name of the app. If app id contains words like clock, alarm, calendar, everything is OK, but if no, Huawei simply kill everything, also GCMTaskManager doesn't work here. Most probably theirs white-list is more complex. But if you are not lucky there is no way to run periodic tasks on Huawei with A6.

All 8 comments

Hi,
This has been discussed #128 and #135 already. So a short answer: No, the alarm isn't scheduled anymore, but it'll be rescheduled as soon as possible.

No, there isn't such a thing as START_STICKY, that wouldn't work well with the idea of jobs. But jobs create wake lock before they run, so you shouldn't run into the issue, that your process is being killed. In case the app is being force closed while a job is running, it is still scheduled and will be rescheduled the next time the app is being launched (see first question).

I hope that helps.

As I know normally it is not a issue. Normal phone doesn't kill alarms or services after swipe out from recent task. But some phones do that as I know for example Xiaomi phones. I tested Nexus, Sony Z4+ and also Huawei works correctly. But Huawei with A6 kill all the alarms after some time automatically, based on package name of the app. If app id contains words like clock, alarm, calendar, everything is OK, but if no, Huawei simply kill everything, also GCMTaskManager doesn't work here. Most probably theirs white-list is more complex. But if you are not lucky there is no way to run periodic tasks on Huawei with A6.

Wow, this sounds horrible. But sounds like there is still nothing we could do?! :(

Yes. Just do not bought Huawei ;-) I think that Google should forbid this type of changes brooking framework/SDK functionality. And don't provide certification for such broken ROMs. But this is different story.

I think there's nothing more we could do. I've updated FAQ with this question.

We are also facing issues with Xiaomi, Oppo like phones where periodic scheduler's interval is unexpected.
@vRallev your FAQ link is broken. Updated FAQ

Check out the following link . It thoroughly discusses the topic.

Effect of swiping an android app in recent app list

@adnanharis The problem occurs with most of the Customised OEMs like Xiaomi, Vivo etc where they have the Battery Saver option set to optimise by default which doesn't allow the WorkManager API to work well as expected. Kindly set that to No restrictions explicitly by navigating to the app info and you could see that your WorkManager will run the task.

PS: I used the term WorkManager because this lib internally uses the same.

Was this page helpful?
0 / 5 - 0 ratings