Google Inapp purchasing and trial period - android

I am building an application which I wish to upload to the app store as a paid app. But i would like to post it as a trial app for a set amount of time. I looked at all the options in the app billing version 3. I have found a few problems.
If I create my app with a non-consumable inapp item then i will not be able to keep it for a set duration as a trial app(Please let me know if my assumption is correct).
I f I create it via a subscription based model then is there a way I can make the subscriptions last forever and not yearly?

I think I know what you're asking, but if I'm wrong let me know.
What you want to do is let the user download the app for free, let them use it for say 7 days, then require them to pay for the upgrade IAP (in app purchase) or prevent them using it?
If the above is correct there is one main problem that you're going to encounter. To track the date the user started using the app you will have to use something like a shared preference, an entry in a sql db or some local file etc... The only problem with all of these options is the user can erase the data and install the app again to use it free for another 7 days. The only way around this is to implement your own web registration service which I imagine would be a little too difficult.
The best way, assuming you're not too bothered about the people who will bypass it, is to capture the date/time when the app first starts and save it. Each time the app starts check if they have purchased the upgrade, if not check the current date/time against the stored value and if your trial period has elapsed, prompt them to buy the upgrade or close the app.

The main problem here is the user uninstalling / reinstalling the app and losing the shared preferences.
The easy way around this is to use Google's SharedPreferencesBackupHelper
Android SharedPreferences Backup Not Working
You simply save the install date as a preference. Even if the app is un-installed, if they install it again, the orig install date will still be available for you to query.

Related

Best way to start an app in Free or Pro mode

I have an Android app and I also offer 1 inapp purchase to unlock such app to the Pro version.
I know how to do use the inapp purchase API and such but I found discordant ways on how to check if the app should start as Free or Pro.
Many people suggest that after a successful purchase the app should store the Google Play receipt or other information in a local database and let the app check the presence of that information at startup (in order to start properly as Free or Pro)
My question is, instead of bothering saving the purchase information and retrieving it from a local database why not calling the restore purchase API RestorePurchases(), have a look at the returned object if the InApp item is present and unlock the app accordingly?
As far as I know the call doesn't require internet connection, it's just a local call to the local Google Play authority... am I missing something?
Let me explain how we manage it at QuitNow!, an app with the same behavior than yours.
We only have one SKU called unlock_all_pro_features. If the user has it, it means that the user bought the PRO features before.
So, in the Android side, everytime the app is started we try connecting to IInAppBillingService. When onServiceConnected() is called, we ask it for all the user owned SKU's. If it has our lovely SKU, we store in a SharedPreference that the user was a PRO one. And then, if it wasn't PRO before doing all this magic, we update the screen to show the brand new features.
Bad things there: the user can return the SKU!
To face that, when we consider that a user was a PRO one, we also ask if the user has the needed SKU. If that check fails 20 times, we reset the features to the FREE version.
Why checking it 20 times instead of just one time? Sometimes, we found that the service said that the user had any SKU, while he actually had the PRO one. Why? Don't know. So, checking it 20 times is a simple way to assure that we don't kick PRO users when unneded.

Offer free features to earlier buyers

I have a paid app in the Google Play Store. I'm considering reducing the price of that app (somewhat; not all the way to free) and offering one of the features as a separate in-app purchase.
If I did that, I wouldn't want to yank the feature away from anybody who's already bought it.
Is there any way to figure out either the date that the user bought my app, or the original version of the app that they bought, or something like that? I'd like to say something like, "If the app was before the price change (either by date or by version), they should have the feature for free; otherwise, require IAP to unlock the feature."
For example, iOS does have a feature like this; the app receipt includes an "originalVersion" field which can be used to control access to features.
Unfortunately for your customers, this is impossible. There is no API call or anything else to Google Play where you can get the time on which the app was bought.
I know there is an android-publisher API in existance, however it doesn't offer any feature to check that.
The functions you want to use are not public availible and only used by the Playstore internally!
Workarounds which you could do:
1. Get the time the app was installed
On the first start you could check that and unlock the features.
Warning: This system could be abused by changing the time on the device
long installed = context
.getPackageManager()
.getPackageInfo(context.getPackag‌​eName(), 0)
.firstInstallTime;
2. Give users free keys
You could give every user who's using the app atm a free key via mail or push notification
3. Unlock the inapp purchase now
Publish an app update which unlocks the inapp purchase for free. After a few weeks you could pusblish your new version with the lower price and just unlock the features as if your current customers had bought your extension.
You might be able to hack your way around this if you're using some sort of persistent storage.
For SharedPreferences, on the first run, do a check for one of your preferences using SharedPreferences.contains(). If it contains it, the app must have already been installed. If not, set another preference that marks the user as new, and set yet one more so it doesn't do the check every time.
That might only work if the preference doesn't have a "default" value, I'm not entirely sure if setting a default in xml will mark it as contained.
You could do something similar if you have any assets that get transferred to SD, or any similar one-time setup. Just check to see if it's already done before doing it the first time.
If you're using an SQLite DB, you could increment the DB version and mark as "paid" in onUpgrade() if coming from the current version(or earlier).
There are some pitfalls here, though. For instance, if a previous paid customer completely uninstalls before installing the new version, or if it's on a new device. For that reason you should:
4. Provide Support
In the about or FAQ section of your app and on first run of your new version set a support mail adress which customers can use if they have any problems because the new features were not unlocked for them.
They could provide any proof (bill) for their purchase.
Like I said, those ideas are workarounds, but I don't know of any "official" way to check to see an app install is an upgrade or an initial install.
Your best option may be a combination of those four.
FYI: I've opened a feature request/idea in Google Cloud Connect for work which you could vote: https://connect.googleforwork.com/ideas/9392 (You can only vote if you have a paid Google Buisiness Account)
I hope this helps you at least a bit.
As far as i know, the best you can do is find the date it was installed. http://developer.android.com/reference/android/content/pm/PackageInfo.html#firstInstallTime

Run IAP check for piracy prevention after installation

My app has been pirated recently and I'm trying to prevent further losses in revenue.
I am using an In App Purchase system to purchase the premium version of the app.
Apparently someone bought my app and released a pirated version by doing a backup (where premium= true)
Now i would like to run an IAP check when my app is installed to check if the user really has purchased the premium version.
Is there a way to do this as soon as my app is installed or updated?
UPDATE:
I have to run the IAP without using SharedPreferences as they can easily be backed up and the backup distributed
Why not just check it once a day (or week)? You can set the SharedPreference to the last time a successful check was completed. Of course, you'll want to check for future dates and reject those, since that's what I'd do to get around a system like that. You might want to give a 24-hour leeway on future dates to accommodate for time-zone changing, but it shouldn't be too hard.
This way, even if someone backed up your app, it would only work for the next day or so before checking again.
To be honest, though, this might not help much. If people are pirating your app, they'll find ways to get around (just about) anything you throw at them.

upgrade trial to full version

I want to publish a trial of my app. In this app, the user has to save a lot of values in the sharedPreferences. If he decides to buy the full version, would the trial be deinstalled, and the sheredPreferences would be deleted too? Does anyone know that?
It would be very nice, if the sharedPreferences wouldnt be deleted, so the full version has access to the value of the trial, therefor the user hasnt to save all the values again.
Yes, the SharedPreferences are deleted when they uninstall the trial and install the full.
I see a few options you could use, either use the same app for both and use an unlock style of purchase, either via in app purchase, or by selling a separate "unlock" app.
You could save their settings to a remote server and have the full app download them from there. This one has the advantage of allowing syncing of settings across multiple devices, downside is you'd have to make and maintain a server.
You could save them to some other permanent file on the device, but personally I hate it when an app leaves something behind when I uninstall it.
Is it possible, to publish the trial with a lower versioncode as the full version, so the trial only would be updated and the sharedPreferences wouldnt be deleted?

Google App Licensing for Beta Apps?

This is what I am trying to do:
Put an app into a free beta
Make the user have a time limit on how long they can use it for "Beta Testing" (Time Bomb But this is easy to get around)
After the users beta time is up (Say 30 days) when the user enters the application [Or better yet they get a screen pop up when they start their phone]a screen pops up saying a message about beta being over, if you like our product please purchase the paid version.
So what I am doing is making a 30 day trial period on my application.
(I'm almost sure this has been done before, I'm wondering how to do it myself)
Probably the easiest way to detect the end of the trial would be store the current date using Preferences when the app first launches, and then compare that stored date with the current date (from the phone or from the internet) on every subsequent launch.
The user could just clear the application's data from Settings, or uninstall and reinstall the app, however, and it would start working again.
One solution to that is to have the app register the device, or the user's google account, with a server of yours on first launch, which the app connects to, to request permission on each subsequent launch.
A cheaper solution would be to design your app so that clearing its data or uninstalling and reinstalling it is enough of a chore to discourage users from doing it; for example, prevent exporting data from the app within the trial, so that the user has to choose between either paying or uninstalling the app and losing all their work.

Categories

Resources