Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace default GPS signal provider on Android devices

I would like to replace the default GPS location provider on android phones with my own coordinate source.

Is there any layer/API/library/provider that would allow to be replaced with my signal provider instead of the built-in hardware GPS, or read from an external plugin? It should allow all apps that rely on the GPS service to receive my signal instead of GPS. Ideally, the replacement should still be able to access the GPS signal (for comparison/correction or to toggle between the two providers).

I am thinking for example of implementing my own LocationManager, and registering it in the system (as optional or default), if that is possible. But at this stage, I am still trying to find out what is possible and suitable.

Thank you for any pointers.

like image 945
relet Avatar asked Sep 03 '10 13:09

relet


People also ask

What is Android location provider?

LocationProvider is the super class for location providers. A location provider provides the information of the geographical location of the device. This information is stored in the Location class. For accessing the location based services Android provide different classes that are available in android.

Why is my location wrong on my Android phone?

For Samsung smartphones running Android 10 OS, the location information may appear inaccurate if the GPS signal is obstructed, location settings is disabled, or if you are not using the best location method.

How do you check location is enabled or not in android?

Settings > Location > Mode > Battery Saving . This mode only uses WiFi, Bluetooth or mobile data instead of GPS to determine the user location. That's why you have to check if the network provider is enabled and locationManager.


1 Answers

Replacing the "default" is not allowed at this time and the only work around is to create a mock provider. First you must set the security permission:

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

Second, set your code to use the mock provider which you will create. There is some excellent information about how to accomplish this here: http://diffract.me/2009/11/android-location-provider-mock/

like image 187
Paul Gregoire Avatar answered Nov 15 '22 18:11

Paul Gregoire