Force Proximity Alert for using a network provider

Is there a way to force proximity alerts to use only the network provider? I am worried about the battery leak. A good solution would also be to force a proximity alert that takes more than 4 minutes.

Any ideas?

+4
source share
2 answers

A brilliant question, unfortunately, although I don’t think it would be possible, just looked at the documentation, pay attention to this. "Prior to API version 17, this method can be used with ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION . From API version 17 onwards, for this method ACCESS_FINE_LOCATION permission ACCESS_FINE_LOCATION . " Therefore, they make it mandatory to transmit GPS resolution.

So there is currently no way to get him to use any particular provider.

There is an Enhancement feature requested for the same, and run it to get Google to implement it.

Improvement link: https://code.google.com/p/android/issues/detail?id=33151

+1
source

If your project does not require gps for other functions, you can set the SDK target to version 16:

 android:targetSdkVersion="16" 

and only a rough location is required:

 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> 

therefore, proximity alerts will not check for a gps signal. My point is that the user keeps GPS ON in a leak state, remember that this is a switch, you must consider it in the application requirement.

+1
source

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


All Articles