I'm developing a game for android. I use the google play services for the multiplayer functionality.
I want to integrate an ingame currency, which is reset to a fixed amount every day. Every game round the user plays will cost him 1 coin of this currency. Additionally i want to integrate in-app purchases to buy packages of coins, which are indepentant from that daily amount of coins.
My question concerns the date request when starting the app, which decides wether the user gets coins for that day, or if he already got them. If i just fetch the local date, the user could just change the phones date and get the coins even if he already got them for this day. So my question is, whats the best way to get the current date? I already use the google play services, so is there a way to fetch the date from there ? Otherwise, that needs the user to be connected to the internet. Any suggestion on this ?
Another question is, where to save the coins. Locally would be the easiest option. But is it safer to use the google play services cloud stuff for this too ? That would have the advantage to work cross device.
If you can't trust the user's device you may want to get time from an external server that you control.
For storing the coins remotely, please check out the Google Play Saved Games Service. You can store arbitrary data there and use it to sync coins and other information across a user's devices.
Related
For those developers who implemented Pre-registration for their app, you can implement a special sku for their reward for signing up early. However, what if you don't want to roll out in-app billing?
What if you just wanted to have users pre-register your app with no in-app reward? How would one go about being able to make the distinction of those users who installed via pre-registration versus those who installed on or after launch day?
You can create 2 in-app products with two different prices and show the cheap one before a certain date and the normal price one after the date, but you will need an external server to get the date and avoid cheating by changing the date of the phone.
Reading the documentation for subscriptions and related SO questions/answers i am still confused what to do when i have to stop providing the subscription services and content:
https://developer.android.com/google/play/billing/billing_subscriptions.html#cancellation
In all cases, you must continue to offer the content that your
subscribers have purchased through their subscriptions, as long any
user is able to access it.
For example i am offering some content via my server to subscribed users in my app. At one point i am unable to offer that content and i want to cancel all subscriptions?
The users theoretically wont be able to access the content any more and i certainly dont want to charge them for it any longer. The proper use case for me would be to cancel the user subscriptions and refund the remaining money for them. But i am not sure that this is acceptable according to the available information in the docs...i guess that i can do the cancellation and refunds using the google play developer API (still reading the available options) if that will cover the policy requirements somehow?
I am just finding it hard to believe that if a user for ex. rejects app updates and stays on an old app version with an old subscription i have to support him for eternity :) ?
I know what you are suffering the only way around this is communicate to your users to update. Usually this case would mean a FORCE UPDATE so when they open your app they have to update. Your backend has to have a service like that. If user doesn't update they can't use the app. Also I pretty much believe that some subscriptions are auto renewal so that's one the reasons why deleting in the play store is not possible. Also take into account that change price would generate almost the same problem. Since you can't change a price of a subscription at least the base price, the country price you can.
I'd like to design an Android game that has an in-game currency (coins) that can be earned by playing the game or can be bought with real money. This currency can then be spent on different upgrades.
Obviously I need to store the players' number of coins and the list of the upgrades they bought online, not to lose this information if they decide to uninstall the game. However, I don't have access to a server so I'd like to use the Google Play Services to store this information in hidden achievements / leaderboards.
My idea is to have two leaderboards set up: one for the total ammount of coins earned + purchased and one for the total ammount of coins spent. These leaderboards would be updated whenever the player earns coins or buys them with a consumable IAP (which is consumed immediately after the purchase so they can buy it again later), or whenever the player decides to spend some of their coins on upgrades. The upgrades themselves would be stored as achievements so if they buy something, the specific achievement would unlock.
This way all of the purchase information would be stored online and if the players reinstall the game, they wouldn't loose any progress: the list of purchased upgrades is stored in their unlocked achievements and the amount of their remaining coins is just the difference between the two leaderboards' scores.
This method also seems more secure than storing the information locally or establishing a connection to a custom server. And since the Play Services cache the data when offline and sync it later, the Store could be used without internet connection (apart from buying coins with IAPs of couse). The only downside is that it enfroces the Play Games sign-in so I'd have to check that before any transaction. Basically the entire "Store" menu would start with a Google Play Services sign-in.
My question is that do you see any problems with this solution? Is it possible to realize it or am I misunderstanding any of the concepts (I only have worked with non-consumable IAPs so far and the way to track consumables is a bit unclear for me). Is it breaking the Play Services terms of use (I also intend to create some traditional leaderboards and achievements so not everything would be hidden) ? And lastly, is there a simpler way to do this without using a server?
Thank you in advance :)
Peter
This idea sounds inflexible. Why don't you just use the Saved Games API from Google? This will do essentially what you want to do with a proper API instead of using the leaderboard/achievement API. You can define any class to save your data to the cloud and sync across devices.
Plus, Google has some default UI for showing the leaderboards and achievements. If you want to use real (unhidden) leaderboards or achievements you'll have to write your own UI and filter out the hidden ones.
I am working on Google play game service
I have integrated code for real time player and its working.
Now i want to know some more feature that
I did not found after searching on Google are below
1. When user won the game it should update wining counter by one.
2. What is the ranking of user according to country
3. How to get user detail of opponent.
It sounds like you want to check out Leaderboards https://developers.google.com/games/services/common/concepts/leaderboards
You can create (currently) up to 70 leaderboards (maybe one for the country/regions of your players).
At the end of your game, you can update the user's score. The server keeps track of daily, weekly, and all time leaders. There is also the concept of Public and Social leaderboards so that may be a way to see the opponent's standing.
Is GamesClient.submitScore require online connection? How exactly is it working when user is offline? Scores to submit are saved in some sort of queue to execute when there is something to do or I must first save scores locally and then update it on Google Play GAme Services?
yes it requires a network connection. However what you could do is use SharedPrefrences for when the user signs back in. This is what I did in my app. you just have to make sure the same person who is playing offline is the same one who will sign in later.
Hope this helps!