Android License Test Response - Never works - java

I've been working on an Android App that has already been published to Google Play. For the next update (versionCode = 3) my client wants to include the LVL licensing scheme.
The first thing I did was set up a static test response from the licensing server. I set the test response to LICENSED. After reading this in the documentation:
This License Test Response will be sent to devices using [my email address]
or the Test Accounts listed above for applications you have uploaded to Google Play. >Additionally, this account (but not the Test Accounts) will receive this response for >applications that have not yet been uploaded to Google Play.
I thought, not a problem, since my developer account email is the same as my Google Play account email on my testing devices. So I should receive the test response when debugging the App.
After that, I read through all the other licensing documentation and sample code and integrated it into the App. I used a ServerManagedPolicy with the correct base64 public key and 20 random generated bytes as the salt.
Once everything looked good I uploaded it to the device to test it, but instead of receiving the LICENSED response that I expected, I am always receiving a NOT_LICENSED response. I went back and made sure that:
I was connected to the internet.
I was signed in to my developer account on Google Play.
The LicenseChecker was using the correct public key.
Clearing my Google Play cache.
At first, I thought maybe it had something to do with the caching, so I tried using a StrictPolicy instead. Same response. Since I haven't purchased the App from the store, I'm under the impression that the licensing server is responding normally instead of sending the static test response. Here are some other things I have tried:
Waiting 24 hours and trying again.
Tried building the App with the android debug key, as well as the current distribution key.
Setting up and using a different test user account on Google Play. I made sure to add this email account to the 'Test accounts' section in the developer console.
Uploading the APK to Google Play, but not publishing it.
Incrementing the versionCode from 2 to 3. This is interesting, because instead of responding NOT_LICENSED it returns the 'application error code' ERROR_NOT_MARKET_MANAGED.
This leads me to believe that the license server is always responding normally, instead of sending the static test response I set up to my developer account. I have a feeling it may be because the App is already published, but I cannot risk publishing a debug build just to test wether or not it is working.
Has anyone been in this situation before? Any help is greatly appreciated.

I had the same issue but was able to resolve it. Here are the things I did to fix:
1) on my device, I removed all google accounts except the test account I had configured for. Apparently, play store was still trying to use a non testing account.
2) I had to activate test status for my developer account even though I'm the main developer and only tester.
the version increment thing did not help and honestly was a distraction.....

I've spent hours and even days with the same problem, it is documented here and elsewhere, that pre-published license test is hit and miss, and more miss than hit from what I discovered.
The only way I've found to make it work "more reliably" (but still not totally reliable) is to have a hardware device that is a reset to factory defaults, then set it's PRIMARY google user as the same one as your dev account that has the app uploaded to test with.
The special AVDs are also not very reliable.

I have the same problem when testing using LVL library. I always get the 561 (0x231 NOT_LICENSED) response no matter what I set the License Test Response to in the settings page.
My paid app users don't seem to complain so I'm assuming LVL is working for them.
At first one of my apps had this problem and it went away after 1 day (published Dec 30 2012), now I get valid test response in that app.
However, I still get the 561 (0x231 NOT_LICENSED) response for a newer app (published Jan 31 2013)
So now I just comment out (disable the alert dialog code that pops up for 561) after I publish the APK and continue my development for the next release.
I un-comment (enable the alert dialog code) before I publish again!
I contacted Google Play, they referred me to their developer forums. I posted the same question there but then I can't find my post.
Good to know that I'm not the only one facing this problem.

Not sure I am adding anything new but having similar problems and frustrations at what-should-be-happening vs what-is-happening I'll offer up this which seemed to work: 1) remove all of the users in the Play Console's license testing list of users; 2) whatever device you are testing remove all of the Google accounts; 3) on that same device create a new, unique Google account (e.g., iamalicensetester#gmail.com); 4) add that Google account to the Play Console license testing list of users.
What I think might be happening is that if you have more than one account on a device and one of them is licensed then a non-licensed account of that same device (or other devices) will inherit that characteristic. This idea of mine is just a model (all models are wrong, but some are useful) to (mostly) allow me to get back to the work of testing...and (partially) to have some way to explain this nonsense to myself.
I did try most of the things mentioned above...clearing the cache, the storage, etc. -- you'd think that Google would want a better facility with dashboarding but don't know if that is even on their radar. I mean, revenue, right?

Related

YouTube Data API v3 quota exceeded on the first upload

I am trying to develop a desktop application in Java for uploading videos. I create a new Google account, create project on developer console and create credentials (ClientID and ClientSecret). After creating all of these, i do authorization (as in java examples), the application opens browser window for me to allow the application to manage the channel, and everything works fine.
But when i try to upload a video (short video, tried it on other channels before and it uploaded every time), i immediately get quota exceeded response. And in the developer console i can see that quota is actually exceeded (9644 queries already). I must add that this is happening only for the newly registered accounts - the same video uploads without issues using the same app.
Why is this happening? Is there any way I can "register" new account and immediately do upload? If not, how can I do this properly? Thanks
I had a similar problem with the python code that i used (i modified code based on https://developers.google.com/youtube/v3/guides/uploading_a_video). I solved it using the following workflow:
create a (new) google account if you dont have one yet
go to youtube, sign up with the google account and create a channel
go to
https://console.developers.google.com/apis/credentials?pli=1
create a project, pick a name
click on OAuth consent screen, pick external, pick application name
go back to Credentials, create Credentials using OAuthClient ID, pick Web application
pick a name, put into redirect urls: http://localhost:8080/ and https://developers.google.com/oauthplayground and save
go to Dashboard, search YouTube Data API v3 and enable
then go to https://developers.google.com/oauthplayground/
click on the rack wheel on the right, click use your own credentials, copy and past clientID and secret client from https://console.developers.google.com/apis/credentials and close
search for Youtube Data API v3 on the left, and select https://www.googleapis.com/auth/youtube.upload and https://www.googleapis.com/auth/youtube
click authorize APIs, log into your account, agree to all questions asked
Click Exchange authorization code for token
the Request on the right should not give you any errors
go back to https://console.developers.google.com/apis/credentials, when you click on the edit button next to your credentials, you should be able to download your JSON files. put them into the script folder under client_secrets.json
make sure to delete the file python_upload_video.py-oauth2.json from previous trys
when running the code with for example
python upload_video.py --file="input.mp4" --privacyStatus="unlisted"
the browser should open and ask you to log into your account
what i noticed is that:
if you get three errors in three hours it seems to exceed the quota and you cannot continue
the upload works for about 5 videos a day. If you need to upload more and cannot wait the only way is to create a new account and repeat the steps above (as far as I know)
It may be worth investigating further: I guess that your issue has to do with the API issues seen since about three days now. See the answer https://stackoverflow.com/a/55220182/8327971; also Google's known and acknowledged issue: https://issuetracker.google.com/issues/128673552.

Accept End User License Agreement programmatically when launching an Image

When launching an EC2 instance from a marketplace image, you need to accept the End User License Agreement (EULA). This needs to be done only the first time the image is used to launch an instance. Any subsequent instantiations do not require this.
We have a web app which launches an instance in the customer's environment, but to be able to do this they need to accept EULA.
Regarding this I have the following questions:
Is there a programmatic way to get the agreement so that we could display it through our app and let the customer accept it. And then send the accepted agreement back to AWS? I came across this post: How to opt-in for AWS EC2 AMI from SDK but it is from 2015. I could not find if there is a way even today.
If there isn't a way to accomplish 1. we could tell the customer to go to the product page and accept it. But is there a way to confirm that they have done it? We thought of creating the instance as a dry-run to verify this. Dry run behaves as expected when the agreement has not been accepted; it shows the error message:
In order to use this AWS Marketplace product you need to accept
terms and subscribe. To do so please visit
https://aws.amazon.com/marketplace/pp?sku=9is83x7ec8xayzc533n58q6me
(Service: AmazonEC2; Status Code: 401; Error Code: OptInRequired;
Request ID: ad180465-a1c4-47c0-8115-475b759bbbe6)
But it shows the same error even when it has been accepted. I had to accept and deploy the image through the portal, and then the error went away.
Is this how it is supposed to be? Am I doing something wrong here? Is there any other way to do this?
Any advice is appreciated.

Android License Test Response always response an ERROR_NOT_MARKET_MANAGED

I create my app header on Google Play.
I create an application with google's LVL library.
I sign into an Android device with the same account that I use to sign into my Google Play Developer Console.
The LicenseChecker was using the correct public key (from Google Play app license key).
Clearing my Google Play cache and not having uploaded the application, but the license server needs a response set on the license test setting page, no?
when I'm running the app, the license server always responds: 3 (ERROR_NOT_MARKET_MANAGED).
I wait 24 hours, but nothing happens. The response is 3.
I upload the app (same version code) to the google play, but not published.
I wait 24 hours again, but nothing happens. The response is 3.
WTF :)
Okay, just back to the beginning step by step:
I create an app from the Android SDK's licensing sample.
The LVL version is 2.
I make a header on google play.
A BASE64_PUBLIC_KEY rewrite in the sample from a google play app license.
I sign in an android device with my publisher's account (after factory reset)
This sample is returned 3!
What's wrong with me????
I hope I can answer this question and I am able to help You, but if this answer does not help You, please show some code maybe it´s a simple coding Problem.
I had the similar problem for long Time, all my licensed apps had not worked (for me, but never get a negative response from users). I discovered two things: first, eclipse allways shows an error on my library project. This caused the warning on my licensed apks, that the reference to this library is not valid. In the past, I just cleared the "Problems" history and than it worked. What I have seen is, at the library manifest there was the targetSdk included:
<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="17"/>
But the library project does not support the tag targetSdkVersion, so I deletet it:
<uses-sdk android:minSdkVersion="3" />
After this, the error is gone and all licensed projects seems to be good. The seond problem is, since some time, saving apps as drafts is no longer supported like described here:
http://developer.android.com/google/play/billing/billing_testing.html#draft_apps
So, what You have to do is, upload Your apk to the alpha or beta test inside the console and publish it. This app could not be seen from other poeple, as long as You give the rights to some google groups for testing it. I set my response inside the console again to LICENSED and saved it. After waiting some time (up to 24 hours) until google play has noticed the changes, it worked.
I too have often got ERROR_NOT_MARKET_MANAGED unexpectedly.
My problem was that I was using my main developer Gmail address as my testing account and my app was a paid app.
To fix my problem:
- I had to create a 2nd Gmail account,
- add it to my list of testers (click Settings on your Google Play Developer account to get the right screen),
- add that new Gmail account to the list of accounts on the mobile device you want to test on,
- then delete whatever version of your app you do have on your device,
- then load it using download through Google Play.
When you tap Google Play to start it (touch "play games") you'll see what Gmail account you are inside Google Play in the upper left of the screen. Change that to be your new testing account.
NOW you can download your paid app (it never would let you before you did all this) and (hopefully) you will no longer get ERROR_MARKET_MANAGED.
How are you likely to encounter this error? In roughly, 3 ways.
Let's assume that in LicenseChecker in method checkAccess that after the line:
if (bindResult) {
that you have put the line:
System.println("good bind");
and that in LicenseValidator in method verify you have placed:
System.out.println("signature verified");
in the line Before the line:
} catch (NoSuchAlgorithException e) {
Make sure you've gone to a new version number, upload to alpha, wait a while, then run. If you see:
good bind
signature verified
in the trace output and the error you get is ERROR_NOT_MARKET_MANAGED then I would say you've triggered this particular problem.
If in method verify in LicenseValidator you put:
System.out.println("begin verify call:" + responseCode);
after ResponseData data = null;
and prep-then-run then you see:
begin verify call:561
then you might be having this problem.
If you set DEBUG_LICENSE_ERROR to true in LicenseChecker and in wherever it is that you have put applicationError in your LVL initiation code you put:
String result = String.format("Application error: %1$s", errorCode);
System.out.println("result:" + result); //or display it on screen using a Toast
and prep-then-run and see
result: Application error:3
then you might be having this problem.
What makes this a particularly nasty thing to encounter is that when you set the testing response for this app to anything other than "respond normally" then your app behaves like it is responding perfectly to match to presently set license response.
However..when you set the test response to "respond normally" then you're going to always get ERROR_NOT_MARKET_MANAGED (if the app is paid and you're trying to use your primary Gmail account on your test device).

Google Drive SDK - client secret - how secret is it?

According to the Google Drive SDK documentation you need to register your custom application with your Google account to obtain a client-id and client-secret information. You can then use these to build the link for your users to obtain access/refresh tokens.
According to some introductory guides on oAuth I've read, the client-secret information should be kept secretly in some cases and in some not. I'm building a Maven plugin in Java and it seems that you can hardly keep the value secret in this case.
Is it ok to release my code as open source including the client-secret information? Or does it mean a potential risk for me? And if it's not ok then how can I allow other people to use the plugin without disclosing the client-secret value?
See Google's documentation on OAuth 2.0 for Installed Applications:
The Google OAuth 2.0 endpoint supports applications that are installed on a device (e.g. Mobile, Mac, PC). These applications are distributed to individual machines, and it is assumed that these applications cannot keep secrets.
You should be fine releasing the secret. The only risk is that some rogue user "burns up" all your quota. Per-user quotas may help mitigate this issue if it arises.
It depends what you’re releasing. If you’re making a library that other people are going to use to build apps then no, they should register & use their own client secrets for their own apps.
If you have an app that you’re releasing and also want to post the source code because you're a good citizen, I’d also leave the client secret out of the posted source code; people who want their own versions of the apps should register their own clients.
Of course, anything that's compiled into a mobile app isn't really much of a secret any more, because mobile devices can't keep secrets.
Release the code without the tokens and explain how those using your code can get their own.
Otherwise people might abuse yours or copy them for other projects.
Otherwise you can burn your quotas and also if it gets copied into other apps, those will appear as yours ehen the permission dialog pops up to the user (with your app name and logo)

In app billing giving me errors

I've been playing around with both dungeons sample in app billing code with google and blundell's tutorial in app billing code. Both of these projects are basically out of the box besides changing the public key, renaming the application, and uploading it to google which I have already done. The two apps were working fine just recently (around 3 days ago). Now i'm getting this error both in the LogCat and the Device.
Device:
Error retrieving information from server. [DF-DFERH-01]
LogCat:
10-13 02:26:12.449: E/Volley(916): [90] BasicNetwork.performRequest: Unexpected response code 500 for https://android.clients.google.com/fdfe/purchaseStatus
10-13 02:26:12.457: W/Finsky(916): [1] CheckoutPurchase.onErrorResponse: DisplayErrorMessage[Error retrieving information from server. [DF-DFERH-01]]
10-13 02:26:12.457: E/Finsky(916): [1] CheckoutPurchase.setError: type=UNKNOWN, code=-1, message=Error retrieving information from server. [DF-DFERH-01]
So after contacting Android support here is the answer I got. I have yet to verify if unstatic testing works. I will let you all know.
Comment #190 on issue 35564 by theother...#gmail.com: error
(DF-DFERH-01) http://code.google.com/p/android/issues/detail?id=35564
Hi everyone. So I experienced the same problem testing the static
responses these last few days. I decided to ignore them and go ahead
and test real products (I was able to do this since my app already had
live versions published, without In-app purchases of course). Testing
real products did work however.
After reading the IAP Testing guide
(http://developer.android.com/guide/google/play/billing/billing_testing.html#billing-testing-static)
I came across a quote:
"Note: Making in-app billing requests with the reserved product IDs
overrides the usual Google Play production system. When you send an
in-app billing request for a reserved product ID, the quality of
service will not be comparable to the production environment."
So it seems something is indeed wrong with the static response
service, but this does not reflect the conditions of the actual Play
Store. I can vouch for this because my now updated and live App has
IAP working without problems. So if you're having this problem, test
real products if you can; it will probably work for you.

Categories