2016-11-18 1 views
0

Google Play 서비스를 사용할 수 있는지 여부를 확인하는 공통 기능을 만들려고합니다. 내가 공통적 인 기능을 만들고 있기 때문에 을 사용하고 있지 않다. 참조 번호는 Activity이다.getErrorResolutionPendingIntent를 사용하여 Google Play 서비스를 확인하는 방법

나는 더 많은 옵션이 getErrorResolutionPendingIntent처럼 보이지만 사용 방법을 모른다.

여기이 의도와 관련된 모든 작업을 수행 할 코드

public static boolean isGooglePlayServiceAvailable(Activity activity){ 

     GoogleApiAvailability googleService = GoogleApiAvailability.getInstance(); 

     int result = googleService.isGooglePlayServicesAvailable(getContext()); 
     if(result != ConnectionResult.SUCCESS){ 
      if(googleService.isUserResolvableError(result)){ 

       PendingIntent pendingResults = googleService.getErrorResolutionPendingIntent(getContext(), new ConnectionResult(result));    


      }else{ 

       Log.e(TAG , "Device not supported"); 
      } 
      return false; 
     } 

     return true; 

    } 

답변

0

PendingIntent.send입니다. docs의 문서

hasResolution()이 true이면 getResolution()이 반환됩니다. 그렇지 않은 경우 반환 된 PendingIntent는 Google Play 서비스가 오래되었거나 누락 된 경우 Play 스토어 으로 안내하거나 기기에서 Google Play 서비스가 사용 중지 된 경우 시스템 설정으로 안내합니다.

+1

위의 코드에서 구현하려는 경우 사용 방법 – Hunt

관련 문제