-
Notifications
You must be signed in to change notification settings - Fork 171
Problems with offline mode #469
Comments
I turned logging on (I checked , I'm using 0.9.8.6) and removed the App from the backup/restore process to see if it was the cause of the weird behavior. 03-28 10:23:37.890 4308-4308/? I/org.lakedaemon﹕ setup success Next, I'm going to build a custom openIAB lib, with more debug print statements to try to understand what happens here.... |
I rebooted in offline mode and could use the app for a long while in premium mode Apparently, the issu happens when I have the 3 following items
-> My best bet would be that openIAB is doing some caching or sets a static variable and something gets wrong with the configuration change/activity destroyed (maybee because of my code or not : the helper gets destroyed in on Detach and another one gets created the next time in onAttach) and that cache/variable then prevents googlePlay (in offline mode) to tell the App that it has made the purchase |
Silly me, I always forget that when logging is set to true, you have to filter for OpenIAB. 03-28 12:51:08.045 8677-8677/? D/OpenIAB﹕ setupWithStrategy() store search strategy = 2 |
Ok... in my experiments, the bundle I get when openIAB queries Google play for inventory doesn't have the key RESPONSE_GET_SKU_DETAILS_LIST and looks empty. -> issue not with my code, nor with openIAB but looks in Google code : This is not how it should be. Something is really wrong here. |
Ok, more research. This is definately not an openIAB issue (nor in my code). After some research, I found that some people had the same issue, see here https://plus.google.com/104159232075086758727/posts That led me to stack overflow : I found that in my case after initially having a connection and then testing in airplane mode works. Whereas before it wasn't for me. I did find that after a long time has passed that I'm not able to query for the items. I think that's the way it's designed but haven't been able to confirm. Also after the reboot I seem to lose the item. Cannot find any other documentation talking on this. Their explanation makes sense : after a reboot in offline mode, google play can't query the server for an inventory. It may have the list of purchases from the user saved locally. But then, I'll experiment and see if I can make it work... |
Ok, so the solution was just to call helper.queryInventoryAsync(false, mGotInventoryListener) instead of helper?.queryInventoryAsync(mGotInventoryListener) like the wiki page/documentation suggested It just took me 11 hours to figure out.... :/ Could someone please update the openIAB documentation and close the issue, please ? |
Looks like the issue comes from Google. I'm not sure you solution (not querying sku details) is the best here. What you should probably do - cache user purchases locally (SharedPreferences is probably the easiest way) and use this value if inventory request fails.
@akarimova Can you please document this Google behavior? P.S. thanks for writing such detailed messages. |
You may be right about daily price changes, it would make sense. Also, thanks for the suggestion. Yet, I would rather avoid caching results in my app if I can because it can quickly become a major headache, with different appStore practices, people able to ask for refound sometimes 15 days after a purchase, people clearing the app data or deinstalling and installing the app again... I would rather delegate the license check/purchase check to the appStores. Also, I'm not that interested in the sku details (price and all). But I really need to know quite reliably if a particular sku has been bought or not. So that solution migt be enough for my use case. I'll test some more to see if it is. |
I have been using openIAB for a while now and implemented it through fragments
lots users have made purchases through Google play
some through Amazon
It works quite well
Yet, 3 of my users have reported that it doesn't work so great in offline mode.
Luckily I'm able to reproduce the issue they have on my phone :
Basically, after a reboot in offline mode, the purchase is recognized and I can use the app in premium mode a while yet if I change the screen orientation or if I exit the app and reenter it, the purchase is not recognized anymore, I gor an error code 6 (error refreshing inventory (querying prices of items))
This lasts till I go out of offline mode... then the purchase is recognized instantly and all goes well
This is quite a big problem for my app, because when it goes from free to premium or from premium to free, (which is supposed to happen only once, when a purchase is made) there is a lot of computation and wait for the user (30s) because the data cached on disk has to be processed and changed...
And also, if premium features aren't recognized, these calculation happen at each app start :/
This makes it quire horrible to use (and I get some bad reviews)
I think that the issue might come from 3 places :
I'm using openIAB 0.9.8.6+
Here is my fragment (kotlin code, versy similar to java)
and I have this in my activity :
The text was updated successfully, but these errors were encountered: