Avoid removing the TestProvider from the Mock Location

5

I'm trying to mock location for use in another application, but that application is removing my TestProvider, making it impossible to mock the location.

How can I prevent this other app from removing my TestProvider ?

The code that the other application is running to prevent mock is:

private void BuscarLocalizacaoAtual(String provider, LocationListener locationListener) {
    try {
        this.locationManager.removeTestProvider(provider);
    } catch (Exception e) {
    }
    this.locationManager.requestLocationUpdates(provider, time, 0.0f, locationListener);
}

* I would like to initially get around this problem through an apk. I know I could do this by editing the operating system.

bounty of 100 for anyone who helps me dribble this deal.

    
asked by anonymous 30.11.2015 / 18:16

1 answer

1

SOen translated response:

It seems the only way to do this is to use a mock location provider.

You need to enable dummy sites in the development panel and their add-on settings to your manifest:

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

Now you can go into your code and create your own fake location provider and set the location of the provider.

Here's a cool site to pick up some more details!

    
07.12.2015 / 22:17