我在Android中使用的是LVL系统,我的问题是它总是在执行“dontallow”方法。我正在我自己的手机上对其进行测试,该手机关联了我的 google 帐户,因此它应该收到许可响应(我在我的个人资料中配置了此响应)。我的代码如下:
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);
}
}
}
我究竟做错了什么?