android - why does this gps mock work and how to prevent/detect it?

1.9k views Asked by At

referring to this answer: https://stackoverflow.com/a/25849595/5015502

does this work because only system apps are allowed to change allow_mock regardless of the permissions in the manifest? and you have to have root access to give an app system status?

how to prevent or detect this? as stated in the answer, the setting and unsetting is too fast to get detected.. so would this mean you would have to detect if there is root access and then basically assuming that mocking is possible and possibly restrict features of your app from all the users that have rooted their device and just might be mocking the location?

thank you for clarifying.

1

There are 1 answers

7
shkschneider On BEST ANSWER

It works because it uses root.

You can generally check for mock locations using Location.isFromMockProvider().