In my app I am using Android Location Manager API and I have a requirement of identifying whether the location coordinates are from normal Location Manager or if they are from Fake(Mock) Location provider. I used location.isFromMockProvider()
. Once I turn on the fake location providing app, isFromMockProvider() method returns me true. And after that it does not matter if I turn, fake location providing app, on or off isFromMockProvider() method always returns true.
I found that once FakeGPS app, once triggered, overrides the location manager coordinates and once I stop the FakeGPS app, the Location Manager does not start collecting correct coordinates.
Is there something I am missing.
Disappointed with no response but I am glad that I got it working :) Posting the resolution as it might help someone else.
Once the FakeGPS app starts mocking location, it stops my app's Location manager. Now even if I stop the FakeGPS app mocking service, the location manager of my app won't trigger back. I have to detect the event and restart the location manager of my app, after removing any test provider and clearing test locations.