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

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

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

Status.<init>介绍

[英]Creates a representation of the status resulting from a GoogleApiClient operation.
[中]创建GoogleAppClient操作产生的状态的表示形式。

代码示例

代码示例来源:origin: yayaa/LocationManager

private LocationSettingsResult getSettingsResultWith(int statusCode) {
    return new LocationSettingsResult(new Status(statusCode, null, null));
  }
}

代码示例来源:origin: yayaa/LocationManager

@Test
public void resolveSettingsApiShouldCallSettingsApiFailWhenThereIsNoActivity() {
  when(contextProcessor.getActivity()).thenReturn(null);
  googlePlayServicesLocationProvider.resolveSettingsApi(new Status(1));
  verify(googlePlayServicesLocationProvider).settingsApiFail(FailType.VIEW_NOT_REQUIRED_TYPE);
}

代码示例来源:origin: yayaa/LocationManager

@Test
public void resolveSettingsApiShouldStartSettingsApiResolutionForResult() throws Exception {
  Status status = new Status(1);
  googlePlayServicesLocationProvider.resolveSettingsApi(status);
  verify(mockedSource).startSettingsApiResolutionForResult(status, activity);
}

代码示例来源:origin: yayaa/LocationManager

@Test
public void resolveSettingsApiShouldCallSettingsApiFailWhenExceptionThrown() throws Exception {
  Status status = new Status(1);
  doThrow(new SendIntentException()).when(mockedSource).startSettingsApiResolutionForResult(status, activity);
  googlePlayServicesLocationProvider.resolveSettingsApi(status);
  verify(googlePlayServicesLocationProvider).settingsApiFail(FailType.GOOGLE_PLAY_SERVICES_SETTINGS_DIALOG);
}

代码示例来源:origin: braintree/braintree_android

@Test
  public void testGooglePaymentException_isSerializable() {
    Status status = new Status(1, "Some status message");
    GooglePaymentException exception = new GooglePaymentException("Some message", status);

    Parcel parcel = Parcel.obtain();
    exception.writeToParcel(parcel, 0);
    parcel.setDataPosition(0);

    GooglePaymentException actual = GooglePaymentException.CREATOR.createFromParcel(parcel);

    assertEquals("Some message", actual.getMessage());
    assertEquals("Some status message", actual.getStatus().getStatusMessage());
    assertEquals(1, actual.getStatus().getStatusCode());
  }
}

相关文章