本文整理汇总了Java中com.google.android.gms.common.api.ResultCallbacks类的典型用法代码示例。如果您正苦于以下问题:Java ResultCallbacks类的具体用法?Java ResultCallbacks怎么用?Java ResultCallbacks使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ResultCallbacks类属于com.google.android.gms.common.api包,在下文中一共展示了ResultCallbacks类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: connectToRemoteDisplayApi
import com.google.android.gms.common.api.ResultCallbacks; //导入依赖的package包/类
/**
* connect to the remote display, and show the {@link CastScreenPresentation} if successful
*/
private void connectToRemoteDisplayApi() {
PendingResult<CastRemoteDisplay.CastRemoteDisplaySessionResult> result =
CastRemoteDisplay.CastRemoteDisplayApi.startRemoteDisplay(mApiClient, mAppId);
result.setResultCallback(new ResultCallbacks<CastRemoteDisplay.CastRemoteDisplaySessionResult>() {
@Override
public void onSuccess(@NonNull CastRemoteDisplay.CastRemoteDisplaySessionResult castRemoteDisplaySessionResult) {
Display remoteDisplay = castRemoteDisplaySessionResult.getPresentationDisplay();
mPresentation = new CastScreenPresentation(mService, remoteDisplay, mProjectionManager);
mPresentation.show();
mPresentationShowing = true;
Log.d(TAG, "Created presentation");
}
@Override
public void onFailure(@NonNull Status status) {
Log.i(TAG, "Stop Casting because startRemoteDisplay failed");
deselectRoute();
}
});
}
开发者ID:ankyl,项目名称:castscreen,代码行数:24,代码来源:ConnectionManager.java
示例2: disconnect
import com.google.android.gms.common.api.ResultCallbacks; //导入依赖的package包/类
/**
* disconnect and cleanup all resources
*/
public void disconnect() {
if (apiClientConnected()) {
// Disconnect from remote display
PendingResult<CastRemoteDisplay.CastRemoteDisplaySessionResult> result =
CastRemoteDisplay.CastRemoteDisplayApi.stopRemoteDisplay(mApiClient);
result.setResultCallback(new ResultCallbacks<CastRemoteDisplay.CastRemoteDisplaySessionResult>() {
@Override
public void onSuccess(@NonNull CastRemoteDisplay.CastRemoteDisplaySessionResult castRemoteDisplaySessionResult) {
Log.i(TAG, "Success disconnecting from CastRemoteDisplayApi");
}
@Override
public void onFailure(@NonNull Status status) {
Log.w(TAG, "Failed disconnecting from CastRemoteDisplayApi");
}
});
// Disconnect from Google API
mApiClient.disconnect();
}
// Stop listening for routes
mRouter.removeCallback(mStopCallback);
// Clean up MediaProjection resources
if (mPresentation != null) mPresentation.dismiss();
if (mProjectionManager != null) mProjectionManager.release();
}
开发者ID:ankyl,项目名称:castscreen,代码行数:32,代码来源:ConnectionManager.java
示例3: runSaftyNetTest
import com.google.android.gms.common.api.ResultCallbacks; //导入依赖的package包/类
private void runSaftyNetTest() {
final byte[] nonce = generateNonce();
SafetyNet.SafetyNetApi.attest(mGoogleApiClient, nonce)
.setResultCallback(new ResultCallbacks<AttestationResult>() {
@Override
public void onSuccess(@NonNull AttestationResult attestationResult) {
if (isDetached()) {
return;
}
final String jws = attestationResult.getJwsResult();
try {
final JSONObject jsonObject = retrievePayloadFromJws(jws);
final String jsonString = jsonObject.toString(4);
final String verifyOnServerString
= getString(R.string.safetynet_verify_on_server);
updateMessageView(verifyOnServerString + "\n" + jsonString, false);
} catch (JSONException ex) {
updateMessageView(R.string.safetynet_fail_reason_invalid_jws, true);
}
}
@Override
public void onFailure(@NonNull Status status) {
if (isDetached()) {
return;
}
updateMessageView(R.string.safetynet_fail_to_run_api, true);
}
});
}
开发者ID:googlesamples,项目名称:android-testdpc,代码行数:31,代码来源:SafetyNetFragment.java
示例4: addGeofences
import com.google.android.gms.common.api.ResultCallbacks; //导入依赖的package包/类
public void addGeofences(@NonNull List<Geofence> geofences, @NonNull ResultCallbacks<Status> callback) throws InterruptedException
{
countDownLatch.await();
GeofencingRequest request = new GeofencingRequest.Builder().addGeofences(geofences).setInitialTrigger(Geofence.GEOFENCE_TRANSITION_ENTER).build();
LocationServices.GeofencingApi.addGeofences(googleApiClient, request, geofencePendingIntent).setResultCallback(callback);
}
开发者ID:martijndeh,项目名称:react-native-region-monitor,代码行数:7,代码来源:GeofenceManager.java
示例5: clearGeofences
import com.google.android.gms.common.api.ResultCallbacks; //导入依赖的package包/类
public void clearGeofences(@NonNull ResultCallbacks<Status> callback) throws InterruptedException
{
countDownLatch.await();
LocationServices.GeofencingApi.removeGeofences(googleApiClient, geofencePendingIntent).setResultCallback(callback);
}
开发者ID:martijndeh,项目名称:react-native-region-monitor,代码行数:6,代码来源:GeofenceManager.java
示例6: removeGeofence
import com.google.android.gms.common.api.ResultCallbacks; //导入依赖的package包/类
public void removeGeofence(@NonNull String id, @NonNull ResultCallbacks<Status> callback) throws InterruptedException
{
countDownLatch.await();
LocationServices.GeofencingApi.removeGeofences(googleApiClient, Collections.singletonList(id)).setResultCallback(callback);
}
开发者ID:martijndeh,项目名称:react-native-region-monitor,代码行数:6,代码来源:GeofenceManager.java
注:本文中的com.google.android.gms.common.api.ResultCallbacks类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论