Google Store IAP and Jenkins

I am getting this error from the android device.

I/Corona &nbsp;(11786): HERE1 I/Corona &nbsp;(11786): Runtime error I/Corona &nbsp;(11786): ?:0: attempt to call field 'isActive' (a boolean value) I/Corona &nbsp;(11786): stack traceback: I/Corona &nbsp;(11786): &nbsp; &nbsp; &nbsp;?: in function '?' I/Corona &nbsp;(11786): &nbsp; &nbsp; &nbsp;?: in function 'listener' I/Corona &nbsp;(11786): &nbsp; &nbsp; &nbsp;/Users/jenkins/slaveroot/workspace/Templates/label/andro id/subrepos/timer/timer.lua:173: in function 'method' I/Corona &nbsp;(11786): &nbsp; &nbsp; &nbsp;/Users/jenkins/slaveroot/workspace/Templates/label/andro id/platform/resources/init.lua:253: in function \</Users/jenkins/slaveroot/worksp ace/Templates/label/android/platform/resources/init.lua:221\> \<dead\>

This is the line in my code at which the above happens.

&nbsp; &nbsp; &nbsp; &nbsp; print ("HERE1") &nbsp; &nbsp; &nbsp; &nbsp; local storeOn = G.store.isActive() &nbsp; &nbsp; &nbsp; &nbsp; print ("HERE2")

Anyone got any ideas?

the store.canMakePurchases() call causes similar behaviour.

Hi @prographodeveloper,

Please provide more details on this report. We don’t know much about how you’ve included the plugin, where you call it, what you name the variable, etc. In other words, it could be any number of issues but your provided code does not tell the complete story.

Best regards,

Brent

Tricky. It works (ie. returns FALSE as expected) if i put in a bad license key, or don’t supply a license key. The problem seems to be if there is valid license key and there is a store setup and it is valid, but is not a live store. 

another small thing.

store.consumePurchase( { “product1”, “product2” }, listener )

In this case, listener can be a unique callback function to handle the consumption, or it can simply be your main transaction listener. In either case, the value of event.transaction.state will be consumed. There are no callbacks for invalid products.

Even when a listener is specified - it still calls the main transaction listener.

Why do you have the line:

 local storeOn = G.store.isActive()

Normally one just uses store.isActive(). The above would make it seem like you’ve set another module to contain the store module, which isn’t really the normal method. Can you post your entire store logic so that we can evaluate where the problem might be?

it’s just a module for globals, you know, like G = {}

yea, well i tried to make a cut down version, without my license key - but that worked as expected. I will make one with a valid store key, once i get the chance.

To confirm, I just put together two separate apps with IAP and utilizing the store.isActive() call successfully, so I don’t think it’s Corona’s implementation causing the problem.

I’ve never had luck setting the store.* api to be part of global variables. I’d suggest either calling it globally, normally, from within main.lua, or directly from whichever module handles your “purchase” logic.

Can you show your store initialization code including your require code?

local store = require( “plugin.google.iap.v3” )

local someFunc = function() print(“Tran”) end

print (“HERE1”)

store.init( “google”, someFunc )

print (“HERE2”)

local storeOn = false

if store then

    storeOn = store.isActive()

end

print “HERE3”

if storeOn then print (“TRUE”) else print (“FALSE”) end

isActive is a boolean not a function.

same for canMakePurchases

the store.canMakePurchases() call causes similar behaviour.

Hi @prographodeveloper,

Please provide more details on this report. We don’t know much about how you’ve included the plugin, where you call it, what you name the variable, etc. In other words, it could be any number of issues but your provided code does not tell the complete story.

Best regards,

Brent

Tricky. It works (ie. returns FALSE as expected) if i put in a bad license key, or don’t supply a license key. The problem seems to be if there is valid license key and there is a store setup and it is valid, but is not a live store. 

another small thing.

store.consumePurchase( { “product1”, “product2” }, listener )

In this case, listener can be a unique callback function to handle the consumption, or it can simply be your main transaction listener. In either case, the value of event.transaction.state will be consumed. There are no callbacks for invalid products.

Even when a listener is specified - it still calls the main transaction listener.

Why do you have the line:

 local storeOn = G.store.isActive()

Normally one just uses store.isActive(). The above would make it seem like you’ve set another module to contain the store module, which isn’t really the normal method. Can you post your entire store logic so that we can evaluate where the problem might be?

it’s just a module for globals, you know, like G = {}

yea, well i tried to make a cut down version, without my license key - but that worked as expected. I will make one with a valid store key, once i get the chance.

To confirm, I just put together two separate apps with IAP and utilizing the store.isActive() call successfully, so I don’t think it’s Corona’s implementation causing the problem.

I’ve never had luck setting the store.* api to be part of global variables. I’d suggest either calling it globally, normally, from within main.lua, or directly from whichever module handles your “purchase” logic.

Can you show your store initialization code including your require code?