2016-07-29 139 views
0

我爲應用實施了Google帳戶登錄按鈕,當我打開應用(Android 6.0.1)並輸入登錄頁面時,它會顯示一個對話框說這個應用程序將無法運行,除非你更新谷歌播放服務[Android]除非您更新Google Play服務,否則此應用無法運行

這是我的代碼:

compile 'com.google.android.gms:play-services:9.2.1' 
compile 'com.google.android.gms:play-services-auth:9.2.1' 

public void onCreate(Bundle savedInstanceState){ 
     super.onCreate(savedInstanceState); 

     GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) 
       .requestEmail() 
       .build(); 
     mGoogleApiClient = new GoogleApiClient.Builder(getActivity().getApplicationContext()) 
       .addApi(Auth.GOOGLE_SIGN_IN_API) 
       .addConnectionCallbacks(this) 
       .addOnConnectionFailedListener(this) 
       .build(); 
     mGoogleApiClient.connect(); 
    } 

我檢查了谷歌播放服務我的Android設備上86年8月1日 是那是因爲8.1 < 9.2? 如何避免已過期谷歌播放服務應用程序的用戶此消息?

回答

0

爲了檢查谷歌播放服務,您可以使用int isGooglePlayServicesAvailable (Context)方法:

GoogleApiAvailability.getInstance() 
     .isGooglePlayServicesAvailable(context); 

如果resultCode爲= SUCCESS那麼一切都很好。否則,你決定要做什麼,如果SERVICE_VERSION_UPDATE_REQUIRED你可以詢問用戶是否想要更新,或者你可能有其他登錄選項。

如果你要顯示原始對話框boolean showErrorDialogFragment (Activity activity, int errorCode, int requestCode)

相關問題