2013-04-05 2 views
3

Google Play 라이센스 API로 앱을 테스트하고 있습니다. 앱이 라이선스 서비스에 성공적으로 바인딩되지만 콜백에 오류 6이 발생합니다. LicenseValidator에서 오류 코드를 확인했지만 여기에 나열된 오류 코드 중 하나가 아닙니다.Google Play 라이센스 - 오류 6은 무엇인가요?

오류 6의 의미를 아는 사람이 있습니까?

public class MyActivity extends FragmentActivity 
{ 

    private static final String BASE64_PUBLIC_KEY = "ZZZZ"; 

    private static final byte[] SALT = new byte[] { 
     XXXX 
    }; 

    private LicenseCheckerCallback mLicenseCheckerCallback; 
    private LicenseChecker mChecker; 

    @Override 
    protected void onCreate(Bundle savedInstanceState) 
    { 
    super.onCreate(savedInstanceState); 

     String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID); 

     // Library calls this when it's done. 
     mLicenseCheckerCallback = new YAHLicenseCheckerCallback(); 

     // Construct the LicenseChecker with a policy, obfuscator and public key 
     mChecker = new LicenseChecker(this, 
       new ServerManagedPolicy(this, 
       new AESObfuscator(SALT, getPackageName(), deviceId)), 
       BASE64_PUBLIC_KEY); 
     mChecker.checkAccess(mLicenseCheckerCallback); 
    } 

    private class YAHLicenseCheckerCallback implements LicenseCheckerCallback { 
     public void allow(int policyReason) { 
      Log.d(tag,"License - allowed"); 

      if (isFinishing()) { 
       // Don't do anything if Activity is finishing. 
       return; 
      } 
      // Should allow user access. 

     } 

     public void dontAllow(int policyReason) { 
      Log.d(tag,"License - not allowed"); 

      if (isFinishing()) { 
       // Don't do anything UI if Activity is finishing. 
       return; 
      } 

      // Should not allow access. In most cases, the app should assume 
      // the user has access unless it encounters this. If it does, 
      // the app should inform the user of their unlicensed ways 
      // and then either shut down the app or limit the user to a 
      // restricted set of features. 

     } 

     public void applicationError(int errorCode) { 

      Log.d(tag,"License - application error code "+errorCode); 

      if (isFinishing()) { 
       // Don't update UI if Activity is finishing. 
       return; 
      } 
      // This is a polite way of saying the developer made a mistake 
      // while setting up or calling the license checker library. 
      // Please examine the error code and fix the error. 

     } 
    } 

    @Override 
    protected void onDestroy() 
    { 
    mChecker.onDestroy(); 
    super.onDestroy(); 
    } 
} 
+0

오류 6은 정확히 무엇을 말합니까? –

+0

6이 문서화 된 반환 코드 중 하나가 아닌 것이 맞습니다. 작은 실수가있을 경우에 대비하여이 값을 받고 표시하는 코드를 표시 할 수 있습니까? –

+0

@PareshMayani : 나는 logcat에서 다음 줄을 말하는 같은 문제에 직면하고있다.
'사용 권한 거부 : 서비스에 액세스 ComponentInfo {com.android.vending/com.google.android.finsky.services.LicensingService}에서 pid = 7605, uid = 10003은 com.android.vending.CHECK_LICENSE가 필요합니다. ' – MobiDev

답변

5

그래, 해결했습니다. 오류 6은 LicenceValidator에서 오지 않습니다. LicenseChecker에서오고 있으며 권한이 없음을 나타냅니다. com.android.vending.CHECK_LICENSE 권한을 부여하지 않았습니다. 내가 그랬을 때 작동하기 시작했습니다.

관심을 가져 주셔서 감사 드리며 같은 실수를하는 사람에게 도움이되기를 바랍니다.

+0

응답이없는 대기열에서 제거하라. 솔루션을 공유해 주셔서 감사합니다. –

관련 문제