コード例 #1
0
        public Task <bool> Start()
        {
            MvxTrace.TaggedTrace(MvxTraceLevel.Diagnostic, "Geofencing", "Start");

            var  tcs    = new TaskCompletionSource <bool>();
            bool result = false;

            UIKit.UIApplication.SharedApplication.InvokeOnMainThread(async() =>
            {
                result = await GeofencingUtil.RequestPermissionAsync();

                if (result)
                {
                    GeofencingProvider.UpdateRegionLeft += OnUpdateRegionLeft;
                    GeofencingProvider.RegionEntered    += OnRegionEntered;
                    GeofencingProvider.InitGeoFencing();

                    await SetupRegions();
                }

                tcs.TrySetResult(result);
            });

            return(tcs.Task);
        }