How to create a license key as a downloadable, and check for it on Android
Asked Answered
L

1

5

I'm sure this is fairly basic, but I don't know quite what to search on to get a concise tutorial. I want to create an app and make it downloadable on the Android Market for free. Then, I want to create one or more apps which are just license keys which open up certain functionality on the free app. What's the best way for the free app to check if the paid apps are present on the device? Is there an easy way to check by package name or do I need to create a content provider in the paid apps which the free app can call to check validity?

Or maybe there's some global memory space (like preferences within an app) which all apps can read/write.

I know one solution that would work, and that I could implement easily - have each paid app call a web service when it first starts and register that phone's IMEI. This would work, but requires internet access, which may or may not be convenient for my app.

As with most Android problems - more than one way to skin a cat. I'm looking for what you guys think is the best (and most secure) approach.

Littman answered 10/9, 2010 at 15:17 Comment(3)
Surely the user would have to download the license key apps, meaning the web service would be ideal as it prevents other apps cropping up that unlock the services for free (as it could if you used a global memory type solution).Torbernite
Have a look at this question: #3384957Goya
Thanks for pointing me to that other question. That is my same problem. One problem with the web service idea is that the license app calls the webservice and registers the phone's IMEI, and that works great in the normal case, but what happens if the user uninstalls and refunds the license app? I have no way of knowing that and removing the registration. No, I think the free app needs to make sure those licenses are installed at the time of execution.Littman
M
1

One solution would basically to test if your "license" app is still installed on the phone. Then even if the user change phone, he'll still be able to install the license app using his google account.

You can get the list of installed applications using the following code :

List<ApplicationInfo> list = context.getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);

Then just find an ApplicationInfo where the packageName member corresponds to the one of your license app.

Manard answered 15/3, 2011 at 9:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.