How do you prompt the user to update google play services?

前端 未结 5 1676
谎友^
谎友^ 2020-12-19 02:20

I can easily detect that my device\'s google play services app needs to be updated, and present the getErrorDialogFragment() to prompt the user to update it with:

         


        
5条回答
  •  遥遥无期
    2020-12-19 02:38

    This is working for me

    GoogleApiAvailability googleAPI = GoogleApiAvailability.getInstance();
    int result = googleAPI.isGooglePlayServicesAvailable(this);
    
    if(result != ConnectionResult.SUCCESS) {
        if(googleAPI.isUserResolvableError(result)) {
           //prompt the dialog to update google play
      googleAPI.getErrorDialog(this,result,PLAY_SERVICES_RESOLUTION_REQUEST).show();
    
        }
    }
    else{
      //google play up to date
    }
    

提交回复
热议问题