开发者

Android LVL not accepting license on emulator only

开发者 https://www.devze.com 2023-03-24 01:17 出处:网络
How come I can get license verification on my physical 开发者_StackOverflowtest device, but not on the emulator running on my pc?

How come I can get license verification on my physical 开发者_StackOverflowtest device, but not on the emulator running on my pc?

When testing from an emulator, no matter what I do, I get NOT_MARKET_MANAGED error. From an actual phone, it passes through with no issues.

Is it because my emulator doesn't have the market app installed and my test device does?


Well, turns out that my emulator did not have a google account setup before trying to run the LVL code. Obviously, if there isn't a google account already setup on the emulator, the LVL has no account to check against for validation.

LVL will still run on an emulator without the Android market installed.

Edit

*Only tested on emulators running Android 2.2*

*LVL will NOT work on emulators running 2.3 or greater, evidently it's a known bug*


Well, you got a real problem: it's a known bug. There's a way out, although. You must separate the MVC code from the license check routines(there's an pretty good example here). Once you have finished to test your code in multiple emulated API versions, you can add the licence check activity to you project and mark it as MAIN and LAUNCHER in the manifest, upload the app to your phone and test the authentication. Follow the instructions in the comments and don't forget to make the necessary adjustments (e.g. i had to change the libraries from com.android to com.google.android in the java file, but keep the com.android.vending.LICENSE_CHECK in the manifest uses-permission tags.)


I know this is an old question, but I just had this problem and thought I would update the answer.

I repeatedly got Error Code 291 (error contacting server) for the license check running an emulator on API 15. According to the "accepted" answer at the time I write this, it says "LVL will not work on emulators over API 8 / 2.2 - it is a known bug".

For API 15 I used the Google API's emulator (to include the LVL libraries) and had to go into the Settings and add a test user account and it worked. I now get the appropriate error responses from the Google Play license server according to my account settings in my Google Play account.

The Google Play / Market app is not required if you do both (use a Google API emulator and set up a test account in the emulator). Here is the reference:

http://developer.android.com/google/play/licensing/setting-up.html#acct-signin

During testing, to ensure that your application can successfully query the licensing server, you must make sure that you sign in to an account on the device or emulator using:

The credentials of a publisher account, or
The credentials of a test account that is registered with a publisher account
0

精彩评论

暂无评论...
验证码 换一张
取 消