Android的CheckLicense总是执行" dontallow"方法 [英] Android CheckLicense is always executing the "dontallow" method

查看:1381
本文介绍了Android的CheckLicense总是执行" dontallow"方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/7033066/cannot-get-android-market-licensing-lvl-working-reliably-almost-always-return\">Cannot获得Android电子市场许可(LVL),工作可靠。几乎总是返回重试

我使用Android中的LVL系统,我的问题是,它总是执行dontallow的方法。我对我自己的电话,这我的谷歌帐户相关的测试,因此它应该得到许可的反应(我有这样的反应在我的配置文件中配置)。我的code是以下内容:

I am using the LVL system in Android, and my problem is that it is always executing the "dontallow" method. I am testing it on my own phone, which has my google account associated, so it should receive a licensed response (I have this response configured on my profile). My code is the following:

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);
            }
        }
    }

我在做什么错了?

What am I doing wrong?

推荐答案

我见过的人提出的是忘了自己的应用程序上传到Android市场(它没有要发布的最常见的错误,但至少需要要上载草案)。

The most common error I've seen people make is forgetting to upload their app to Android Market (it doesn't have to be published, but at least needs to be uploaded as a draft).

您也可以使用相同的签名密钥被用来为你的市场APK进行测试。换句话说,你需要运行你的应用程序,而不是调试版本(使用调试签名密钥)的发布版本。

You also have to be testing using the same signing key as what was used for your Market APK. In other words, you need to be running a release build of your app, not the debug build (which uses a debug signing key).

最后,如果这是一个现有的应用程序,确保你增加你的应用程序的版本code,并请com.android.vending.CHECK_LICENSE的权限,无论是在本地APK,并上传到电子市场的版本。 (如果忘记做这类原因,许可证验证服务器将不知道要为您的应用程序的请求。)

Finally, if this is an existing application, make sure you've incremented your app's version code and requested the com.android.vending.CHECK_LICENSE permission, both on your local APK and the version uploaded to Market. (If you forget to do either of those, the license verification servers won't know to respond to requests for your app.)

这篇关于Android的CheckLicense总是执行&QUOT; dontallow&QUOT;方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆