public void StartMonitoring() { if (CMMotionActivityManager.IsActivityAvailable) { activityManager.StartActivityUpdates(MotionQueue, activity => { if (!activity.HasActivitySignature()) { return; } SaveMotionActivity(activity); UpdateUserContext(); }); } else { WriteLine("Activity updates are not available."); } if (CMPedometer.IsStepCountingAvailable) { pedometer.StartPedometerUpdates(NSDate.Now, (pedometerData, error) => { if (pedometerData != null) { SavePedometerData(pedometerData); UpdateUserContext(); } else if (error != null) { HandleError(error); } }); } else { WriteLine("Step counting is not available."); } }
static void PlatformStart() { _manager.StartActivityUpdates(new NSOperationQueue(), OnCMMotionActivity); }
public void StartMotionUpdates(Action <ActivityType> handler) { motionActivityMgr.StartActivityUpdates(NSOperationQueue.MainQueue, ((activity) => { handler(ActivityDataManager.ActivityToType(activity)); })); }