• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java FitnessStatusCodes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpEntity类代码示例发布时间:2022-05-22
下一篇:
Java ProcessShellFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap