Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Mock GPS provider in Android

$
0
0

I have Xamarin.Forms project and I am trying to mock GPS provider in Android project. In my code I created test provider like this...

lockManager.AddTestProvider("gps_test_provider",
                                "requiresNetwork" == "",
                                "requiresSatellite" == "",
                                "requiresCell" == "",
                                "hasMonetaryCost" == "",
                                "supportsAltitude" == "",
                                "supportsSpeed" == "",
                                "supportsBearing" == "",
                                 Power.Low,
                                 Android.Hardware.SensorStatus.AccuracyLow);

Then I have there function to mock GPS, but it fails everytime on this error...

java.lang.SecurityException: Requires ACCESS_MOCK_LOCATION secure setting

which is weird, because I have this permission enabled.

Have somebody tried to mock the provider for Android? Can you provide me some example? Then I need to do the same for iOS.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>