From f46471e304f98d7cbf0aa4e7c23b9fe29b3952a6 Mon Sep 17 00:00:00 2001
From: Luan Nguyen
To track a bike ride, use the
-
-ACTION_TRACK action with the "vnd.google.fitness.activity/biking"
-MIME type and set the
-
-EXTRA_STATUS extra to
-
-STATUS_ACTIVE when starting and to
-
-STATUS_COMPLETED when stopping.
ACTION_TRACK"vnd.google.fitness.activity/biking"EXTRA_STATUSSTATUS_ACTIVE when starting and
-
- STATUS_COMPLETED when stopping.Example intent:
-
-public void startBikeRide() {
- Intent intent = new Intent(FitnessIntents.ACTION_TRACK)
- .setType("vnd.google.fitness.activity/biking")
- .putExtra(FitnessIntents.EXTRA_STATUS, FitnessIntents.STATUS_ACTIVE);
- if (intent.resolveActivity(getPackageManager()) != null) {
- startActivity(intent);
- }
-}
-
-
-
-Example intent filter:
--<activity ...> - <intent-filter> - <action android:name="vnd.google.fitness.TRACK" /> - <data android:mimeType="vnd.google.fitness.activity/biking" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> -</activity> -- - - - - -
To track a run, use the
-
-ACTION_TRACK action with the "vnd.google.fitness.activity/running"
-MIME type and set the
-
-EXTRA_STATUS extra to
-
-STATUS_ACTIVE when starting and to
-
-STATUS_COMPLETED when stopping.
ACTION_TRACK"vnd.google.fitness.activity/running"EXTRA_STATUSSTATUS_ACTIVE when starting and
-
- STATUS_COMPLETED when stopping.Example intent:
-
-public void startRun() {
- Intent intent = new Intent(FitnessIntents.ACTION_TRACK)
- .setType("vnd.google.fitness.activity/running")
- .putExtra(FitnessIntents.EXTRA_STATUS, FitnessIntents.STATUS_ACTIVE);
- if (intent.resolveActivity(getPackageManager()) != null) {
- startActivity(intent);
- }
-}
-
-
-
-Example intent filter:
--<activity ...> - <intent-filter> - <action android:name="vnd.google.fitness.TRACK" /> - <data android:mimeType="vnd.google.fitness.activity/running" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> -</activity> -- - - - -
To track a workout, use the
-
-ACTION_TRACK action with the "vnd.google.fitness.activity/other"
-MIME type and set the
-
-EXTRA_STATUS extra to
-
-STATUS_ACTIVE when starting and to
-
-STATUS_COMPLETED when stopping.
ACTION_TRACK"vnd.google.fitness.activity/other"EXTRA_STATUSSTATUS_ACTIVE when starting and
-
- STATUS_COMPLETED when stopping.Example intent:
-
-public void startWorkout() {
- Intent intent = new Intent(FitnessIntents.ACTION_TRACK)
- .setType("vnd.google.fitness.activity/other")
- .putExtra(FitnessIntents.EXTRA_STATUS, FitnessIntents.STATUS_ACTIVE);
- if (intent.resolveActivity(getPackageManager()) != null) {
- startActivity(intent);
- }
-}
-
-
-
-Example intent filter:
--<activity ...> - <intent-filter> - <action android:name="vnd.google.fitness.TRACK" /> - <data android:mimeType="vnd.google.fitness.activity/other" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> -</activity> -- - - - -
To show the user's heart rate, use the
-
-ACTION_VIEW action with the
-"vnd.google.fitness.data_type/com.google.heart_rate.bpm" MIME type.
ACTION_VIEW"vnd.google.fitness.data_type/com.google.heart_rate.bpm"Example intent:
-
-public void showHeartRate() {
- Intent intent = new Intent(FitnessIntents.ACTION_VIEW)
- .setType("vnd.google.fitness.data_type/com.google.heart_rate.bpm");
- if (intent.resolveActivity(getPackageManager()) != null) {
- startActivity(intent);
- }
-}
-
-
-
-Example intent filter:
--<activity ...> - <intent-filter> - <action android:name="vnd.google.fitness.VIEW" /> - <data android:mimeType="vnd.google.fitness.data_type/com.google.heart_rate.bpm" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> -</activity> -- - - - - -
To show the user's step count, use the
-
-ACTION_VIEW action with the
-"vnd.google.fitness.data_type MIME
-type.
/com.google.step_count
.cumulative"
ACTION_VIEW"vnd.google.fitness.data_type/com.google.step_count.cumulative"Example intent:
-
-public void showStepCount() {
- Intent intent = new Intent(FitnessIntents.ACTION_VIEW)
- .setType("vnd.google.fitness.data_type/com.google.step_count.cumulative");
- if (intent.resolveActivity(getPackageManager()) != null) {
- startActivity(intent);
- }
-}
-
-
-
-Example intent filter:
--<activity ...> - <intent-filter> - <action android:name="vnd.google.fitness.VIEW" /> - <data android:mimeType="vnd.google.fitness.data_type/com.google.step_count.cumulative" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> -</activity> -- - - - - - - -
FitnessIntents.ACTION_TRACKFitnessIntents.ACTION_TRACKFitnessIntents.ACTION_TRACKFitnessIntents.ACTION_VIEWFitnessIntents.ACTION_VIEW