本文整理汇总了Java中com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleApiClient.ConnectionCallbacks方法的具体用法?Java GoogleApiClient.ConnectionCallbacks怎么用?Java GoogleApiClient.ConnectionCallbacks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.common.api.GoogleApiClient
的用法示例。
在下文中一共展示了GoogleApiClient.ConnectionCallbacks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGoogleClient
import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
@Override
public void createGoogleClient(GoogleApiClient.ConnectionCallbacks connectionCallbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
googleApiClient = new GoogleApiClient.Builder(getContext())
.addApi(LocationServices.API)
.addConnectionCallbacks(connectionCallbacks)
.addOnConnectionFailedListener(connectionFailedListener)
.build();
}
示例2: createGoogleClient
import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
@Override
public void createGoogleClient(GoogleApiClient.ConnectionCallbacks connectionCallbacks, GoogleApiClient.OnConnectionFailedListener connectionFailedListener) {
googleApiClient = new GoogleApiClient.Builder(getContext())
.addOnConnectionFailedListener(connectionFailedListener)
.addConnectionCallbacks(connectionCallbacks)
.addApi(LocationServices.API)
.build();
}
示例3: SafetyNetUtils
import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
public SafetyNetUtils(Context ctx, Callback callback) {
this.ctx = ctx;
this.callback = callback;
GoogleApiClient.OnConnectionFailedListener googleApiConnectionFailedListener = connectionResult -> Log.e(TAG, "onConnectionFailed:" + connectionResult.toString());
GoogleApiClient.ConnectionCallbacks googleApiConnectionCallbacks = new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(@Nullable Bundle bundle) {
String logs = bundle == null ? "" : bundle.toString();
callback.onResponse("GoogleApiClient onConnected " + logs);
}
@Override
public void onConnectionSuspended(int i) {
Log.d(TAG, "onConnectionSuspended" + i);
}
};
Handler handler = new Handler(MyApplication.INSTANCE.safetyNetLooper.getLooper());
googleApiClient = new GoogleApiClient.Builder(ctx)
.addApi(SafetyNet.API)
.addConnectionCallbacks(googleApiConnectionCallbacks)
.addOnConnectionFailedListener(googleApiConnectionFailedListener)
.setHandler(handler) //Run on a new thread
.build();
googleApiClient.connect();
secureRandom = new SecureRandom();
}
示例4: from
import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
/**
* Initializes the synchronizer.
* @param context the activity context
* @param listener the connection callbacks listener
*/
public static UARTConfigurationSynchronizer from(final Context context, final GoogleApiClient.ConnectionCallbacks listener) {
if (mInstance == null)
mInstance = new UARTConfigurationSynchronizer();
mInstance.init(context, listener);
return mInstance;
}
示例5: init
import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
private void init(final Context context, final GoogleApiClient.ConnectionCallbacks listener) {
if (mGoogleApiClient != null)
return;
mGoogleApiClient = new GoogleApiClient.Builder(context)
.addApi(Wearable.API)
.addConnectionCallbacks(listener)
.build();
mGoogleApiClient.connect();
}
示例6: createGoogleClient
import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
void createGoogleClient(GoogleApiClient.ConnectionCallbacks connectionCallbacks,
GoogleApiClient.OnConnectionFailedListener connectionFailedListener);