isFromMockProvider() is returning true even if I am turning off fake/mock location

Issue

I am getting location, to check that is it Mock or not I am doing it as:

if(location.isFromMockProvider()){
   return true;
}

If there is no fake gps app, it will return false.
I am testing it by downloading fake gps apps and adding them to developer options as Mock Location App and turning on that app.

Then this "if statement" will return me true. After it if I will turn off or uninstall the fake gps app, my code will return me true.
I am unable to understand why it is returning true even after uninstalling the fake gps app.

Solution

Android device store a lot of cache, it is due to stored cache. We have to remove cache/data and to restart the device.

Answered By – Faizan Ahmad

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published