Hi, I just commited a first draft on github of my android payment module (its not perfect, but it's already tested with the andoird.test.purchased item).
Here you'll find the source files:
https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/native/payment/payment.android.java
https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/payment.monkey
https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/payment/product.monkey
https://github.com/JochenHeizmann/Horizon-for-Monkey/blob/master/payment/service.monkey
My destination is that I can use the module for ios and android without changing anything in the monkey code. Here is an example:
Import horizon.payment
Class MyProduct Extends PaymentProduct
Method GetAppleId$()
Return "my.apple.product.identifier"
End
Method GetAndroidId$()
Return "android.test.purchased"
End
End
[...]
myProduct = New MyProduct()
paymentService = New PaymentService()
paymentService.SetBundleId("myapplebundleidentifier")
paymentService.SetPublicKey("myandroidpublickey")
paymentService.AddProduct(myProduct)
paymentService.StartService()
myProduct.UpdatePurchasedState()
[...]
Method OnUpdate:Void()
If (paymentService.IsPurchaseInProgress())
' Do something
End
If (SomeButtonIsPressed()) Then myProduct.Buy()
If (myProduct.IsProductPurchased()) Then Print "Yay! Product is available!"
End
|