Example #1
0
        public static readonly string TAG = typeof(MeasurementJob).FullName; //unique TAG

        public override bool OnStartJob(IJobParameters jobParameters)
        {
            Task.Run(async() =>
            {
                TestMeViewModel testMeViewModel = new TestMeViewModel();
                //DependencyService.Get<IBand>().SendVibration();
                await MeasurementHandler.ResendIntervals();                    //resend previous measurements if exist
                await MeasurementHandler.GetStressResult(-1, testMeViewModel); //start new measurement. -1 => real measurement
                String[] stressRes = testMeViewModel.StressResult.Split(" ");
                int tempLen        = stressRes.Length;
                if (stressRes[0] != "Error:" && stressRes[tempLen - 2] != "not") //this is a stress moment
                {
                    CrossLocalNotifications.Current.Show("RelaxApp noticed stress", "Tap into the app for more information");
                    EmailService.Execute(); //send mail to Emergency Contact
                }
            });
            return(true);
        }