Samuel
Samuel

Reputation: 4387

Mock GPS Provider only works while in Debug mode

I have been updating an app and pulling the version target forward, and we are running into an issue with GPS Mocking.

The mock locations works perfectly when debugging with android studio, but when I leave debugging and just run normally it doesn't work at all.

Background:

This is pulling GPS information over serial and mocking the device's location. This all works right up until the mocking, then the location wont be set unless I am actively debugging.

If I am missing something please let me know, it seems like some security restriction I'm not aware of holding us down.

EDIT: I still can't find anything around this, and it seems specifically when I'm stepping through the code it works, but otherwise just running doesn't work

Upvotes: 8

Views: 1162

Answers (2)

Samuel
Samuel

Reputation: 4387

It seems as if Mock Locations REQUIRES debug mode. When creating a "release" build debug mode still had to be declared.

Upvotes: 1

Burak Day
Burak Day

Reputation: 959

Have you checked [ro.allow.mock.location] with getprop | grep mock over adb shell?

Set it to 1 (setprop ro.allow.mock.location 1) it should work on release mode as well. It's initially 0. If that doesn't work please give me a feedback so i can change my answer.

Upvotes: 6

Related Questions