Esempio n. 1
0
  private void registerIntent() {

    if (mRecognitionPendingIntent == null) {
      Intent intent = new Intent(mApplicationContext, SKActivityRecognitionIntentService.class);
      mRecognitionPendingIntent =
          PendingIntent.getService(
              mApplicationContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    }

    mActivityRecognition.requestActivityUpdates(mClient, 0, mRecognitionPendingIntent);
  }
Esempio n. 2
0
  private void unregisterIntent() {

    mActivityRecognition.removeActivityUpdates(mClient, mRecognitionPendingIntent);
    mRecognitionPendingIntent.cancel();
    mRecognitionPendingIntent = null;
  }