Is it possible to fail elegantly for Android iAP when not logged in?

Using Google iAPv3 plugin.

If I log out of the Google account on my Android phone, and then attempt an IAP within my app, right now it’s an ‘ugly’ fail in that I’m not able to alert the user that anything is wrong

In adb logcat I do get messages indicating the fact that there’s no account logged in:

W/Finsky  (31497): [23843] InAppBillingUtils.getPreferredAccount: com.flashysubstance.flowbenmusic: No account found.

W/Finsky  (31497): [23843] InAppBillingService.checkBillingEnabled: Billing unavailable for this package and user.

When I call store.purchase() later on, the storeTransaction callback doesn’t fire or fail…instead, I just get a message in the logcat saying " Please call init before trying to purchase products."

The thing is, I definitely already called init, it just thinks I haven’t because no account was active on the device.  

Since store.init() doesn’t seem to return a value for success/failure, is there any way to elegantly handle this? 

Can you file a bug report on this please?  Make sure to include a build.settings and config.lua along with a minimal project that has this issue.

Thanks

Rob

Can you file a bug report on this please?  Make sure to include a build.settings and config.lua along with a minimal project that has this issue.

Thanks

Rob

Hey,

Any update on this issue? When there is no active google account on device, store.init() fails silently and when you call store.purchase() you get " Please call init before trying to purchase products." on adb log output.

Is there a way to detect if purchasing is possible on device?

deniz.

Ah my bad, there is already a solution in store api. You should call store.isActive to test if store.init is called or succeeded (ie. there is an active Google Play account on device). Also store.canMakePurchases() should be called to test if purchases are enabled (not restricted) on the device.

Thanks Deniz!  I hadn’t gotten around to addressing it and glad to know there’s a workaround 

Hey,

Any update on this issue? When there is no active google account on device, store.init() fails silently and when you call store.purchase() you get " Please call init before trying to purchase products." on adb log output.

Is there a way to detect if purchasing is possible on device?

deniz.

Ah my bad, there is already a solution in store api. You should call store.isActive to test if store.init is called or succeeded (ie. there is an active Google Play account on device). Also store.canMakePurchases() should be called to test if purchases are enabled (not restricted) on the device.

Thanks Deniz!  I hadn’t gotten around to addressing it and glad to know there’s a workaround