Android: requestLocationUpdates updates location at most every 45 seconds

后端 未结 3 1306
無奈伤痛
無奈伤痛 2020-12-13 05:08

Background

I am writing an Android app whose main function is tracking the user\'s location and making an alert when the user gets near some point. Therefore I nee

3条回答
  •  心在旅途
    2020-12-13 05:38

    I was having a similar issue. I put a call to locationManager.requestSingleUpdate() at the end of onLocationChanged() and it forced back to back updates. You could set a delay command then execute requestSingleUpdate, making sure to register the containing locationListener.

    I was trying to create a GPS clock but the updates were inconsistent updating anywhere from 1-5 seconds or so. but it might work for another application.

提交回复
热议问题