Geofence Plugin for Xamarin iOS and Android

Hi, such a problem for my application needs to implement a geofence.
I register a region that is being listened to when you are in a registered region, the application simply ends.

Here is the region registration code:
location locationFrom = await fullOrderMV.GetLonAndLanToAddress (fullOrderMV.Orders [0] .FromAddress);
            location locationTo = await fullOrderMV.GetLonAndLanToAddress (fullOrderMV.Orders [0] .ToAddress);
            if (locationFrom! = null)
            {
                CrossGeofence.Current.StartMonitoring (new GeofenceCircularRegion ($ "{fullOrderMV.Orders [0] .ID.ToString ())}, {locationTo.lat}, {locationTo.lng}", Convert.ToDouble (locationFrom.lat), Convert. ToDouble (locationFrom.lng), 1000)
                {
                    StayedInThresholdDuration = TimeSpan.FromSeconds (10),
                });
                // var placemark = new Placemark
                // {
                // Thoroughfare = fullOrderMV.Orders [0] .FromAddress
                //};
                // var options = new MapLaunchOptions {Name = "1", NavigationMode = NavigationMode.None};
                // await Map.OpenAsync (placemark, options);

Here is the code for the class with the implemented interface from the Geofence Plugin for Xamarin iOS and Android library:
 public class CrossGeofenceListener: IGeofenceListener
    {
        private ManagerTaxi managerTaxi = null;

        public async void OnAppStarted ()
        {
            await Task.Run (async () =>
            {
                CrossGeofence.Current.StopMonitoringAllRegions ();
            });
        }

        public async void OnError (string error)
        {
            await Task.Run (async () =>
            {
            });
            // CrossGeofence - You need to enabled Location Services
        }

        public async void OnLocationChanged (GeofenceLocation location)
        {
            await Task.Run (async () =>
            {
            });
        }

        public async void OnMonitoringStarted (string identifier)
        {
            await Task.Run (async () =>
            {
            });
        }

        public async void OnMonitoringStopped ()
        {
            await Task.Run (async () =>
            {
            });
        }

        public async void OnMonitoringStopped (string identifier)
        {
            await Task.Run (async () =>
            {
            });
        }

        public void OnRegionStateChanged (GeofenceResult result)
        {
            Device.BeginInvokeOnMainThread (async () =>
            {
                if (result.TransitionName == "Entered")
                {
                    Debug.WriteLine ("2133333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333");
                    string [] lanlong = result.RegionId.Split (',');
                    CrossGeofence.Current.StopMonitoring (result.RegionId);
                    var options = new MapLaunchOptions {Name = "1", NavigationMode = NavigationMode.None};
                    await Map.OpenAsync (Convert.ToDouble (lanlong [1]), Convert.ToDouble (lanlong [2]), options);
                }
            });
        }
    }

Here is the output after completing the application:
06-06 10: 17: 40.027 E / mono-rt (4561): 9827b000-9827c000 --- p 00000000 00:00 0
06-06 10: 17: 40.027 E / mono-rt (4561): 9827c000-9837b000 rw-p 00000000 00:00 0 [stack: 4640]
06-06 10: 17: 40.027 E / mono-rt (4561): 9837b000-9837c000 --- p 00000000 00:00 0
Memory around native instruction pointer (0xb27c33ff): 06-06 10: 17: 40.027 E / mono-rt (4561): 9837c000-9837d000 --- p 00000000 00:00 0

06-06 10: 17: 40.027 E / mono-rt (4561): 9837d000-98480000 rw-p 00000000 00:00 0 [stack: 4636]
0xb27c33ef 06-06 10: 17: 40.027 E / mono-rt (4561): 98480000-98500000 rw-p 00000000 00:00 0 [anon: libc_malloc]

06-06 10: 17: 40.043 F / libc (4561): Fatal signal 11 (SIGSEGV), code 1, fault addr 0x50 in tid 4649 (IntentService [n) 00

00 8b 6c 24 70 8b 46 78 85 c0 74 16 0f b7 10 ... l $ p.Fx..t ....
0xb27c33ff 8b 4d 50 39 ca 7c 0c 8b 7c 88 04 85 ff 0f 85 54 .MP9. | .. | ...... T
0xb27c340f 01 00 00 8b 44 24 78 c7 00 00 00 00 00 e8 6f 65 .... D $ x ....... oe
0xb27c341f fd ff 89 2c 24 e8 e7 ab f8 ff 8b 76 78 85 f6 74 ..., $ ...... vx..t

No native Android stacktrace (see debuggerd output).

================================================= ===============
Managed Stacktrace:
================================================= ===============
required for stack walk ============================================= ====================
Отправить отзыв
История
Сохранено
Сообщества

Best Answer

Answers

Sign In or Register to comment.