Android – how to check whether the user in the location application has closed the location service in real time

I am developing a tracking application using the converged location API. I want to programmatically check whether the user has turned off the location service when the application is running

I'm considering running parallel threads to check if the user turns off GPS every 5 seconds using the locationmanager. Isproviderenabled() method

Is this the right way or is there a better way?

resolvent:

With the broadcast receiver, you will be automatically notified when you change your GPS settings

Link here:

https://developer.android.com/training/monitoring-device-state/manifest-receivers.html

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>