可能重複:
Cannot get Android Market Licensing (LVL) working reliably. Almost always returns RETRY的Android CheckLicense始終執行 「dontallow」 方法
我現在用的LVL系統在Android中,我的問題是,它總是被執行「不允許」方法。我正在自己的手機上測試它,它有我的谷歌帳戶關聯,所以它應該收到許可的響應(我的配置文件中配置了此響應)。我的代碼如下:
public void ComprobarLicencia()
{
// Construct the LicenseCheckerCallback. The library calls this when done.
mLicenseCheckerCallback = new ComprobadorLicencia();
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
// Construct the LicenseChecker with a Policy.
mChecker = new LicenseChecker(
this,
new ServerManagedPolicy(this, new AESObfuscator(Constantes.SALT, getPackageName(), deviceId)
),
Constantes.clave_publica_licencia
);
mChecker.checkAccess(mLicenseCheckerCallback);
}
private class ComprobadorLicencia implements LicenseCheckerCallback
{
public void allow()
{
if (isFinishing())
{
// Don't update UI if Activity is finishing.
return;
}
}
public void dontAllow()
{
if (isFinishing())
{
// Don't update UI if Activity is finishing.
return;
}
showDialog(Constantes.dialog_licencia_incorrecta);
}
@Override
public void applicationError(ApplicationErrorCode errorCode)
{
if (errorCode == ApplicationErrorCode.NOT_MARKET_MANAGED)
{
showDialog(Constantes.dialog_licencia_incorrecta);
}
}
}
我在做什麼錯?