Exemple #1
0
 void OnBikingStateChanged(BikingState previousState, BikingState newState)
 {
     if (previousState == BikingState.NotBiking && newState == BikingState.Biking)
     {
         // A biking trip was started, decrease activity recognition delay and show notification
         ShowNotification();
         if (actRecognitionHandler == null)
         {
             actRecognitionHandler = new ActivityRecognitionHandler(this);
         }
         actRecognitionHandler.SetTrackingEnabled(true, desiredDelay: TrackingDelay.Short);
     }
     else if (previousState != BikingState.NotBiking && newState == BikingState.NotBiking)
     {
         // A biking trip finished, hide notification and restore old activity recognition delay
         HideNotification();
         if (actRecognitionHandler == null)
         {
             actRecognitionHandler = new ActivityRecognitionHandler(this);
         }
         actRecognitionHandler.SetTrackingEnabled(true, desiredDelay: TrackingDelay.Long);
     }
     else if (previousState == BikingState.Biking &&
              (newState == BikingState.InGrace || newState == BikingState.MovingNotOnBike))
     {
         // We were put in grace, update the currently shown notification
         UpdateNotification(inGrace: true);
     }
     else if ((previousState == BikingState.InGrace || previousState == BikingState.MovingNotOnBike) &&
              newState == BikingState.Biking)
     {
         // We were put out of grace, revert the notification to its old style
         UpdateNotification(inGrace: false);
     }
 }
 public override void OnReceive(Context context, Intent intent)
 {
     var prefs = new PreferenceManager (context);
     if (!prefs.FirstTimeAround && prefs.Enabled) {
         var actRecognitionHandler = new ActivityRecognitionHandler (context);
         actRecognitionHandler.SetTrackingEnabled (true);
     }
 }
Exemple #3
0
 void SetTrackingEnabled(bool enabled)
 {
     if (actRecognitionHandler == null)
     {
         actRecognitionHandler = new ActivityRecognitionHandler(this);
     }
     actRecognitionHandler.SetTrackingEnabled(enabled);
 }
Exemple #4
0
        public override void OnReceive(Context context, Intent intent)
        {
            var prefs = new PreferenceManager(context);

            if (!prefs.FirstTimeAround && prefs.Enabled)
            {
                var actRecognitionHandler = new ActivityRecognitionHandler(context);
                actRecognitionHandler.SetTrackingEnabled(true);
            }
        }
Exemple #5
0
 void OnBikingStateChanged(BikingState previousState, BikingState newState)
 {
     if (previousState == BikingState.NotBiking && newState == BikingState.Biking) {
         // A biking trip was started, decrease activity recognition delay and show notification
         ShowNotification ();
         if (actRecognitionHandler == null)
             actRecognitionHandler = new ActivityRecognitionHandler (this);
         actRecognitionHandler.SetTrackingEnabled (true, desiredDelay: TrackingDelay.Short);
     } else if (previousState != BikingState.NotBiking && newState == BikingState.NotBiking) {
         // A biking trip finished, hide notification and restore old activity recognition delay
         HideNotification ();
         if (actRecognitionHandler == null)
             actRecognitionHandler = new ActivityRecognitionHandler (this);
         actRecognitionHandler.SetTrackingEnabled (true, desiredDelay: TrackingDelay.Long);
     } else if (previousState == BikingState.Biking
                && (newState == BikingState.InGrace || newState == BikingState.MovingNotOnBike)) {
         // We were put in grace, update the currently shown notification
         UpdateNotification (inGrace: true);
     } else if ((previousState == BikingState.InGrace || previousState == BikingState.MovingNotOnBike)
                && newState == BikingState.Biking) {
         // We were put out of grace, revert the notification to its old style
         UpdateNotification (inGrace: false);
     }
 }
Exemple #6
0
		void SetTrackingEnabled (bool enabled)
		{
			if (actRecognitionHandler == null)
				actRecognitionHandler = new ActivityRecognitionHandler (this);
			actRecognitionHandler.SetTrackingEnabled (enabled);
		}