问题
I want to use Google In-App billing for my Android Apps using Libgdx. By default, it is a free apps for everyone. Some of the features will be unlocked once user paid a small fee (lets assume $1), and all features will be unlocked if user paid the full price (assuming $2).
I have a read on official Google's Billing site but I have no idea how to link it to Libgdx. The Official Libgdx Site doesn't really provide any clear instruction and explanation.
As at today, I still have no idea on how to link both Libgdx and In-App Billing. Furthermore, where is the information being stored (is it in the preference file?) when user purchased the unlocked item? I have absolutely no idea.
It will be great if someone lead me to the right path.
回答1:
Libgdx has an extension library that provides in-app-billing services in a cross-platform way: https://github.com/libgdx/gdx-pay. You can use this as-is, or use it as an example for how to interface between core and platform-specific code.
回答2:
Read about the Libgdx way for Interfacing with Platform Specific Code.
Basically, you need to implement the in-app billing support within your Android project, and then expose an API to your platform-independent code to access whatever state you need. There really isn't anything libgdx-specific about the result, the billing code will all exist in your Android back-end, so most existing Android documentation and tutorials should apply.
See this forum post for a few more details: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=2544
Also, when searching, in Libgdx-land this is often called "IAP" support (for "in-app purchasing").
来源:https://stackoverflow.com/questions/19921146/in-app-simple-tutorial