Periodically check if Android Android has new data

I successfully get GPS data through the registerLocationListener () and onLocationChanged () methods. The only problem is that the reading speed of my application freezes if there is no GPS data anymore (for example, when I go indoors, enter a tunnel, etc.). The behavior that I want for my application is that the user is somehow notified that the speed readings are probably not accurate due to the lack of fresh data (set speed to zero, flashing read speed, etc. .).

How can i do this? I periodically checked if any satellites were detected by the GPS module, but I'm not sure how to force periodic checks.

+3
source share
1 answer

Perhaps you could start a periodic timer. If the timer sees that the latest GPS fix is ​​out of date, it displays a notification. The app should remember when the last fix was.

+3
source

Source: https://habr.com/ru/post/1756401/


All Articles