简体   繁体   中英

Android Oreo background service is not working in doze mode?

I am using background service to get user location and upload to server.

I have used one LocationTrack class which is extending Service class and AlramReciver which is extending BroadcastReciver.

I have added all permission in manifest and register AlarmReciver and LocationTracker class in manifest file.

But when app goes into DOZE mode then service is not working.

I have tried following links but its not working anyways.

  1. How to create background services for android Oreo without notifications like social networking applications Facebook, Messenger, Zalo
  2. Background service for android oreo

  3. Android Oreo killing background services and clears pending alarms, scheduled jobs after entering doze mode

  4. Oreo - Starting a service in the foreground

  5. https://developer.android.com/training/monitoring-device-state/doze-standby

  6. https://android.jlelse.eu/keep-those-background-services-working-when-targeting-android-oreo-sdk-26-cbf6cc2bdb7f

7. https://developer.zebra.com/community/home/blog/2018/10/26/keeping-your-application-running-when-the-device-wants-to-sleep

I have tried Jobdispatcher also but nothing works out.

Possibly it seems duplicate question but i don't understands whats wrong with my Code. Please help to get rid of this. Thanks in advance.

You can use firebase job dispatcher for background service which works on all versions of android and is handled by firebase.

Check this answer with firebase job dispatcher

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM