当前位置: 首页>>代码示例>>Java>>正文


Java GoogleApiClient.OnConnectionFailedListener方法代码示例

本文整理汇总了Java中com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener方法的典型用法代码示例。如果您正苦于以下问题:Java GoogleApiClient.OnConnectionFailedListener方法的具体用法?Java GoogleApiClient.OnConnectionFailedListener怎么用?Java GoogleApiClient.OnConnectionFailedListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.android.gms.common.api.GoogleApiClient的用法示例。


在下文中一共展示了GoogleApiClient.OnConnectionFailedListener方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createGoogleApiClient

import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
public static GoogleApiClient createGoogleApiClient(FragmentActivity fragmentActivity) {
    GoogleApiClient.OnConnectionFailedListener failedListener;

    if (fragmentActivity instanceof GoogleApiClient.OnConnectionFailedListener) {
        failedListener = (GoogleApiClient.OnConnectionFailedListener) fragmentActivity;
    } else {
        throw new IllegalArgumentException(fragmentActivity.getClass().getSimpleName() + " should implement OnConnectionFailedListener");
    }

    GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
            .requestIdToken(fragmentActivity.getResources().getString(R.string.google_web_client_id))
            .requestEmail()
            .build();

    return new GoogleApiClient.Builder(fragmentActivity)
            .enableAutoManage(fragmentActivity, failedListener)
            .addApi(Auth.GOOGLE_SIGN_IN_API, gso)
            .build();
}
 
开发者ID:rozdoum,项目名称:social-app-android,代码行数:20,代码来源:GoogleApiHelper.java

示例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())
            .addApi(LocationServices.API)
            .addConnectionCallbacks(connectionCallbacks)
            .addOnConnectionFailedListener(connectionFailedListener)
            .build();
}
 
开发者ID:MohamedNagyMostafa,项目名称:IM_Here,代码行数:9,代码来源:UserProfileFragment.java

示例3: 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();
}
 
开发者ID:MohamedNagyMostafa,项目名称:IM_Here,代码行数:9,代码来源:MapActivityFragment.java

示例4: 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();
}
 
开发者ID:Catherine22,项目名称:SecuritySample,代码行数:30,代码来源:SafetyNetUtils.java

示例5: createGoogleClient

import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
void createGoogleClient(GoogleApiClient.ConnectionCallbacks connectionCallbacks,
GoogleApiClient.OnConnectionFailedListener connectionFailedListener);
 
开发者ID:MohamedNagyMostafa,项目名称:IM_Here,代码行数:3,代码来源:UserLocationCallback.java

示例6: LoginModule

import com.google.android.gms.common.api.GoogleApiClient; //导入方法依赖的package包/类
public LoginModule(GoogleApiClient.OnConnectionFailedListener listener) {
    this.listener = listener;
}
 
开发者ID:sztomek,项目名称:cleanarchitecture-unidirectional,代码行数:4,代码来源:LoginModule.java


注:本文中的com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。