Posts

Showing posts with the label Fake GPS

Detect fake/mock GPS apps on Android device

While we are working with location APIs in any Android App, we have to make sure that user is not using any fake/mock GPS apps. We can detect fake/mock GPS apps using two ways: Detect mock location is enabled in developer settings. Detect apps installed on device who are using mock location permissions. To detect the mock location settings:- public static boolean isMockLocationSettingsON(Context context) {         // returns true if mock location enabled, false if not enabled. if (Settings.Secure.getString(context.getContentResolver(),         Settings.Secure.ALLOW_MOCK_LOCATION).equals("0")) {        return false; } else { return true; } } To detect the mock location permissions:- public static ArrayList getListOfMockPermissionApps(Context context) { ArrayList mockPermissionApps = new ArrayList (); PackageManager pm = context.getPackageManager(); List pa...