libGDX unlockables management and gdx-pay\Native Android\IOS payments - java

I want to implement unlockable characters that can be purchased and I have a few questions about the best way to implement this in my game.
Currently I manage unlockables by storing them as preferences. However I'm now in the process of making them purchasable.
Is gdx-pay the best way to do this or create a native Android\iOS
implementation?
Once a method of purchasing characters has been implemented and the
user purchases one, what happens when the user uninstals my game?
i.e. should I reverify purchases on startup? This will require an
network connection, if the user doesn't have one it doesn't restore?
Should I be using preferences to store unlocked characters etc or
another method? My reason behind this method was to avoid having
ship a database with it and having to create separate sqLite
implementations for each platform.
Any advice would be much appreciated.

Point 1. Yes, for now if you want to go cross platform then gdx-pay is your choice. Recently they've also added support for IOS 9 which is great. You will be able to deploy on both Android and IOS with minimal change of code.
Point 2. You should always call requestPurchaseRestore in your splashScreen or somewhere on startUp to restore any purchases. This will ensure that even if the user uninstalls the game and installs it on another mobile device they will still have the purchases they've made. Of course, network connection is vital. If you don't have network access and you call requestPurchaseRestore you will get an error. That's why you should have a method to check if the user has access to the internet (wi-fi or mobile enabled) and only then call requestPurchaseRestore. If the user doesn't have internet they won't be able to restore Purchases. I don't see a problem with that. You can put a label somewhere that you need internet to restore purchases.
Point 3. Yes, having a local preferences file is a good idea. This is what I do myself. If an item is purchased you simply store it in the file. You may well use a db too but it's too much hassle for this kind of job.

Related

Getting user behavior on the Android Phone (App History, Browse History etc)

Is it possible to get the user behavior on the phone (for example Alpesh has an Android phone and he uses multiple apps, browser YouTube etc). Whatever he is doing on the phone I want to get all those things from behind (which apps he has installed, which app he opens and what he search on the phone, All these data I want to get programmatically so what all can be get in android).
For now I am aware that installed apps list can be get easily but I want to get usage history and what he do all on mobile.
This is not a code solution, but an answer to your question, so you can get start some where.
In my opinion your question title are asking about two things.
(part 1) Getting User Behavior on the Android Phone (part 2)(App History, Browse
History etc)
1- First part Getting User Behavior on the Android Phone:
There is a concept called context awareness. Short described; it is about gathering different information from the phone, like light sensor, motion sensor, sound, location or even user behavior etc. and depending on your app requirement and the gathered information:
You could send these information over cloud data store for statically usage
You could make your phone doing (behavior) different things depending on location, motion or what ever.
etc.
For context awareness it is an open area for pervasive computing research. And it is not just few lines of code to write, it is typically a complete solution depending on requirement. Example I have built a context awareness application to gather noise collected by phones from different locations for research purpose inspired from this framework, but I am pretty sure you can find other frameworks or even build your own, as I did in my case.
The mentioned framework has some examples.
2- The second part is about App History, Browse History etc.:
This is possible, but you still need to build a peace of software (App) to collect all these information (logs) from the phone. Hereafter you can make phone act on different conditions and/or again send it over a RESTful API over cloud service data store, there is no limit for it.
The problem is, there is no thing out of the box for your requirement. Even if you find frameworks you still need to research it and further work on it.
You can find different examples for your requirement, like to collect browser history, you can find SO question here:
Get browser history and search result in android
Or get list of installed application:
How to get a list of installed android applications and pick one to run
My point here is you need to solve small goals at a time and put your knowledge together at the end.
Both 1 and 2 can also be related to each other, depending on your achievement.
Conclusion
Make a goal to your project.
Define the main requirements and tasks of your project.
Research your options (Technology, Cost, Target Audience, What data I can or I should not collect, what is possible to collect, what is the limits, Privacy issues etc.).
Split your project in small assets and try to solve small problems/goals.
Finally you would be able to put the puzzles together and build your final application
but i want to get usage history and what he do all on mobile
This is not possible and shouldn't ever be possible. Each app is sandboxed by Android so apps cannot inspect what other apps are doing. Think about it, you wouldn't want apps to be able to intercept private information such as banking details.
Every app is isolated from the other ones. Unless you develop a system signed app, you will not be able to gather all that data.
What you could do is to develop your own Android Rom where you then develop your data collection the exact way you want. Then you need to distribute your rom, which is another story...

How to prevent an Android application from being installed more than three times?

I have got a suggestion to restrict an Android application to be installed a limited number of times, let's suppose three times for a given user account. I have already inserted a form at the start of the application which checks for username and password from our database, and returns whether its valid or not.
Next I have to apply a trick to prevent this application from being installed more than three times by each user. I hope it clears what I am trying to do. Any ideas what to do and how to proceed?
By no means you can restrict user to not to install your application from google play.
Have a install_count column in the user table in your database. Each time the user fills out form, check for the install_count value, if it is equal to 3, then don't allow the application to continue, you can show a message like "max installs exceeded" and exit the app. Otherwise, increment the install_count value in the db for that user.
PS: As Zoombie said, you can't stop the user from installing the app, but you can restrict the user from running the application if installation limit exceeds.
Also you need to be aware, there are many apps which take a back up of the installed app and data that can be restored back anytime. More over, if the user changes his device more than thrice, he won't be able to run your application. So consider the drawbacks of this limitation.
Technically this isn't a very difficult problem but the issue of user relations will be difficult to manage. You should provide a simple and easy mechanism for your users to "reset" their install count. Additionally you need to inform your users of this restriction BEFORE they pay for your app.
Restrictions like this will result in problems in a few cases I can think of:
What happens if a user factory resets their phone and then re-installs the app?
What if the user installs a custom ROM or gets a new phone?
Are you going to deny a paying customer the ability to install an application that they paid for? Poorly enforcing a policy like this will only hurt you in the long run as it will result in
very bad reviews of your app
piracy of your app with the checks removed
Remember people are downloading/buying your app because it provides something to them and with that they assume that they'll always have access to your app. As soon as you start denying functionality or violating their assumptions you're going to start alienating your customers.

Android number of exact downloads

From what I know, you can't get the exact number of users which downloaded your app, unless you're connected to your Google plus account. Is that true? (I haven't yet got a google play (android market) account, my app isn't yet up on the market, so i just wanna make sure i'm saying valid things here.)
Is there any way i could programmatically get the number of downloads, preferably in real time?
From what I've found, there isn't an API for the market which let's me do this. So how can this be accomplished?
I need to take that value and in real time update a graph on my website and blog.
Can anyone come up with a workaround for this? One thing i was thinking of was: to either make a Firefox extension which on my home machine, automatically connects to my Google plus account, takes the required value and updates the page via ftp or something, or instead of Firefox extension i could use PHP locally to do the parsing and whatnot. But i'd need to keep my home machine always on, which i don't really want to.
Any other ideas? I really need that exact value, and i need it to be automated :)
When the user downloads the app, you could have it do a callback to a script on your site that does a tally for you. The app should, obviously, only call this on the first run (but, depending on how you implemented it, would probably be called on each refresh of the app's cache/data). If you don't have a service that needs registration, you could have it done in the background.
Not possible by default. The only figures that do exist are only updated daily at most.
You would need to devise your own way to count downloads such as requiring your users to register on your own service.

Android - Setting usage flag

I am currently creating an app and would like to create a demo version (free) and a full version.
However, I am wondering how I can set some sort of flag so that when the demo version has been used 5 times, you have to buy the full version to continue using. This usage will be detected on a submit button.
I was considering setting a flag in the app, however releasied that the user could uninstall the app and then re-install it overcoming my set flag (as this would set it back to 0).
Has anyone got any clever solutions for my little dilema?
Thanks
You might want to try one of the techniques in this answer: https://stackoverflow.com/a/996288/1205715
I think that is not possible with an local application.
File saving to sdcard with strange filename can be a way but It is not perfect.
In my opinion, Right way is using an application server that manages user run times with unique UUID.
It might also be worth thinking about an alternative approach.
In app purchases are now available, so you could have a free and a restricted section in your app, and use the in app purchase to unlock the restricted section. You see more developers going with this approach these days, rather than managing two versions of the app.
Also worth considering the fact that if you have a paid version of the app it can be pirated pretty quickly, one person just needs to get their hands on the full apk. However, if you go with the in app purchase model you will be letting google handle a lot of these issues for you.... just a thought, and the road I will be taking with my next app.

Warning Android user that app update could lead to losing data from old app version?

I'm writing a game for Android. When the user completes a level, they can restart from the next level if they lose (i.e. I need to store an integer to remember which level they got to). If the app is interrupted during play, I save the world state to disk (this is complex state storing a map and game entities).
I'd like to keep my options open in the future for changing my game code and the way the world state is saved/stored. However, I must consider the scenario when a user has an old version of the world state on their phone because they were in the middle of a game, they upgrade the app and now the app cannot load the world state.
Having to write code to migrate the old version of the data to the new version of the data would be a pain if there's some way I can avoid this. It would be nice if I could somehow ask the user to finish their current game in progress before updating. Can this be done? Are there any other options?
I don't intend to do this often. I'd like to iteratively develop my game while getting some early feedback, but this is difficult if I must fix how the world state is saved and restored now.
I hope this doesn't seem a silly question, but on a PC or a console it's perfectly OK to have games that you cannot save during a game or you can only save between levels. I'm just finding Android a bit of a pain here as you must have a save game strategy for all games.
You cannot prevent a user from upgrading an app, and you cannot execute any code until your app is installed (or upgraded).
Quite frankly, losing data due to an upgrade is unacceptable. If you use an SQLiteOpenHelper, you automatically get nice hooks that help you with the upgrade process.
I understand that you have a pretty complex savegame setup, but try to keep it as flexible as possible to allow for easy upgrades. There are lots of techniques that help you with that.
And Android and PCs are just completely different - on a PC, you sit down and play for hours. On Android, you play real quick and then do something else. Or, you play and get a phone call and are forced to switch away from your game.

Categories

Resources