I am looking to restrict access to a new widget I have added to one of my Android apps, so that it is available as an In-App purchase.
Is there a way to check to see if the widget as been purchased and if not the stop the user from being able to use it?
I can easily query items in Activity classes but in the AppWidgetProvider I am struggling to get there.
If it is possible, could you provide either a link or some sample code to nudge me in the right direction.
Okay, since there was no help I managed to find a work around myself ;)
Incase anyone else wants to know :-
When the In-app product is purchased I add a unique identifier to the shared preferences and recall it when it tries to create the widget.
Related
I need to be able to prevent the user from using my app until I allow him. The idea is that the app should be available for download but the user should only see activation screen when he launches it.
Then he has to request an activation key through email and use that key to unlock the app.
Is there a way to achieve something like this in Play Store and is it allowed?
I also don't like this idea but its my client's wish..
Note to moderators: I posted a similar question for the Apple Store but I want to keep both threads separated so please don't consider this as spam.
Google Play does not have such a feature out of the box.
I can however, think of 3 ways you can get it work. I am speaking strictly for the Android platform though.
You can design you app in such a way that the first screen should ask the user to get an Activation Code / Enter an Activation Code.
After the above, you can either store the Activation Code in a Preference File and check the value for its validity and start the application only if it matches / is valid.
Store the Activation Code in a Database and again, check the value and its validity and start the app if it matches / is valid.
Provide a couple of features and integrate Google Play In-app Billing and let the user pay a one-time fee to activate and enable all functions in the app.
These are the things I can think of at the top of my mind. Hope this helps.
No, There's no way to achieve this. You will have to create a functionality within your application.What you can do is make the user enter an activation key, if the activation key is correct make the user go to the next screen else don't let the user.
Thats something you would have to implement in your app. If there is some payment involved in getting the registration key then the solution is clearly against the play store rules.
i use similar system on my application. When user open the app first time. I ask for promotion code if this promoition code is true (i check it from back end service) user can use app for 3 months free. After this period end, app ask user to buy subsciription. You can do it using a backend service with interact a database.
I folloed this tutorial to implement in-app in my application:
http://blog.blundell-apps.com/simple-inapp-billing-payment/
The user can now purchase my item (com.myitem) with in-app system. After that, I set in a Shared Preference that the user has been purchased the item.
The problem is if the user uninstalla and reinstall the app.
So the question is: how can I check if the user has been already purchased the item?
I know that I should use restore BillingHelper.restoreTransactionInformation(...) on RESTORE_TRANSACTION...but where, and how?
I checked Dungeon example, but it seems to hard and complex to unterstand. There's a simple way to do that?
Thank you
Using RESTORE_TRANSACTION is the only way if you use managed purchases. If you use unmanagaed purchases, you can store the purchase state on your own server, but that is hardly simpler. There is nothing complex about RESTORE_TRANSACTIONS: you just fire the command and you get notified with transaction information that is in the exact same format as what you get when you first purchase an item. You should process it in the exact same way, and chances are you already have the code for that in your app. Testing this is somewhat harder, because it doesn't really work with test accounts, and you need a live app. Go over the official documentation again to understand how it works.
I've seen this question: Android - how to check if in app purchase has already been done?
It is not very clear to me however. I am using the AndroidBillingLibrary, mentioned in the answer, and I have a couple of questions.
When using restoreTransactions(), does that mean that at that point the purchases are stored on the device itself? Couldn't that be manipulated somehow?
And what if I buy an item on an other device, how does the first device know this? Do I need to restore again?
Thanks in advance
For the first question, every purchase is managed with an ID, thus only managed items work with restoreTransactions(). Also, restoreTransactions() does not work for reserved Product IDs. Thus it is still safe.
Ideally you should call restoreTransactions() every time the app runs. The Key thing is that all transactions are paired with the device/user ID (not sure how Google handles authentication on their server side but I assume it is using a combination of your Google account as well as the phones that the Google account is paired to).
So, if someone were to modify the transaction file, it will get invalidated when it is compared to the logfile on Google's side.
Hope this clarifies things :)
I'm thinking about putting an half-developed app idea up on Indie GoGo (worldwide variant of Kickstarter) but am considering how to handle delivery.
I need to make sure that just the right people can get the app they pledge for, do you know if there's a way to bind certain users to an app so only they can download it? I was thinking of using the e-mail of their Google account since they need one anyway.
I would then upload the same app publicly for a higher price for everybody else once it's done. If this way isn't supported, do you know how other people have solved this?
I guess it will be hard to do. But I have some ideas that you can use:
First of all if you have emails of your subscribers then you can directly send them your app.
If you want to place your application on Google Play then it's more difficult. I hope the following approach can be used. You can create a stub for your application. This stub during the run will check if a user possesses with some purchased item. If he possess then you simply start your application (inside your application you can also put this type of checks to be more difficult to crack your application). If the user does not have this item you propose him to buy it. During this you check if the user is in your list. If he is then you select one price if not then another.
These are just my thoughts. I've never implemented something similar.
I'm searching for a tutorial or an explanation on how to remove advertisement in my application with in-app purchase?
I will put some ads with ad-mob in my app but I also want, that the user can disable the ads when he pays a little donation. Do you know a site or tutorial where I can find a step-by-step explanation how to do this?
Or do I need to publish 2 versions of my app? One with ads and one without ads for paying?
Don't use the SharedPreferences method because if the user flushes the app data or uninstalls/reinstalls your app their ad-free status will be lost.
A couple of ideas:
If your app has any kind of web based login or authorization, you can flag the user as having bought the ad free version by updating the web database's customer data and then disable ads in code following login and verification. This has the added benefit of following the user to new devices.
Use one of the several ways to get a unique device id, and store that in a web server database. On startup, query the DB to see if the device is ad-free. See Android Unique Device ID. This will only work for that particular device though.
The two apps approach is simple enough to get the job done too. :)
This presentation seems to explain an example and includes a link to source code at github:
http://gotocon.com/dl/2011/GeekNights/Tjen_penge_p%C3%A5_Android_ARH.pdf .
It stores the purchased upgrade at a sharedpreference.
However, I'm still looking for a more secure and robust solution that works out the use-case explained here:
http://vlingo-en.custhelp.com/app/answers/detail/a_id/1785/~/moving-in-app-purchase-(ad-removal)-to-new-android-phone/p/180