com.google.android.gms.fitness.FitnessStatusCodes Java Examples
The following examples show how to use
com.google.android.gms.fitness.FitnessStatusCodes.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FitResultCallback.java From android-play-games-in-motion with Apache License 2.0 | 5 votes |
private void onRecordingSubscription(Status status) { if (status.isSuccess()) { if (status.getStatusCode() == FitnessStatusCodes.SUCCESS_ALREADY_SUBSCRIBED) { Utils.logDebug(TAG, "Existing subscription for activity detected."); } else { Utils.logDebug(TAG, "Started recording data for " + mDataType); } } else { // For a better user experience, you can add visual error text indicating the session // will not be recorded to the cloud. Utils.logDebug(TAG, "Unable to start recording data for " + mDataType); } }
Example #2
Source File: MainActivity.java From AndroidDemoProjects with Apache License 2.0 | 5 votes |
private void initCallbacks() { mSubscribeResultCallback = new ResultCallback<Status>() { @Override public void onResult(@NonNull Status status) { if (status.isSuccess()) { if (status.getStatusCode() == FitnessStatusCodes.SUCCESS_ALREADY_SUBSCRIBED) { Log.e( "RecordingAPI", "Already subscribed to the Recording API"); } else { Log.e("RecordingAPI", "Subscribed to the Recording API"); } } } }; mCancelSubscriptionResultCallback = new ResultCallback<Status>() { @Override public void onResult(@NonNull Status status) { if (status.isSuccess()) { Log.e( "RecordingAPI", "Canceled subscriptions!"); } else { // Subscription not removed Log.e("RecordingAPI", "Failed to cancel subscriptions"); } } }; mListSubscriptionsResultCallback = new ResultCallback<ListSubscriptionsResult>() { @Override public void onResult(@NonNull ListSubscriptionsResult listSubscriptionsResult) { for (Subscription subscription : listSubscriptionsResult.getSubscriptions()) { DataType dataType = subscription.getDataType(); Log.e( "RecordingAPI", dataType.getName() ); for (Field field : dataType.getFields() ) { Log.e( "RecordingAPI", field.toString() ); } } } }; }