سؤال

i'm developing an Android Application and i need to test my app using Mock Locations, going out at 5AM with almost 0ºC isnt reaaly a good idea!!. I'm using Google Play services Location API,

So, i read Google Documentation and made all the requirements to use Mock Locations.

1 - Add ACCESS_MOCK_LOCATION permission on Manifest -

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

2 - Check the box in Developers Options to "Allow mock Location.

3- Turn on Mock Mode with mLocationClinet.setMockMode(true);

But, in execution time, i got the next error when setMockMode is executed.

java.lang.SecurityException: Client must have ACCESS_MOCK_LOCATION permission to perform mock operations.    

Anyone with a similar problem? ideas?

هل كانت مفيدة؟

المحلول

It needs to be uses-permission, not permission:

<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top