I need to implement Android application which will be expired after few days or number of uses.
The application will be on the google market.
I can implement the check using shared preferences.
But what should I do in the application if user decides to buy the license?
Is it possible for user to pay via the market?
You can have two different applications. One will be the full version and the other will be the licensed version. The first version will store the first date when the application is run as a SharedPreference. It could also be stored on a server somewhere else. It will then work for only so many days after that. The second version(licensed version) will not work until the user types in the correct product key. This could be validated over the internet.
I'm not sure why you would want to do this though. Most apps on the Android market will have a free version of their application with limited functionality. Then the full version of the application can be purchased separately. This model seems to work well for many applications.
Related
I decided to build a paid version of my free Android application.
The paid version has some extra features. How do I manage both versions?
Is it possible to keep them based on the same source code?
If an application requires unique package name, how do I force paid application to replace free version?
What about db, preferences and other privately stored stuff, how to share them without exposing all data to the rest of the world?
Any advice that will help to manage both projects,
but not answers the above questions directly, is appreciated as well.
There are several approaches:
Put the core of your app in a library project, and create two other projects one for the paid, and one for the free version of the app. An upgrade to the paid version means the user has to uninstall the free version, and looses all the data.
This is the "classical" approach.
Let the user make an in-app payment. The user keeps all database and settings, and you have to maintain only one app.
This option requires extra modules to be included in your app, and extra logic.
Make another dummy/empty app, this is a paid app. The existance of this app means the user has a paid version. The user keeps on using the orginal/free app.
You can simply check by using the PackageManager to see if the paid app is downloaded.
The user keeps all database and settings, and you have to maintain only one app. Ok, there are two apps, but the second can be really small and simple.
You don't have to include additional libraries/code to make an in-app payment. You can also have all your apps upgraded to the 'pro' version with one purchase.
I don't know if all users understand this pattern. For the developper, this can be achieved with minimal work, and the users keep all their settings while upgrading.
I think it's possible and recommended to keep them in same source
code. Otherwise you have to support two versions of app instead of
only one.
If you have only one app therefore you have only one package name.
Create a class responsible for app features availability in current license state (free or paid). This class should store information about license state (free, paid, maybe you will deside to add subscription mode in future in which paid version can expire after some period). Features of your app available only in paid verion shoud check current license state. You can also change app GUI depending of license state. For example hide GUI of paid features, show "Buy" button or ads, etc.
And also if you have only one app that can be free or paid you don't have to share any internal app data between paid and free versions.
I sell a game on Google Play called Quantum-X. Not many people have bought it so I want to move to an ad-supported model and make it a free download.
But I want to reward the people who did buy the game by disabling advertising. So existing users see no ads, new users see ads. I can store a flag in some obfuscated, device specific way which makes this determination.
But in order to this I need to tell the difference between paying and non paying users.
So how do I do this? I have a few ideas but I don't know if any of them are viable:
The old app wrote some preferences out. I could look for an old preference and set the flag. But this will not work if someone installs the app on a clean device since they won't have that preference. It is also an exploit since anybody could put the old key in to fool my app into disabling advertising.
My pay app currently uses LVL to validate a person's licence. If I make my app free, what happens when I call LVL? Does it respond LICENCED even if a user downloaded it for nothing? If I could tell paid from non-paying users from the response then I know how to set the flag. But LVL is a pain to test since I would have to upload the app, set it to free and then see what difference there is in the result and there may be none.
I could produce one final update of my pay app which sets the flag and asks users to upgrade. Then I could roll out the app free in a month from now. The same problem exists as with 1. that some users may not update or may install onto clean devices.
I could produce two apps on the store. The pay app could be renamed to "Quantum-X legacy" and a new Quantum-X goes in its place which is free. I would update the legacy version to install the flag, but people would have to switch to the new version for continued support. This would work but it's a lot more effort.
None of these are pretty although 2. would be the least amount of work. Has anyone experience of a working solution, or know a some better way of doing this?
EDIT: My intention is now a hybrid and I've begun to do this:
Rename the old app as Quantum-X Legacy and update the description.
The new free version is called Quantum-X. The only fly in the ointment here is that I must update the app package in the manifest to make the two apps distinct.
I intend to put a test into the free version that calls LVL using the old app's key. If this works the way I think it will, it will tell me when a user has bought the old app (since the licence server is being asked about the old app), and I can write out an obfuscated flag somewhere so I don't have to call LVL any more.
Free users carry on but with ads.
I'm up to 3. and this is my intention. If LVL doesn't work, then I might have to put out an update to the legacy version which writes the flag or puts a code out on screen that someone must use to enable adfree when they install the other version.
I have just created a developer account at Google Play. Now I got to upload the application but I have a few doubts:
Can I add more then one android APKs for different applications?
Is it possible to upload an application for a testing and after that set the price of the app?
Is it possible to set such criteria where first 500 users get a free download and then the app will be paid?
Is it possible to delete an app and re-upload it if something gets wrong while uploading?
Multiple APKs for one application:
Multiple APK support is a feature on Google Play that allows you to
publish different APKs for your application that are each targeted to
different device configurations. Each APK is a complete and
independent version of your application, but they share the same
application listing on Google Play and must share the same package
name and be signed with the same release key.
Besides that, with your developer account you can create multiple application projects and provide your APKs for them of course.
No. After you have released an application for free you can not introduce a price for it. You'd have to create a new app project with a different package name.
This is not naturally supported by the Google Play Store. But you could implement this by writing a counter function that synchronizes over the web. You could also crawl/scrape your app page in the Google Play Store to get the install number. There are various ways.
After you upload your APK, there is some kind of sanity check integrated in the Play Store routine. This should prevent that anything goes wrong during the upload. Anyway, you can also upload a new APK, replacing the previous. That's how app updates work.
Your case overall sounds like you could use In-App-Billing to let your users access most functionality in your app for free, and after a certain time period has passed, offer them the full functionality after a payment.
Keep in mind that it is not a good practice to promote your app for free in the Play Store but then hide everything behind a payment wall inside the app.
Updated answer:
You need to have different package names (i.e. different app projects in your developer account) if you want to offer a free and a paid APK. It's actually a common practice and you'll find many apps in the Play Store that have a "free" and a paid "premium" version.
Very often, it would be easier for you to maintain and to update your app if the premium version only functions as a key (i.e. without actual functionality) that unlocks certain features of the free version. Therefore, you can check in your code if the user has installed the premium version.
Still, it would be more elegant to not "pollute" the Play Store with a dummy premium app and by implementing this with an In-App-Purchase of your premium functionality. Here is a good tutorial (besides the Android guide that I have linked above).
1)Yes, your account can have multiple applications. Or did you mean for the same app multiple apks?
2)No, once an app is free it can't have a price added to it later. If it has a price you can change what it cost though
3)No
4)You can always upload a new version, which seems to be what you want here.
I have seen so many threads on creating a time bound trial versions for an android apps but none of them seems to fulfill my purpose.
Few days back i Launched the paid version of my app and now I want to come up with trial version which i dont want to be crippled from any side. So i want to have a time bound limitation on the trial version. I have created a different Package name for the same. Earlier I was using LVL and now also I am using the same except that i created new license library and changed the
setValidityTimestamp(extras.get("VT"));
to
setValidityTimestamp(String.valueOf(System.currentTimeMillis() + (5* MILLIS_PER_MINUTE))); in ServerManagedPolicy.
so that i can test if trial version works for 5 mins and then give me the license error. I published it on the app store , downloaded it and then found that it was still working beyond 5 mins. Now i have unpublished it. Can someone help me in creating the better time bound application which a user can run for a week (say). Besides he should not be able to uninstall and re-install it and then again use it permanently. I know if i can write the info to some external file but again the file can be deleted from sd card and application can be made accesible to the user free for lifetime.
Regards
Pankaj
Within the current capabilities of LVL, and the degree of user control over your average handset, there is currently NO way to do this without a server-side component. Once your app is uninstalled all traces (except, as you pointed out, files you may write to the SD card, which are user-visible) are removed, so the only way to check for an uninstall/re-install is to generate a consistent, device-specific identifier and check with a server component that will either reject this as a re-install or accept it as a new time trial. Even this can possibly be spoofed by a dedicated customer (depending on the server-side component behavior), so you would need to engineer your software so that your server-side component is a necessary part of the process (i.e. it isn't just a license check, it is actually part of the application's functionality).
If you come up with something that works I'd love to hear about it, but I'd say you're out of luck.
#Femi is right, you need a server side component to make always work. What I tend to do is publish only a free version, and teh user buys the full version as in-app-purchase. The IAP server is your server side check if the use purchased the upgrade or not. You can store a pref on first use to know when the user started using the app. If users uninstall and install again your app, they get a new trail period, but this is annoying, and few will do it to save a few bucks. If you add a message in the app where you ask user nicely to upgrade, or have ads that are removed once you upgrade, it is a good enough solution.
i have created an application and would like to provide a 30 days trial period for the same using licensing dll provided by android (http://developer.android.com/guide/publishing/licensing.html#support),but i cannot find how to restrict this licensing to 30 days from date of installation.
Thanks in advance.
I haven't used the licensing library yet, but my understanding is this is one of the major gripes/flaws about the setup in general. Since only paid applications can use the service, you really can't implement a trial period for a paid app.
The licensing portion, does just that, licenses the application. If the application is able to obtain a license from the server, then it's free to run indefinetly...or until the application code is triggered to do the check again. There is no check at the server that has anything to do with timing. Since John Q app user paid for the app, he expects he will always be able to obtain a license.
You could build your own custom methods to do time checks via shared prefs using the install or first time the application was run, but all someone has to do is delete the app and re-install it.
Essentially, I believe this is a big portion of why there are so many sets of the same application in the market place. "Sets," referring to a lite/trial/full/beta/eval version of the same app.