android - MvvmCross IMvxGeoLocationWatcher never fires MvxGeoLocation success -
i'm using mvvmcross location plugin. on devices, mvxgeolocation success fires, on others never does. have seen other similar questions answers (mvvmcross imvxgeolocationwatcher success action never fires on android). however, not working on devices (rebooting), solution not valid. device i'm testing on right on android v 4.0.3, htc vivid. client reporting same issue on devices. below locationservice code, onlocation method never firing on these devices.
public class locationservice : ilocationservice { private readonly imvxgeolocationwatcher _locationwatcher; private readonly imvxmessenger _messenger; public double latitude { get; set; } public double longitude { get; set; } public bool haslocation() { return (latitude != 0.0 && longitude != 0.0); } public locationservice(imvxgeolocationwatcher locationwatcher, imvxmessenger messenger) { _locationwatcher = locationwatcher; _messenger = messenger; _locationwatcher.start(new mvxgeolocationoptions(){ enablehighaccuracy = true}, onlocation, onerror); } private void onerror(mvxlocationerror error) { _messenger.publish(new gpsunavailablemessage(this)); } private void onlocation(mvxgeolocation location) { latitude = location.coordinates.latitude; longitude = location.coordinates.longitude; var message = new locationmessage(this, location.coordinates.latitude, location.coordinates.longitude); _messenger.publish(message); } }
here messages showing in logcat, i'm getting gps location?
07-31 11:54:59.883: v/gpslocationprovider(246): sv count: 9 ephemerismask: 93d5 almanacmask: 93d5 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 1 snr: 0.0 elev: 7.0 azimuth: 146.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 3 snr: 0.0 elev: 33.0 azimuth: 49.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 5 snr: 0.0 elev: 0.0 azimuth: 0.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 7 snr: 0.0 elev: 74.0 azimuth: 351.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 8 snr: 0.0 elev: 43.0 azimuth: 314.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 9 snr: 0.0 elev: 36.0 azimuth: 312.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 10 snr: 0.0 elev: 0.0 azimuth: 0.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 13 snr: 0.0 elev: 39.0 azimuth: 188.0 e 07-31 11:54:59.883: v/gpslocationprovider(246): sv: 16 snr: 0.0 elev: 1.0 azimuth: 66.0 e
so mono android problem? following code never triggers ilocationlistener:
[register("requestlocationupdates", "(ljava/lang/string;jflandroid/location/locationlistener;)v", "getrequestlocationupdates_ljava_lang_string_jflandroid_location_locationlistener_handler")] public virtual void requestlocationupdates(string provider, long mintime, float mindistance, ilocationlistener listener);
this appears problem xamarin.android when upgrading. uninstalling xamarin.android , reinstalling v 4.8 solved issue.
Comments
Post a Comment