Click here to Skip to main content
15,076,130 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have few questions.

For example:

I've got game about knights.

Player want to have got better sword.

He can pay for it(using real money)

1. Can I sell better sword(game item, which has got better stats) if he paid me 1$ using "Selling in-app Products" ?
2. Ok. Player bought sword. And after few days he uninstalled app. 1 month later he want to play in my game again and instal my app. Should he have got that sword or he can start play again, beacuse his sword disappeared?
3. If he should have this item, how can I save it even include uninstaling and twice innstaling?
4. Can I "save this data("premium" item)" for his google acount, you know. He's logged as John. John bought sword on his smarthpone, but John lost his phone/bought new. If he logged as John on new phone and downloaded my app he should have got this item?
E.F. Nijboer 19-Jan-15 10:04am
I recently read "Android Programming: Pushing the Limits [Erik Hellman]" and I would recommend this book as an excellent reference on that. In the final chapter this is all covered. Also the other questions you have are excellent explained in this book (backup, moving to another phone etc...). I'm normally not someone to promote books or anything here but this book is actually quite good on those subjects. It also has some good examples how to use the real-time multiplayer API. This might also interest you I guess. The book is really good in some of these hard subjects.
(As a side note: I'm not affiliated or get anything for promoting this book, just think it could really help you out)

1 solution

This feature you're talking about is known as "In-app purchases" and is used to allow the users to purchase the products of you applications. No matter what product or item in your application, it can be a feature, an upgrade or a service etc.

You can learn more about such feature here, on Android Developer[^] website. Answers to your questions are already posted on that web page, in case I want to qoute them out here for you.

  1. Yes, you can allow the users to purchase an item with better features and capabilites by paying for them to you. Google will take care of the transaction, and user will get the item once your account gets the payment.
  2. According to that web page:
    All purchases are “managed” (that is, Google Play keeps track of the user's ownership of in-app products).
  3. As above, user will own the item, even after re-installing. Google Play services, or Play Games (by Google) can be made use of in this scenario to start the user's state from where he left off with all of the packages and items.
  4. Items are stored in the Google account, not the device (unless you want them to) so whenever the John logs in again, he will get his sword back.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900