Android License Verification strange behaviour - android

I have a strange behaviour and I do not have any explanation for this. Can someone help me out ?
I implemented LV into my app.
I uploaded this app as a payable app into Google Play.
I am testing the app now
I sent the app by gmail to my testing google account. I like to simulate to have a cracked version.
I installed the "cracked" version and I am happy to see, that my app denied the access.
I uninstalled the "cracked" app.
I purchased the same app from google play (I see a button with the price on it ) and let it install and I am happy to see the the app allows me to use it.
Everything good so far.
I refunded my own order with the "Wallet Merchant Center" and I see in the status, that it was cancelled.
I retry to install and run the "cracked" version.
!!! My app allows me to use the app !!!
!!! In GooglePlay I see that the install button has no price and I can still install the app, even the order was canceled !!!
I expected that in google play I see the button with the price again and that my "cracked" app denies me the access ?
This would mean, that if someone asks me to refund the order (after the official 30 minutes) and I do so, the user is still able use the app but for free !!!
Can someone explain me this ?

You probably decided for the ServerManagedPolicy. It uses a license file to avoid asking the license server too much.
Now, the bought version of your app saves a valid license file in the file system. If for some reason (e.g. you changed the path of this license file) the file is not deleted when refunding, it is still valid.
That means, if you now install your "cracked" version and it finds this license file, it allows the app to run.
Usually, the initial values in the license file avoid running it much longer than the refund period. So, you will see that after some time of usage the license locks your cracked version, which solves your problem automatically, admittedly with an unexpectedly long delay.

Related

Failed installation report for android

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 to privately publish Android apps over the net without giving away apk file?

I want to sell custom apps so I need to know how I can privately publish them over the net without giving away apk file.
Is there a way that I can give the customer a password that he/she will use to install the app only once from a website
without getting the apk file? After the installation the access to the download should be cancelled.
You cannot install apps without using an APK file, unless the target device is rooted.
Even Google Play downloads APK files for applications. They are stored in /cache/download, which can only be browsed with root access. Once downloaded, they get installed in /data/app, which also requires root access to read.
Google Play alpha/beta testing
What you could do, as a workaround, is use the Google Play alpha/beta testing feature with a private Google+ Community. This will allow you to control who is able to download your application through Google Play, but it will not prevent them from rooting their device, and retrieving the apk.
You will get all the benefits of Google Play, and your customers wont notice any difference, once they've joined the Google+ Community.
Use alpha/beta testing & stages rollouts
The only thing i can think of is have the first activity that starts up create a large random string from the device's id and then send that string to your server ( assuming you have one ). If this is the first time your server receives a code for this app, let them in and store the code, then return a response of "OK" to your app, if its not the first time, check if this is the code you stored previously, if not return "NO", if it is the right code return "OK". then have your app shut down if it doesn't receive "OK" back from your server. This of course adds extra cost and requirements to your app...
If they have to install it on their devices, they have the apk already, and there is no need to root access though, you can retrieve the apk with ES File Explorer in a second. What is your concerns, your codes? Or something else?

How do you deal with LicenseCheckerCallback.ERROR_NOT_MARKET_MANAGED error code?

Using com.android.vending.licensing you can check if your app is licensed or not. There is a callback, applicationError() that tells you if anything went wrong. Today I encountered error ERROR_NOT_MARKET_MANAGED and I can't figure out how I should deal with it!
Here's what I did:
On Google Play, I added my e-mail address as a test account.
On Google Play, I saved my app (unpublished) with versionCode="10".
On my machine, I changed to versionCode="11".
License check now fails with error code ERROR_NOT_MARKET_MANAGED.
The question is; should I handle this error or is this an unrealistic scenario?
ERROR_NOT_MARKET_MANAGED: the name really tells all about itself, application is not managed by Android Market (now called Google Play). More specifically, the version 11 of your application is not uploaded or published in Google Play.
should I handle this error or is this an unrealistic scenario?
I would consider this as an unrealistic scenario. You don't need to do anything special in code as long as you upload the new app version in Google Play. ERROR_NOT_MARKET_MANAGED is more like a LVL development warning which help developer properly implement license checking code and follow the correct procedure for testing license checking at project build time. check out the comments in LVL sample code:
private class MyLicenseCheckerCallback implements LicenseCheckerCallback {
... ...
public void applicationError(ApplicationErrorCode errorCode) {
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
// This is a polite way of saying the developer made a mistake
// while setting up or calling the license checker library.
// Please examine the error code and fix the error.
//String result = String.format(getString(R.string.application_error), errorCode);
//String result = "Error";
//handleLicensingResult(result);
}
}
The whole point of integrating LVL into your application is to use Google Play publish your application, and use Google Play client application download and install your application (see Requirements and Limitations section in dev guide). I can't see any point that can cause this applicationError at runtime on end user's device if:
Developer follow the correct procedure to upload (for testing LVL) or publish (for real release) in Google Play.
End user use Google Play client application purchase, download and install the application.
If a end user somehow get a copy of your application (with LVL integrated and uploaded/published in Google Play) from other channel (not purchase via Google Play) and trying to install it on his device (with Google Play client application installed on that device), in this case, LicenseCheckerCallback will go to dontAllow() rather than applicationError(ApplicationErrorCode errorCode).
Dont test your application immediately after you upload it to Google Play.
Wait for some time (15-20 mins or probably longer) before you start testing. Google play takes some time to recognize your app.
29 Jul, I have found that while my app is in Alpha or Beta testing all I ever get is Error 3 or Error_Not_Market_Managed. This is actually a reply from the server. SO that means that I am touching the server and the code is good. Regardless of what is set in the Developer Console as a reply, this is the only reply that I get.
I have actually waited 3 days and there is no change. SO there is no wait time which is acceptable. I even cleared and reset my entire phone. I cleared Google Play cache and all of the other magic tricks. None of them were the reason.
I updated one of my already published apps with my new Google License code and got the exact same response. After I changed the version code and then uploaded it to be published, about 4 hours later, that app functioned normally and the Google license check responded with a good valid code. Now as long as it is fully published, it responds with what ever code I tell it to.
SO the answer is, Google License will not function properly until fully published. If your app is in Alpha or Beta and you are getting Error 3 then you are likely good. Just comment out the License Check method until you are ready to publish.
As for now, 2014 May, I have to publish the testing app (no production APK uploaded) in order to test the uploaded APK and expansion OBB in beta. Otherwise, I always got ERROR_NOT_MARKET_MANAGED when testing APKExpansionPolicy. And 2 hours after publish (the notice on webpage said "up to 24 hours"), I can get expansion file information.
No one except testers can see the published app AFAIK.
It also can happen in older devices. I'm testing my app without the actual version being published and it works fine on my Galaxy S8, but I get this message on my Galaxy S4.
Which means it's also a polite way to say that this can also be a mistake from Google.

Is my Android licensing working as it should?

I have an app that uses the Android licensing. I'm using the ServerManagedPolicy which according to http://developer.android.com/guide/publishing/licensing.html should cache the server responses.
To test it I did the following:
In the developer console, set the server answer to be "LICENSED" for my account.
Connect the phone to Internet, and run the app. It shows the dialog I created to let the user know it is trying to obtain a valid license. It then shows that it found it and lets me run the app.
I exit the app (back button) and the force close it.
I disconnect from the Internet.
I run the app again. I see the dialog again, but this time it says a valid license was not found and doesn't let me run the app.
Shouldn't the ServerManagedPolicy cache the license it found the first time and let me run the app the second time?
I haven't published this app yet. Could this have something to do?
Thanks!
Don't worry, I had the same issue. When you use a test or dev account, licence is not cached bu the ServerManagedPolicy. But for your real clients, it will be cached by LVL.
Nothing in the docs says it clearly, but that works and actually, is nice feature for devs.
Regards,
stéphane
Btw, You should add a link to your app in your profile as I did... I am curious about it but can't guess what it is.

Android "Not_Market_Managed" error

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.

Categories

Resources