-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to check whether any app is set to use slected Mock Locations setting or not in Android Marshmallow #1
Comments
I cannot try right now, but maybe using a loop of installed apps and check if any of this is selected as
If this works (I cannot try right now) I will combine this block with my current code for Android < 6.0 |
@tomloprod what is this mContext where is the object creation for this? getPackageManager() without reference will it work? |
Inside the cordova plugin, you can get the
|
and uid is an integer value |
I find the solution in this http://stackoverflow.com/questions/22396382/cant-find-getpackagemanager-method-in-android |
Perfect. Yes |
After adding the code whatever you have suggested me. I am getting following error. |
Hmmm, I don't know this permission. Try to add this in
|
While iterating installed apps, If any of the app has not updated with this permission then we will get this exception I think so. Even If I add for this plugin there will be no use. Because while iterating the apps, lets say we got first object is fake GPS then this app has have UPDATE_APP_OPS_STATS permission. |
I thought you got that exception out of the loop, on this line:
Well... If what you said it's true, there is no way to check if there is an application marked as |
Yes! Even I am also thinking There no way to check by iterating all installed apps and checking the permissions of the other apps. I think we can not do that in android because we can see the permissions of another apps from our application. |
Maybe it's possible to see the permissions of another apps. See this: http://stackoverflow.com/questions/5385957/how-to-get-apps-permission-for-each-app-how-to-do-it-programmatically-on-andro#14672557 |
But these permission will be set at the time of installation requested by the app to the user. User will select the particular app to mock the locations right? I don't think for this any permission will set. And one more issue is there, If the user has rooted his phone then without changing settings he spoof the GPS Coordinates. |
Root devices can do all. I'm thinking of NO rooted devices. Anyway I only answer your question:
I guess the way to check if the devices is using mock locations in Android Marshmallow is using the Maybe the solution goes through to change the code you are use to get the location (cordova-plugin-geolocation, cordova-plugin-background-geolocation, ...) and return, with the coordinates, a boolean. Lot of work for something like this... But if its a requirement, is the only way to do that, I guess. |
Any progress on this? This is a great plugin just that it doesnt work on Marshmallow and above, which is 98% of our target users. |
@rafialikhan I have not had time to inquire into this problem. I think the solution is to implement the "isFromMockProvider" method in the plugin that provides the locations. |
In Android Marshmallow the plugin is always returning true.
The text was updated successfully, but these errors were encountered: