Search code examples
androidgeolocationandroid-permissions

Caused by: java.lang.SecurityException: com.example.geofences from uid 10049 not allowed to perform MOCK_LOCATION


I'm working on GPS location related App, i'm faceing below issue while genarating Mock Location points to App for testing.

Caused by: java.lang.SecurityException: com.example.geofences from uid 10049 not allowed to perform MOCK_LOCATION


Solution

  • We need to do two steps:

    Step 1: Give a permission in Android Manifest

    <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"></uses-permission>
    

    Step 2: In your real device,

    Go to Setting --> Developer option --> Mock location app option and select your app for testing.

    Mock location works fine... :)

    Thanks,