Pretend that device does not have GPS

2

I wonder if you have any way to "trick" the device during the debug talking that it does not have GPS. I do not want to just disable, if not during development the GPS will be found.

I have the purpose of verifying that the device has the GPS present or not.

    
asked by anonymous 13.08.2015 / 21:08

1 answer

1

I believe that the debugger does not have any predefined functions for such a thing, but you can create a if and force it to be false , for example your code should be something like:

if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
    //Código com GPS
} else {
    //Código sem GPS
}

If you want to pretend that GPS is not active do something like (apply false ):

if (false && locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)){
    //Código com GPS
} else {
    //Código sem GPS
}

Or you can simply comment on this line in the manifest:

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

And so:

<!-- uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" / -->
    
13.08.2015 / 21:53