I migrated my app to Android P (Level 28) and tested it on an emulator running Android P. The license check results with an error "No connection to server". In Logcat I found the message "Clear text Traffic Not Permitted".
I added a config file network-security-config.xml with:
cleartextTrafficPermitted="true" and added android:networkSecurityConfig="#xml/network_security_config" in the manifest under the tag "application". But I got the same result.
In LogCat I found, that http://android.clients.google.com was called, but this did not appear in my app or the License Library LVL. I suppose it was called by the Google Play Store app. What can I do to get it work?
Based on what I am seeing on the emulator, the problem is not with your app, but it is actually a problem with the com.android.vending application. This application runs separately on the emulator (or real device), and it is this application that actually sends the license request to google's servers. Since, the com.android.vending application is the one that is sending the plaintext, it must be updated to either not send in plain text, or to exempt the appropriate traffic from the plain text limitation. I had been seeing the same issue. However, the good news is that it is now corrected. If you download the very latest Android Pie Emulator Image with Google Play Store support (not Google API support, that one may still have problems), then this issue should go away.
Related
I'm trying to update an app that has already been published on the PlayStore but is now being refused because GOOGLE informs that the app does not respect usage policies. I receive the following message:
- The app does not comply with the Location Permissions policy
Email with details send by google
After receiving this response from Google, I have already corrected my code, but the app continues to be refused.
Below are the actions I have already taken to try to resolve the issue:
When I received the lock for the first time, I made the requested corrections in the application code. The app currently requests the following permissions:
permissions on code
Below is the print of the permissions after uploading the .aab to the playstore:
enter image description here
Accessing the play store policy menu, I noticed that the privacy policy setting is linked to build number 29 but I'm already trying to send build 35.
This build 29 uses background localization, but I can't unlink it from the policy configuration tab or add another app version.
app settings in play store
wrong permissions in build 29
I've also reviewed the features that use localization in the code and everything is fine. Below screenshots of the code:
code snippet 1
code snippet 2
code snippet 3
I would like to know if anyone has had similar problems and can give me some guidance on how to solve it?
First thing, I noticed that you wrote "ACCCESS_COARSE_LOCATION" (with 3 C). I don't know if this is the error, but better spell it right.
Second thing, be sure that you declared that you DON'T use background location. To do that, go to your Google Play Console, select your app, then go to
App Content (it should be the last section on the left) -> API and sensitive authorizations -> Manage
then set "No" to the question regarding background location.
This is the screen you should see after these steps
tested with Honor 9A its showing error code 6(we have encoded the api key).
tested with huawei nova 7i (emui 10.1.0)its showing error code 6004--we have enabled api properly and cleaned cache
same apk working fine with Cloud debigging
same apk working fine with Honor 9X pro ,version 9.1.1
You must enable site kit service in your Huawei developer account.
Navigate to Project Setting > General information and click your app.
Navigate to Manage API and Enable Site kit.
Suggestion:
Check whether the current app has been created and has applied for related services.
Check whether the application package name is correctly configured in the Manifest file.
Clear the Huawei Core(APK) cache and try again.
If the fault persists, contact Huawei technical support.
Reference: https://developer.huawei.com/consumer/en/doc/development/HMS-2-References/hmssdk_jointOper_api_reference_errorcode
Issue is seen in only two devices.
The possible causes are as follows: checkPermission result: 6004
I can see from CPs logs has API access permission issue , it is getting ErrorCode: 6004.
Please can you clear Cache the HMS core apk and restart your phone to accept Service Agreement popup and install apk again.
The developer console for android has functionality for reporting runtime crashes if users decide to report a crash. Other frameworks has similar features that sends crash-reports without involving the user.
Does anyone know of a way to report installations or upgrades that has failed? With android 5.0 I am getting more and more user-reports of failed installs, but it is hard to obtain logs from non-technical users of my app.
You cannot detect whether or not an installation has failed yourself, because there is no way to execute code before your app is actually installed. So the logical app to do such a thing would be the market app triggering the install (i.e. Google Play). This not only knows when each installation starts, but also knows all details about the apk to report to the right developer.
Unfortunately however, Google play does not support this currently (as far as I know) and hence you cannot detect failed installs.
On older Android phones you could ask users is to install a "logcat app" and email the logs to you for analysis, but this will only work for devices older than Jelly bean. (Read this Link)
The best solution I can come up with (Mac only) is to ask users to install AndroidTool, press one button to generate a bugreport and email that to you. Not great, but for now the best you can do.
You can build an api that reports successful installation. Just call the api in onCreate of first activity. I don't think there is need to collect log on why the installation failed, is it needed ? You can do the same for upgrade, call an api one time from upgraded code.
How come I can get license verification on my physical test 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
Working on trying out the market licensing service, and I'm running into a few problems with the sample application.
When I first ran the sample, I got an error saying that the application was not licensed. I linked my account to the simulator in order to get it to get the test response, and now I get an error saying "Application error: NOT_MARKET_MANAGED"
Does this mean that I have to upload the app to the market in order to test to see if it works?
Yes your app has to be on the market and if it already is, you have to have a version code number which is greater or equal than the one already published.
There may be another way. The comments on the sample's MainActivity read:
* The first thing you need to do is get your hands on your public key.
* Update the BASE64_PUBLIC_KEY constant below with your encoded public key,
* which you can find on the
* Edit Profile
* page of the Market publisher site.
* <p>
* Log in with the same account on your Cupcake (1.5) or higher phone or
* your FroYo (2.2) emulator with the Google add-ons installed. Change the
* test response on the Edit Profile page, press Save, and see how this
* application responds when you check your license.
And when you log into http://market.android.com/publish/editProfile you will see an option for changing the License Test Response:
Textually saying:
This License Test Response will be
sent to devices using #gmail.com
or the Test Accounts listed above for
applications you have uploaded to
Market. Additionally, this account
(but not the Test Accounts) will
receive this response for applications
that have not yet been uploaded to
Market.
If you click that selection list, you will see different options:
I guess all you have to do, for that initial sample LVL tutorial program, is change the response from Respond normally to LICENSED or any other setting you want to test.
UPDATE: It turns out that the above measure is insufficient. I still get the NOT_MARKET_MANAGED error. I guess that "Market Licensing Example" must be uploaded as previous answers suggested. Note, however, that it cannot be the debug version:
Oh, and you can't really upload that "Market Licensing Example" as is. You must at least change the name of the package:
I can see how Google's sample/example system could be improved to become more developer-friendly...
Weird. After uploading the application (just uploading and saving draft, not filling any other required fields), the "Market Licensing Example" stops issuing the NOT_MARKET_MANAGED error, despite the fact that clearly selected NOT_LICENSED. Instead it responds with the message Allow the user access. I also tried setting (for test & learning purposes) it to ERROR_SERVER_FAILURE but I get the same Allow the user access message.
Why?
You'd have thought "Saved Draft" would be just what this is for. Otherwise, you're selling an app which by definition cannot have been fully tested live.
Upload your app (.apk) to the market. The default state will be "Saved Draft", so it will not be be visible to the public, but you can still test the Licensing.
One other potential problem:
Make sure that the version you are testing/running has the same android:versionCode in the AndroidManifest.xml as the draft version in the market. If the versions differ, you will receive a NOT_MARKET_MANAGED error. (Apparently the RSA keypair used for license
checks is on a per-app/per-version basis.)
After a bit of a struggle I got this working. You can't use the LVL sample as is.
Here's what I did:
modify the project's package to something else (I used: lvl.test)
set MainActivity's BASE64_PUBLIC_KEY to the one in your Developer Console profile.
export the signed app
go to Developer Console and upload the app (create dummy images and give it a dummy name and description etc. just so that it saves and is listed as 'Unpublished')
install the exported app (from your filesystem) to your test device (i.e. adb install bin/path/to/your.apk)
on your device, open Android Market go to: Settings>Accounts> and select the one that corresponds to your Developer Console account
you can now select a static License Test Response in your Developer Console Profile and save it. When you run the LVL sample on your device the response will correspond to the one you picked!
From my experience, the app has to be published before LVL starts working, incl. static response testing. For me ERROR_NOT_MARKET_MANAGED went away only after publishing although the docs say you can Debug and test an application's licensing implementation, prior to
publishing the application.
Cool part is you can publish while only having alpha/beta builds -- the app won't really go live, only testing accounts will be able to use it.
When you're preparing for initial release, it may seem unnatural to hit Publish before you're completely sure everything is in working order (and the fact that you have to put in the description and screenshots before you can do that is even more alarming -- you'd think those are final touches) -- but you should, just make sure you've made a sane choice about the package name and whether the app is paid or free -- those things can't be changed after publishing. Publishing alone does not make the app public; unless you have a Production build don't worry about accidentally making an untested version go live.
This is related so it might help somebody:
I was testing on an Asus transformer and had to delete all non-developer accounts to get license testing to work (including my yahoo account). Once the other accounts were deleted all of the steps worked without a problem.
In my case I was getting because of Version code difference as..
Already published apk's version code = 2
and after some testing release new apk's I had set version code to 5
which was causing this error as version difference should be exact 1 with currently published apk..
same was applied with version name too..
If you already tried all the suggestions above try this:
I had the same response for a while and I could not figure out why this was the case. I read the entire documentation on App Licensing and still receiving the same annoying NOT_MARKET_MANAGED response code.
I was finally abe to resolve the problem by changing my applicationId in the AndroidManifest.xml file. I rewrote an app from scratch starting with a blank new project. The problem was that I did not use the exact correct applicationId. The problem was that the original application on the Google Play Store used a letter in upper case while I wrote all letters in lower case in the newly created project.
Since I corrected the applicationId to match 100% (including casing) I get the expected behavior of the licensing service.