1. Are you ready for the Galaxy S20? Here is everything we know so far!

Fetch User Location when the App is closed and Handle doze mode.

Discussion in 'Android Development' started by Gadepalli Aditya, Sep 5, 2019.

  1. Gadepalli Aditya

    Thread Starter

    I have a usecase when I need to fetch user location for every 5 min say (this is configurable but not less than 5 min). I have tried the following:

    1) Alarm manager and setting it to Periodic , thereby raising a broadcast from which triggering a Foreground service and holding a partial wake lock to fetch location and send to server.

    2) next Approach was using the work manager API to do all this process. but this deferred the task a lot and in MI mobile the task totally terminated when the app is removed from the App tray.

    3) Used oneshot alarms by setting the time manually and triggering next alarm in the broadcast. It also got deferred.

    What should i do to solve this issue. Tried even with Removing Battery Optimization.

     



    1. Download the Forums for Android™ app!


      Download

       
  2. ocnbrze

    ocnbrze DON'T PANIC!!!!!!!!!

    is this for development for an app?
     
Loading...

Share This Page

Loading...