com.google.android.gms.common.api.Status.getStatus()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中com.google.android.gms.common.api.Status.getStatus()方法的一些代码示例,展示了Status.getStatus()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Status.getStatus()方法的具体详情如下:
包路径:com.google.android.gms.common.api.Status
类名称:Status
方法名:getStatus

Status.getStatus介绍

[英]Returns the status of this result. Use #isSuccess() to determine whether the call was successful, and #getStatusCode() to determine what the error cause was.

Certain errors are due to failures that can be resolved by launching a particular intent. The resolution intent is available via #getResolution().
[中]返回此结果的状态。使用#isSuccess()确定调用是否成功,使用#getStatusCode()确定错误原因。
某些错误是由于可以通过启动特定意图来解决的故障造成的。解析意图可通过#getResolution()获得。

代码示例

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

@Override
  public void onResult(final Status result) {
    if (result.getStatus().isSuccess()) {
      if (BuildConfig.DEBUG) {
        Log.d(TAG, "stopApplication$onResult: Success");
      }
      for (int i = 0; i < mCallbacks.size(); i++) {
        mCallbacks.get(i).onDetach();
      }
      mApiClient.disconnect();
      mApiClient = null;
      mSelectedDevice = null;
      if (isReconect) {
        launchApplication();
      }
    } else {
      if (BuildConfig.DEBUG) {
        Log.d(TAG, "stopApplication$onResult: Fail");
      }
    }
  }
});

代码示例来源:origin: kochka/WeightLogger

if (!d.isEmpty()) {
 com.google.android.gms.common.api.Status insertStatus = Fitness.HistoryApi.insertData(mClient, d).await(1, TimeUnit.MINUTES);
 Log.i(TAG, insertStatus.getStatus().toString());
 if (!insertStatus.isSuccess())
  throw new Exception("There was a problem inserting basal metabolic rate data.");

代码示例来源:origin: patloew/RxFit

@CallSuper
public void setup() throws Exception {
  PowerMockito.mockStatic(Fitness.class);
  Whitebox.setInternalState(Fitness.class, bleApi);
  Whitebox.setInternalState(Fitness.class, configApi);
  Whitebox.setInternalState(Fitness.class, goalsApi);
  Whitebox.setInternalState(Fitness.class, historyApi);
  Whitebox.setInternalState(Fitness.class, recordingApi);
  Whitebox.setInternalState(Fitness.class, sensorsApi);
  Whitebox.setInternalState(Fitness.class, sessionsApi);
  doReturn(status).when(status).getStatus();
  super.setup();
}

相关文章