当前位置: 首页>>代码示例>>Java>>正文


Java FitnessStatusCodes类代码示例

本文整理汇总了Java中com.google.android.gms.fitness.FitnessStatusCodes的典型用法代码示例。如果您正苦于以下问题:Java FitnessStatusCodes类的具体用法?Java FitnessStatusCodes怎么用?Java FitnessStatusCodes使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FitnessStatusCodes类属于com.google.android.gms.fitness包,在下文中一共展示了FitnessStatusCodes类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribeToSteps

import com.google.android.gms.fitness.FitnessStatusCodes; //导入依赖的package包/类
/**
 * Subscribe to an available {@link DataType}. Subscriptions can exist across application
 * instances (so data is recorded even after the application closes down).  When creating
 * a new subscription, it may already exist from a previous invocation of this app.  If
 * the subscription already exists, the method is a no-op.  However, you can check this with
 * a special success code.
 */
private void subscribeToSteps() {
    Fitness.RecordingApi.subscribe(googleApiClient, DataType.TYPE_STEP_COUNT_DELTA)
            .setResultCallback(new ResultCallback<Status>() {
                @Override
                public void onResult(@NonNull Status status) {
                    if (status.isSuccess()) {
                        if (status.getStatusCode()
                                == FitnessStatusCodes.SUCCESS_ALREADY_SUBSCRIBED) {
                            Log.i(TAG, "Existing subscription for activity detected.");
                        } else {
                            Log.i(TAG, "Successfully subscribed!");
                        }
                    } else {
                        Log.i(TAG, "There was a problem subscribing.");
                    }
                }
            });
}
 
开发者ID:jimmykane,项目名称:Athletica,代码行数:26,代码来源:GoogleFitStepsColumn.java

示例2: onResult

import com.google.android.gms.fitness.FitnessStatusCodes; //导入依赖的package包/类
@Override
public void onResult(Status status) {
    if (status.isSuccess()) {
        if (status.getStatusCode()
                == FitnessStatusCodes.SUCCESS_ALREADY_SUBSCRIBED) {
            log("Existing subscription detected.");
        } else {
            log("Successfully set fitness API!");
        }
    } else {
        if (status.getStatusMessage()!=null) {
            error( status.getStatusMessage());
        } else {
            error("subscribe to fit api failed");
        }
    }
}
 
开发者ID:connectordb,项目名称:connectordb-android,代码行数:18,代码来源:GoogleFitLogger.java

示例3: subscribe

import com.google.android.gms.fitness.FitnessStatusCodes; //导入依赖的package包/类
public void subscribe(DataType dataType) {
    Fitness.RecordingApi.subscribe(client, dataType)
            .setResultCallback(new ResultCallback<Status>() {
                @Override
                public void onResult(Status status) {
                    if (status.isSuccess()) {
                        if (status.getStatusCode() == FitnessStatusCodes.SUCCESS_ALREADY_SUBSCRIBED) {
                            display.show("Existing subscription for activity detected.");
                        } else {
                            display.show("Successfully subscribed!");
                        }
                    } else {
                        display.show("There was a problem subscribing.");
                    }
                }
            });
}
 
开发者ID:parthsatra,项目名称:WalkPotato,代码行数:18,代码来源:Recording.java

示例4: onConnectionFailed

import com.google.android.gms.fitness.FitnessStatusCodes; //导入依赖的package包/类
@Override
public void onConnectionFailed(ConnectionResult result) {

    // Error while connecting. Try to resolve using the pending intent returned.
    if (result.getErrorCode() == ConnectionResult.SIGN_IN_REQUIRED ||
            result.getErrorCode() == FitnessStatusCodes.NEEDS_OAUTH_PERMISSIONS) {
        try {
            // Request authentication
            result.startResolutionForResult(this, REQUEST_OAUTH);
        } catch (IntentSender.SendIntentException e) {
            Log.e(TAG, "Exception connecting to the fitness service", e);
        }
    } else {
        Log.e(TAG, "Unknown connection issue. Code = " + result.getErrorCode());
    }
}
 
开发者ID:zmarkan,项目名称:Google-Fit-Experiments,代码行数:17,代码来源:FitActivity.java

示例5: onRecordingSubscription

import com.google.android.gms.fitness.FitnessStatusCodes; //导入依赖的package包/类
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);
    }
}
 
开发者ID:googlesamples,项目名称:android-play-games-in-motion,代码行数:15,代码来源:FitResultCallback.java


注:本文中的com.google.android.gms.fitness.FitnessStatusCodes类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。