Beispiel #1
0
 private async void BackgroundService()
 {
     await Task.Run(() =>
     {
         try
         {
             while (true)
             {
                 InvokeOnMainThread(delegate
                 {
                     _beaconService   = DependencyService.Resolve <IBeaconService>();
                     _userDataService = DependencyService.Resolve <UserDataService>();
                     if (_userDataService.IsExistUserData)
                     {
                         _beaconService.StartAdvertisingBeacons(_userDataService.Get());
                     }
                 });
                 System.Threading.Thread.Sleep(60000);
             }
         }
         catch (Exception ex)
         {
             System.Diagnostics.Debug.WriteLine(ex.Message + System.Environment.NewLine + ex.StackTrace);
         }
     }).ConfigureAwait(false);
 }
Beispiel #2
0
        protected override void OnStart()
        {
            ImageService.Instance.Config.Logger = Container.Resolve <IMiniLogger>();

            UserDataService userDataService = Xamarin.Forms.DependencyService.Resolve <UserDataService>();

            if (userDataService.IsExistUserData)
            {
                UserDataModel _userData = userDataService.Get();
                _beaconService = Xamarin.Forms.DependencyService.Resolve <IBeaconService>();
                _beaconService.StartRagingBeacons(_userData);
                _beaconService.StartAdvertisingBeacons(_userData);
            }
        }