How do I check if user has product (IAP android)?

Get help using Construct 2

Post » Thu Nov 12, 2015 1:56 pm

Hi, I'm using Cranberry's Cordova IAP plugin for c2 and intel xdk, and it all works fine except for when I restart the app. Then the "has product" doesn't seem to work. I have it to request store listing when the layout starts and when store listing has succeeded, then it checks if the user has product ID, if the user does, an ad doesn't show. And if the user doesn't have the product, the ad shows up.

It works fine when I purchase the product but the second I restart the app, it shows me the ads. And when I try to purchase it again, it says I already have the product. Have I done something wrong or is the plugin broken? Anyone else that has this issue and found a solution?

Picture of my current event in the main menu:
Image
Last edited by condolent on Thu Nov 12, 2015 2:31 pm, edited 3 times in total.
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Thu Nov 12, 2015 2:05 pm

I'm not sure how the product works, and how it checks if the purchase is true, but a simple workaround it would seem, would be to save a variable to localstorage at the time "has product" is true..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 12, 2015 2:23 pm

LittleStain wrote:I'm not sure how the product works, and how it checks if the purchase is true, but a simple workaround it would seem, would be to save a variable to localstorage at the time "has product" is true..


Yeah that's kind of my last resort, only problem with that is that it's really easy to change the file to set it to true and get rid of ads without purchasing it.
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Thu Nov 12, 2015 2:29 pm

Added a screenshot of the events in my first post
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Thu Nov 12, 2015 2:50 pm

Maybe you could check if your event and your else event work..
Using two textobjects and set text would make this clear..

Also I guessed you wanted to show the add unless the user had product..
So why not show the add (not using the else) and hide it if user has product..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Nov 12, 2015 2:58 pm

LittleStain wrote:Maybe you could check if your event and your else event work..
Using two textobjects and set text would make this clear..

Also I guessed you wanted to show the add unless the user had product..
So why not show the add (not using the else) and hide it if user has product..


Already done that.
I have a button that I can click that gives a popup message checking if I have the product. After I purchased it, it's fine and all. No ads, it says I have the product etc.
But when I restart, the popup says that I don't have the product and ads are back.

Might as well do it this way. If I don't; then ads will pop out, and then when it's loaded all the products, they will disappear. It'll just look nasty
Website Twitter Indie Developer
B
20
S
6
G
4
Posts: 206
Reputation: 2,954

Post » Thu Nov 12, 2015 3:01 pm

Seems like the issue is with the checking of the store by the plugin..
You might want to contact the creator of the plugin about that..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 52 guests