-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-implement GodotPayment Android plugin using the Google Play Billing library #39034
Re-implement GodotPayment Android plugin using the Google Play Billing library #39034
Conversation
Maybe there is already a solution to the library inclusion problem in the new Android plugin system that I didn't find... (CC: @m4gr3d) |
@timoschwarzer With the new plugin system, you can define a configuration file that can specify the dependencies needed by the plugin. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this is not opened against the master
branch so that you can test and validate?
...va/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
Outdated
Show resolved
Hide resolved
...va/plugins/godotpayment/src/main/java/org/godotengine/godot/plugin/payment/GodotPayment.java
Outdated
Show resolved
Hide resolved
Thank you for the hint @m4gr3d, that works :)! Although I didn't find a better way to create an inline /*
* Set of prebuilt plugins.
*/
static const PluginConfig GODOT_PAYMENT = {
/*.valid_config =*/true,
/*.name =*/"GodotPayment",
/*.binary_type =*/"local",
/*.binary =*/"res://android/build/libs/plugins/GodotPayment.release.aar",
/*.local_dependencies =*/{},
/*.remote_dependencies =*/String("com.android.billingclient:billing:2.2.1").split("|"),
/*.custom_maven_repos =*/{}
}; There has to be a better way... |
This is opened against 3.2 for now because @akien-mga said that we can break compatibility now with 3.2.2 if necessary as we already kind of broke it by renaming GodotPayments to GodotPayment. I can also imagine Google rejecting apps using the old AIDL API in the near future because their warnings are quite bold. (1, 2) When everything works in 3.2, I'll start testing with master :) |
@m4gr3d Thanks a lot for the review! All valid points and done :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me!
There are some code styling issues: https://travis-ci.org/github/godotengine/godot/jobs/691014967 You can set up |
@akien-mga fixed 👍 @m4gr3d are there significant differences between the Android build systems in 3.2 and master? I'd start the PR for 4.0 now :) |
@timoschwarzer No the changes should be identical. |
Thanks! |
|
I got error log from adb logcat.
|
@volzhs have you recompiled your editor? You need to do this because the dependencies for the included Android plugins changed. |
@timoschwarzer yes. I've always compiled both editor and template. |
@volzhs just to be sure: have you re-installed your Android build template? |
@timoschwarzer yeap. replaced new templates every time on custom directory path which is defined at export setting. |
@volzhs I just cloned the repository into a new directory (godot3). These are the steps I did and it worked just fine.
Then I created a new project, clicked Project → Install Android Build Template and added a new main scene with the following script: extends Node
func _ready():
print(Engine.has_singleton('GodotPayment')) After that I added an Android export template and checked 'Use custom build' and 'Plugins / Godot Payment'. Finally I checked 'Debug → Deploy with Remote Debug' clicked the Android run button in the top right corner of the editor. |
For some reason, your Gradle build does not include the Google Play Billing library, which leads to the error you're getting. |
@timoschwarzer should I check |
@volzhs You have to because Gradle won't fire up and install the dependencies otherwise. But yeah, this should be noted in the docs. I didn't have time to update the docs yet but I'll do that the next days. Thank you for reminding me to add a bold notice for that requirement! |
I missed that initially, do we want to force uses to use a custom build to use The alternative is to add the billing library in the base APK I guess? But that would force the |
@akien-mga @timoschwarzer Unfortunately yes. It's either making the default Android templates include the It's hard trade off because If we end up requiring Do we have a hard date for the deprecation of the previous API, as it would simplify the decision? |
I assume that users who use IAP will often want to use other Android plugins like ad providers or Google Play Services, so it's probably OK to make it conditional to doing a custom build. But indeed, if this is the new requirement, then decoupling it completely from the one-click deploy APK would be good. |
I agree to both of you. My proposal would be adding a field like
If we decouple the plugin completely, maybe it's worth setting up a first-party Android plugins repository under the |
I can connect store with GodotPayment by following all @timoschwarzer steps. thanks. |
@timoschwarzer All plugins asides from the built-ins ( Disabling/hiding the checkbox in the project export is not possible with the current implementation. I mulled adding the implementation for it, but decided to delay it since we were already in the What we can do instead for now, especially if we go ahead with decoupling the |
I've exported with use custom builds and godotpayment plugin. Engine.has_singleton("GodotPayment") returns true, Is there a guide somewhere on how to get this working with the new system?
|
@HEAVYPOLY not yet. I'll begin updating the example project today. Please take a look at "Example code using the new API" above or ping me on Discord/IRC if you need help :) |
@akien-mga Where would be the best place for a migration guide for existing GodotPayments users? |
Probably on the official docs. I think there's a page covering IAP, not sure how much details it has regarding the GodotPayments API but I guess it needs both an update + a section with a migration guide. |
@timoschwarzer Since 3.2.2.stable is fast approaching, is this update to the |
@m4gr3d it's feature-complete and I've been using it in production for subscriptions with no problems. Example projects are updated and I opened a PR for the docs :) |
@timoschwarzer cool! I've pinged @akien-mga to discuss if we should move the plugin into its own repo prior to releasing |
@m4gr3d makes sense IMO since it requires Custom Build anyways. |
@m4gr3d @timoschwarzer Moving it to a separate repo makes sense, since we're breaking compatibility anyway we might as well go all the way. We should do this in coming days, I don't want to delay the 3.2.2-stable release too long. But we can take the time needed to do it right of course. |
@akien-mga I expect the code migration process to be quick. I can perform the migration, we just need to agree on the new repo name and structure. @timoschwarzer Your input would also be appreciated :) @timoschwarzer Once the code is migrated, you'll need to update the documentation accordingly (both godot docs, and the new repo's README). |
Naming wise, I don't have a strong opinion, beyond using kebab-case, so maybe something like Note that given the scope of the changes, if you think a different name would be better than GodotPayment, that's also an option. |
@akien-mga @m4gr3d what about |
@timoschwarzer sounds fine by me. It would have to be |
@m4gr3d yeah, Google Play Billing of course. (it's late here 😅) |
@timoschwarzer I've created the repo and sent you an invite. Feel free to start updating the repo description and README. |
Sounds good to me. @m4gr3d Feel free to start the migration then. I think you should be able to create a new repo under the @godotengine org, if not, you can make it in your namespace and we'll see how to move it when I'm back online tomorrow :) Edit: forsooth, you're fast :D |
@m4gr3d @akien-mga Thank you! I'll work on that tomorrow. I'll create an additional PR in the main repository that removes the plugin from the tree. |
What does this PR do?
Re-implement the GodotPayment Android plugin to migrate away from AIDL ("Accessing Google Play Billing using AIDL is deprecated, and all integrations must use the Google Play Billing Library in the future" source) and to using signals. This also enables the usage of in-app subscriptions.
This breaks compatibility but we already broke compatibility by renaming
GodotPayments
toGodotPayment
for 3.2.2 and the changes should be fairly trivial to implement in existing games (I'll write docs once this PR is done).Example code using the new API
Some methods are missing from this example, I'll add them later... (purchasing items, consuming items, querying SKU details)
Current problems
I found no way to conditionally add a Gradle dependency to the custom Android build.com.android.billingclient:billing:2.2.1
should only be added if the module is enabled in the project export dialog because of 1. size overhead and 2. it automatically adding theBILLING
permission to the app.My current workaround is to create a file
<project dir>/android/billing-client/gradle.conf
with the following content to include the library in the final build:Dependencies
If you want to test this, make sure that #39029 is merged or merge it yourself before as this PR depends on it.
To-Do