Xamarin, Android: Why is my mocked location not working? -
im starting feel hopeless. did is, built location mocker gets changed coordinated outside of method , overrides actual coordinates. wrote service calls method every 5 seconds:
public static string setmocklocation() { var context = android.app.application.context; var locationmanager = context.getsystemservice(locationservice) locationmanager; locationmanager.addtestprovider("test19", false, false, false, false, false, false, false, power.low, android.hardware.sensorstatus.accuracyhigh); var location = new location("test19"); location.latitude = add700tocoordinates(); location.longitude = globallongitude; location.accuracy = 0; location.time = datetime.now.ticks; location.elapsedrealtimenanos = 100; locationmanager.settestproviderlocation("test19", location); locationmanager.settestproviderenabled("test19", true); log.debug(tag,"mocklocation has been called service!"); locationmanager.removetestprovider("test19"); return location.latitude.tostring(); }
and see in debug info, works fine. right coordinates, edit them, , call method starts , not give exception. im guessing, works. somehow, google maps still places me right am, , not mocklocation tries put me to. can u please check method, if im doing right?
thanks :)
Comments
Post a Comment