So I created a game, compiled an .apk file with CocoonJS, signed and zipaligned the apk, and put it on the Google Play Store. However I've now run into an issue with trying to get In-App purchases to work.
In the Google Play Developer Console is states the following in the In-app Products tab for my game:
"Your app doesn't have any in-app products yet.
To add in-app products, you need to add the BILLING permission to your APK."
What I have attempted to do is I opened the original .apk file, added the "IInAppBillingService.aidl" file, and modified the code in "AndroidManifest.xml" by adding the line:
<uses-permission android:name="com.android.vending.BILLING" />
Then I resigned/zipaligned the whole thing and tried adding it to Google Play, but Google returned the following error:
"Your APK cannot be analyzed using 'aapt dump badging'. Error output:
Failed to run aapt dump badging:
W/ResourceType(11858): Bad XML block: header size 28257 or total size 1936025193 is larger than data size 339
ERROR: AndroidManifest.xml is corrupt"
Has anyone else had any success publishing a game using Construct 2 and CocoonJS with working In-App Purchases and can tell me what I'm missing or did wrong? Thanks.
Looking more into this now. I would love for a more streamed line process to do this using Construct 2 + CocoonjS. This is the way to go for developers to increase revenues.
Did you click to include the playstore in the Cocoon compiler?
<img src="http://content.screencast.com/users/ArcadEd/folders/Jing/media/47bc9b4f-f7e6-47df-9acf-4bb8e662296a/2013-07-17_1931.png" border="0" />
Ah, I have not signed up for CocoonJS Extensions so I don't have access to that page.
I'll try signing up for Premium and see if it works.
Alright so I applied and was granted Premium access, then I exported my game again, put it on Google Play and this time it let me set up In-App Products. I created a managed product with the same id name as the one I specified in Construct 2. Then I published the game.
In my game I set up some flags for if CocoonJS can access the store and if it purchases something properly. The first part worked fine and it seems that my game was able to connect to the online store, however upon pressing the "buy" button, my purchase failed flag is triggered.
My Events in Construct 2 basically goes like this:
Touch| On touched button: CocoonJS| Purchase product "id" with preview
CocoonJS| On "id" purchase completed: Text| Set text to "Purchase Completed"
CocoonJS| On "id" purchase failed: Text| Set text to "Purchase Failed"
Upon pressing the button, no preview or anything pops up. The text simply displays "Purchase failed"
Did I miss a step? Or does my id name have to be something more complicated?
I have the same problem on my game, any help?
As anyone solved this issue? Also, can someone post an example of how to do in app purchases with CocoonJS.
Has anyone solved this problem yet ?
Develop games in your browser. Powerful, performant & highly capable.
Does this help? InApp CocoonJS GooglePlay Tutorial