Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / What are other Tier 2 users experiencing with IAP?

Author
Message
ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 16th Sep 2014 00:12 Edited at: 16th Sep 2014 00:26
I got IAP working in Tier 2 for the Android platform and things are working pretty well when the player makes an inApp Purchase.
They do get a message that says...
Quote: "The item has already been purchase"
...even though it's there first time making the purchase.

In my code once GetInAppPurchaseAvailable(0) equals 1, I change my gamemode and send execution to the Title Screen so that part of the code is not reached again. So I don't know why they would get that message.

Here is the code:



Another thing that is going on is when the play cancels the purchase. What happens is that they would have to close out the google play popup several times with whatever message they get. For this one user it was
Quote: "...credit card is not valid"

They had to close out from that message several times; and then they got the message that my game needed to close.

And then sometimes when it gave that message the game stop; the user clicks OK, the program will either shutdown or the game will start over.

Has anyone seen anything like this in Tier 2?
Here are the two functions I have incorporated for IAP:


Actually, I'm thinking about instead of checking if (agk::GetInAppPurchaseAvailable(0) == 0) is to check if (agk::GetInAppPurchaseAvailable(0) <=0)
and if (agk::GetInAppPurchaseAvailable(0) == 1) check for if (agk::GetInAppPurchaseAvailable(0) > 0).

What do you guys think?

Prove Your Worthiness
KG2Entertainment.com
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 16th Sep 2014 13:48
Is the app version/build that you're working with uploaded to the GPlay Developer console as an alpha or beta? If not you'll get a bunch of issues like what you're describing, usually just "this app version is not set up for IAB"

Other than that I'd have to look at the Android/java code. It seems like you're getting some weird returns back from it. What template did you use (108?? or v2)? What does logcat show when this process happens. Usually there are some really good clues in there.

ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 16th Sep 2014 16:35 Edited at: 16th Sep 2014 16:39
The build is uploaded to the console. It's in production already. I'm using V1 of AGK. 108.24

The purchase is successful, but the cancelling out of a purchase causes problems.

Here is some info from the logcat.

Quote: "
09-16 06:20:09.211: W/IAB MakePurchase(15223): Buying com.kg2entertainment.proveyourworthiness.opensensei_removeads
09-16 06:20:09.281: I/threaded_app(15223): Pause: 0x5c7d7ec8
09-16 06:20:09.321: I/threaded_app(15223): activityState=13
09-16 06:20:09.321: I/native-activity(15223): App Paused
09-16 06:20:09.351: I/threaded_app(15223): WindowFocusChanged: 0x5c7d7ec8 -- 0
09-16 06:20:09.361: I/native-activity(15223): Lost Focus
09-16 06:20:09.381: D/IabHelper(15223): Starting async operation: launchPurchaseFlow
09-16 06:20:09.381: D/IabHelper(15223): Constructing buy intent for com.kg2entertainment.proveyourworthiness.opensensei_removeads, item type: inapp
09-16 06:20:09.401: D/IabHelper(15223): Launching buy intent for com.kg2entertainment.proveyourworthiness.opensensei_removeads. Request code: 10001
09-16 06:20:09.421: E/IAP Activity(15223): Started
09-16 06:20:09.431: E/IAP Activity(15223): Stopped
09-16 06:20:09.431: E/IAP Activity(15223): Destroyed
09-16 06:20:09.641: I/threaded_app(15223): SaveInstanceState: 0x5c7d7ec8
09-16 06:20:09.661: I/native-activity(15223): Save State
09-16 06:20:09.661: I/threaded_app(15223): APP_CMD_SAVE_STATE
09-16 06:20:11.823: D/IAB IAPActivity(15223): onActivityResult(10001,0,Intent { (has extras) }
09-16 06:20:11.823: D/IabHelper(15223): Ending async operation: launchPurchaseFlow
09-16 06:20:11.823: D/IabHelper(15223): Purchase canceled - Response: 5eveloper Error
09-16 06:20:11.823: D/IAB PurchaseFinished(15223): Purchase finished: IabResult: User canceled. (response: -1005:User cancelled), purchase: null
09-16 06:20:11.823: E/IAB PurchaseFinished(15223): Error purchasing: IabResult: User canceled. (response: -1005:User cancelled)
09-16 06:20:11.823: D/IAB IAPActivity(15223): onActivityResult handled by IABUtil.
09-16 06:20:11.953: I/threaded_app(15223): Resume: 0x5c7d7ec8
09-16 06:20:11.963: I/threaded_app(15223): activityState=11
09-16 06:20:11.963: I/native-activity(15223): App Resumed
09-16 06:20:11.963: W/IAB MakePurchase(15223): Buying com.kg2entertainment.proveyourworthiness.opensensei_removeads
09-16 06:20:11.963: I/threaded_app(15223): WindowFocusChanged: 0x5c7d7ec8 -- 1
09-16 06:20:12.024: I/native-activity(15223): Gained Focus
09-16 06:20:12.024: W/IAB MakePurchase(15223): Buying com.kg2entertainment.proveyourworthiness.opensensei_removeads
09-16 06:20:12.054: I/threaded_app(15223): Pause: 0x5c7d7ec8
09-16 06:20:12.064: I/threaded_app(15223): activityState=13
09-16 06:20:12.064: I/native-activity(15223): App Paused
09-16 06:20:12.104: I/threaded_app(15223): WindowFocusChanged: 0x5c7d7ec8 -- 0
09-16 06:20:12.104: I/native-activity(15223): Lost Focus
09-16 06:20:12.114: D/IabHelper(15223): Starting async operation: launchPurchaseFlow
09-16 06:20:12.114: D/IabHelper(15223): Constructing buy intent for com.kg2entertainment.proveyourworthiness.opensensei_removeads, item type: inapp
09-16 06:20:12.144: D/IabHelper(15223): Launching buy intent for com.kg2entertainment.proveyourworthiness.opensensei_removeads. Request code: 10001
09-16 06:20:12.174: E/IAP Activity(15223): Started
09-16 06:20:12.194: D/AndroidRuntime(15223): Shutting down VM
09-16 06:20:12.194: W/dalvikvm(15223): threadid=1: thread exiting with uncaught exception (group=0x4173cda0)
09-16 06:20:12.204: E/AndroidRuntime(15223): FATAL EXCEPTION: main
09-16 06:20:12.204: E/AndroidRuntime(15223): Process: com.KG2Entertainment.ProveYourWorthiness, PID: 15223
09-16 06:20:12.204: E/AndroidRuntime(15223): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.KG2Entertainment.ProveYourWorthiness/com.thegamecreators.agk_player.IAPActivity}: java.lang.IllegalStateException: Can't start async operation (launchPurchaseFlow) because another async operation(launchPurchaseFlow) is in progress.
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.ActivityThread.access$900(ActivityThread.java:169)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.os.Handler.dispatchMessage(Handler.java:102)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.os.Looper.loop(Looper.java:146)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.ActivityThread.main(ActivityThread.java:5487)
09-16 06:20:12.204: E/AndroidRuntime(15223): at java.lang.reflect.Method.invokeNative(Native Method)
09-16 06:20:12.204: E/AndroidRuntime(15223): at java.lang.reflect.Method.invoke(Method.java:515)
09-16 06:20:12.204: E/AndroidRuntime(15223): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
09-16 06:20:12.204: E/AndroidRuntime(15223): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
09-16 06:20:12.204: E/AndroidRuntime(15223): at dalvik.system.NativeStart.main(Native Method)
09-16 06:20:12.204: E/AndroidRuntime(15223): Caused by: java.lang.IllegalStateException: Can't start async operation (launchPurchaseFlow) because another async operation(launchPurchaseFlow) is in progress.
09-16 06:20:12.204: E/AndroidRuntime(15223): at com.thegamecreators.agk_player.iap.IabHelper.flagStartAsync(IabHelper.java:820)
09-16 06:20:12.204: E/AndroidRuntime(15223): at com.thegamecreators.agk_player.iap.IabHelper.launchPurchaseFlow(IabHelper.java:373)
09-16 06:20:12.204: E/AndroidRuntime(15223): at com.thegamecreators.agk_player.iap.IabHelper.launchPurchaseFlow(IabHelper.java:338)
09-16 06:20:12.204: E/AndroidRuntime(15223): at com.thegamecreators.agk_player.IAPActivity.onCreate(IAPActivity.java:20)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.Activity.performCreate(Activity.java:5451)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-16 06:20:12.204: E/AndroidRuntime(15223): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
09-16 06:20:12.204: E/AndroidRuntime(15223): ... 11 more
09-16 06:20:38.742: I/Process(15223): Sending signal. PID: 15223 SIG: 9
09-16 06:20:39.092: D/AndroidRuntime(16021): Shutting down VM
09-16 06:20:39.092: W/dalvikvm(16021): threadid=1: thread exiting with uncaught exception (group=0x4173cda0)
09-16 06:20:39.092: E/AndroidRuntime(16021): FATAL EXCEPTION: main
09-16 06:20:39.092: E/AndroidRuntime(16021): Process: com.KG2Entertainment.ProveYourWorthiness, PID: 16021
09-16 06:20:39.092: E/AndroidRuntime(16021): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.KG2Entertainment.ProveYourWorthiness/com.thegamecreators.agk_player.IAPActivity}: java.lang.ArrayIndexOutOfBoundsException: length=15; index=-1
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.ActivityThread.access$900(ActivityThread.java:169)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.os.Handler.dispatchMessage(Handler.java:102)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.os.Looper.loop(Looper.java:146)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.ActivityThread.main(ActivityThread.java:5487)
09-16 06:20:39.092: E/AndroidRuntime(16021): at java.lang.reflect.Method.invokeNative(Native Method)
09-16 06:20:39.092: E/AndroidRuntime(16021): at java.lang.reflect.Method.invoke(Method.java:515)
09-16 06:20:39.092: E/AndroidRuntime(16021): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
09-16 06:20:39.092: E/AndroidRuntime(16021): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
09-16 06:20:39.092: E/AndroidRuntime(16021): at dalvik.system.NativeStart.main(Native Method)
09-16 06:20:39.092: E/AndroidRuntime(16021): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=-1
09-16 06:20:39.092: E/AndroidRuntime(16021): at com.thegamecreators.agk_player.IAPActivity.onCreate(IAPActivity.java:20)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.Activity.performCreate(Activity.java:5451)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-16 06:20:39.092: E/AndroidRuntime(16021): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
09-16 06:20:39.092: E/AndroidRuntime(16021): ... 11 more
09-16 06:20:42.907: I/Process(16021): Sending signal. PID: 16021 SIG: 9
09-16 06:20:43.267: D/AndroidRuntime(16106): Shutting down VM
09-16 06:20:43.267: W/dalvikvm(16106): threadid=1: thread exiting with uncaught exception (group=0x4173cda0)
09-16 06:20:43.267: E/AndroidRuntime(16106): FATAL EXCEPTION: main
09-16 06:20:43.267: E/AndroidRuntime(16106): Process: com.KG2Entertainment.ProveYourWorthiness, PID: 16106
09-16 06:20:43.267: E/AndroidRuntime(16106): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.KG2Entertainment.ProveYourWorthiness/com.thegamecreators.agk_player.IAPActivity}: java.lang.ArrayIndexOutOfBoundsException: length=15; index=-1
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.ActivityThread.access$900(ActivityThread.java:169)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.os.Handler.dispatchMessage(Handler.java:102)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.os.Looper.loop(Looper.java:146)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.ActivityThread.main(ActivityThread.java:5487)
09-16 06:20:43.267: E/AndroidRuntime(16106): at java.lang.reflect.Method.invokeNative(Native Method)
09-16 06:20:43.267: E/AndroidRuntime(16106): at java.lang.reflect.Method.invoke(Method.java:515)
09-16 06:20:43.267: E/AndroidRuntime(16106): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
09-16 06:20:43.267: E/AndroidRuntime(16106): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
09-16 06:20:43.267: E/AndroidRuntime(16106): at dalvik.system.NativeStart.main(Native Method)
09-16 06:20:43.267: E/AndroidRuntime(16106): Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=-1
09-16 06:20:43.267: E/AndroidRuntime(16106): at com.thegamecreators.agk_player.IAPActivity.onCreate(IAPActivity.java:20)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.Activity.performCreate(Activity.java:5451)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-16 06:20:43.267: E/AndroidRuntime(16106): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
09-16 06:20:43.267: E/AndroidRuntime(16106): ... 11 more
09-16 06:20:45.449: I/Process(16106): Sending signal. PID: 16106 SIG: 9


09-16 06:25:59.164: I/native-activity(16632): Lost Focus
09-16 06:25:59.204: D/IabHelper(16632): Launching buy intent for com.kg2entertainment.proveyourworthiness.opensensei_removeads. Request code: 10001
09-16 06:25:59.234: E/IAP Activity(16632): Started
09-16 06:25:59.264: D/AndroidRuntime(16632): Shutting down VM
09-16 06:25:59.264: W/dalvikvm(16632): threadid=1: thread exiting with uncaught exception (group=0x4173cda0)
09-16 06:25:59.274: E/AndroidRuntime(16632): FATAL EXCEPTION: main
09-16 06:25:59.274: E/AndroidRuntime(16632): Process: com.KG2Entertainment.ProveYourWorthiness, PID: 16632
09-16 06:25:59.274: E/AndroidRuntime(16632): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.KG2Entertainment.ProveYourWorthiness/com.thegamecreators.agk_player.IAPActivity}: java.lang.IllegalStateException: Can't start async operation (launchPurchaseFlow) because another async operation(launchPurchaseFlow) is in progress.
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2334)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.ActivityThread.access$900(ActivityThread.java:169)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1280)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.os.Handler.dispatchMessage(Handler.java:102)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.os.Looper.loop(Looper.java:146)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.ActivityThread.main(ActivityThread.java:5487)
09-16 06:25:59.274: E/AndroidRuntime(16632): at java.lang.reflect.Method.invokeNative(Native Method)
09-16 06:25:59.274: E/AndroidRuntime(16632): at java.lang.reflect.Method.invoke(Method.java:515)
09-16 06:25:59.274: E/AndroidRuntime(16632): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1283)
09-16 06:25:59.274: E/AndroidRuntime(16632): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)
09-16 06:25:59.274: E/AndroidRuntime(16632): at dalvik.system.NativeStart.main(Native Method)
09-16 06:25:59.274: E/AndroidRuntime(16632): Caused by: java.lang.IllegalStateException: Can't start async operation (launchPurchaseFlow) because another async operation(launchPurchaseFlow) is in progress.
09-16 06:25:59.274: E/AndroidRuntime(16632): at com.thegamecreators.agk_player.iap.IabHelper.flagStartAsync(IabHelper.java:820)
09-16 06:25:59.274: E/AndroidRuntime(16632): at com.thegamecreators.agk_player.iap.IabHelper.launchPurchaseFlow(IabHelper.java:373)
09-16 06:25:59.274: E/AndroidRuntime(16632): at com.thegamecreators.agk_player.iap.IabHelper.launchPurchaseFlow(IabHelper.java:338)
09-16 06:25:59.274: E/AndroidRuntime(16632): at com.thegamecreators.agk_player.IAPActivity.onCreate(IAPActivity.java:20)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.Activity.performCreate(Activity.java:5451)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
09-16 06:25:59.274: E/AndroidRuntime(16632): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298)
09-16 06:25:59.274: E/AndroidRuntime(16632): ... 11 more
"


Prove Your Worthiness
KG2Entertainment.com
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 17th Sep 2014 01:41
Quote: "09-16 06:20:11.823: D/IabHelper(15223): Purchase canceled - Response: 5eveloper Error"

That response usually happens when the APK hasn't been signed with the correct keystore and/or has not been uploaded to Google Play as at least alpha or beta.
Also it looks like the app should be crashing after that error, but just looking at the logCat makes it look like the purchasing activity was started up immediately after cancellation (unless you restarted the app within 2 seconds and tried again that fast). Also make sure that you have the correct IAP key from your Google Play Console for the APK copied over to the java.
If you've done all of that then double check the sequence of events in your code, make sure the inAppPurchaseActivate isn't being called repeatedly, just call it once, continue to call getInAppPurchaseState until it returns something and when it does it is safe to move on and check inAppPurchaseAvailable. Your code looks it might be calling inAppPurchaseActivate every cycle.

ThrOtherJoJo
12
Years of Service
User Offline
Joined: 24th Mar 2012
Location: California
Posted: 17th Sep 2014 11:31
Thanks alot. You have hit the nail on the head. I was definitely calling those function every loop. I need to stop the late night programming.

But anyhow, it works like charm.

Well, that closes out this project. That was the last thing I needed to work on. I will upload it to the play store some time tomorrow and start the design for another puzzle game.

Thanks again.

I will post the code in the help file for Tier 2 to help others, to start building up that help file.

Anyways. Off to bed.

Prove Your Worthiness
KG2Entertainment.com

Login to post a reply

Server time is: 2024-11-25 09:51:47
Your offset time is: 2024-11-25 09:51:47