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.
Android device store a lot of cache, it is due to stored cache. We have to remove cache/data and to restart the device.