Search code examples
androidandroid-studiolocationandroid-locationandroid-thread

Set a timer for Fused Location provider onLocationChanged


I am using FusedLocationClient for the location. I have noticed that some times it takes too much time for onLocationChanged() to get called because of whatever issues. Is there any good way that i can put a timer on that, for example if i don't get the onLocationChanged() callback after 10 seconds it will show the location fetching failed. I know I can user thread but what I am looking for is better solution like some type of api method or something.


Solution

  • just simply use the handler.postDelayed() method.