On the Android side of things we’d need to have a much longer discussion than this forum might allow.
But basically Android has an app lifecycle and the
on_resume() method is triggered whenever an
Activity gains focus
On the Godot side you’d have to use the notification system
if what == NOTIFICATION_APP_RESUMED:
elif what == NOTIFICATION_APP_PAUSED:
and if you want to trigger it yourself
You have not specified which plugin you’re specifically using so the above is for general use cases
Big Thanks for the answer.
Im plyaing with :
GitHub - godotengine/godot-google-play-billing at billing-v5
where I got the source code and I’m messing under the hood learning java and android api at the same time. I’m following the code logic and adding small changes for reply 5.1.0 billing library needs. Unfortunately I’m no coder and burn lot of time trying to understand how it works.
Anyway my gradlew build works . I can connect to play store and buy consumables at the moment. Problem showed when connection is lost between buying and consuming product.
I resolved problem temporally adding “queryPurchases()” function on callback from “onMainResume” in the plugin (which is callback Activity#onResume() ).
But I suppose beacuse “queryPurchases” is called async so I have an error : Purchase acknowlegde error: 6: ERROR Server error, please try again. “//purchase_token” after buing product. Which is irrelevant beacuse next line in logcat is “purchase acknowledged” with the same token and product can be consumed with no problem
My lack of understanding what an Activity is and what triggers “onMainResume” function in the plugin is the source of the problem.
Now after reading Your answer and making some experiments i can roughly assume and (over)simplify that from billing plugin perspective Activity “is” my application and my interaction with it. “onMainResume()” triggers everytime I switch apps on the phone or I exit the play store.
Anyway with this knowlegde effective acknowleging purchase after connection error is closer for me.
Big thanks Wakatta
p.s Here are links to godot.plugin
Ok link is impossible. One must search on GitHub.
Activity | Android Developers
maybe someone find it helpful.
VanDeiMin | 2023-01-03 02:15