locked
LocationManager OnLocationChanged don't fired RRS feed

  • Question

  • User123835 posted

    Hello guys, I have this problem, I have an Activity with the following code: public class CreateProperty : Activity, ILocationListener I have an ImageView with this event: imGeolocation.Click += (object sender, System.EventArgs e) => { locmngr = GetSystemService(Context.LocationService) as LocationManager; if(locmngr.IsProviderEnabled(LocationManager.GpsProvider)) { locmngr.RequestLocationUpdates (this.Provider, 0, 0, this);} }; I declared the methods for the ILocationListener: public void OnLocationChanged (Android.Locations.Location location) { txtPropertyGeolocation.Text = location.Latitude + "-" + location.Longitude; } Why the method OnLocationChanged don't fired?

    I need to get the Location (Latitud - Longitud) Any help with that?

    thanks in advanced Jose

    Tuesday, June 2, 2015 11:58 PM

Answers

  • User25759 posted

    You could use my Geolocator plugin to call from shared code: https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Geolocator

    Also the code is here:

    https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Geolocator/Geolocator/Geolocator.Plugin.Android

    Also did you set your permissions correct?

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, June 4, 2015 4:12 AM

All replies

  • User129255 posted

    I think you need to set minTime and minDistance params higher than 0.

    Wednesday, June 3, 2015 6:08 AM
  • User123835 posted

    I don't think that this were the problem really, because i was debugged and the method OnLocationChanged is not fired never...

    Wednesday, June 3, 2015 11:44 PM
  • User25759 posted

    You could use my Geolocator plugin to call from shared code: https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Geolocator

    Also the code is here:

    https://github.com/jamesmontemagno/Xamarin.Plugins/tree/master/Geolocator/Geolocator/Geolocator.Plugin.Android

    Also did you set your permissions correct?

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Thursday, June 4, 2015 4:12 AM
  • User123835 posted

    Thanks you very much @JamesMontemagno it is very nice from you give us this code to people that were started now. It work perfectly.

    Thursday, June 4, 2015 10:46 PM