Closed BABACHAN closed 9 years ago
Hi @BABACHAN, thank you for reporting. According to the logs GP was not detected as an installer with working billing. Do you have an opportunity to link a custom jar with extra logging? If yes, I will create you one - to get more details about your case.
Hi Anastasiia,
Yes, I can test with an custom jar if you like. Just send me one.
Kind regards, Babachan
On Fri, Jul 4, 2014 at 1:21 PM, Anastasiia Karimova < notifications@github.com> wrote:
Hi @BABACHAN https://github.com/BABACHAN, thank you for reporting. According to the logs GP was not detected as an installer with working billing. Do you have an opportunity to link a custom jar with extra logging? If yes, I will create you one - to get more details about your case.
— Reply to this email directly or view it on GitHub https://github.com/onepf/OpenIAB/issues/246#issuecomment-48032654.
Hi @BABACHAN Please chose the most appropriate one https://yadi.sk/d/F5l8zZxNVt6F6 - base https://yadi.sk/d/HC3zUQY4W6DBN - base + amazon
Filter tags are the following OpenIabHelper and IabHelper (we have different log tags for different classes). Simple Verbose filter will be the best variant.
I finally got the time to test the new base jar. And this is the logging. (PS I also tried 0.9.6.1 with no success).
I added a retry mechanism in my app. If first time does not succeed it will retry. The second attempt always succeeds.
07-28 17:14:01.605: D/OpenIabHelper(29837): package installer: null 07-28 17:14:01.605: D/OpenIabHelper(29837): options: checkInventory: true 07-28 17:14:01.605: D/OpenIabHelper(29837): options: support fortumo: false 07-28 17:14:01.605: D/OpenIabHelper(29837): options: verify mode: 0 07-28 17:14:01.605: D/OpenIabHelper(29837): options: key for store exists: com.google.play 07-28 17:14:01.605: D/OpenIabHelper(29837): in: 2 startSetup() discovered openstores: [] 07-28 17:14:03.835: D/OpenIabHelper(29837): in: 2222 0 inventory candidates 07-28 17:14:03.850: D/OpenIabHelper(29837): in: 2240 inventory check done 07-28 17:14:03.855: D/OpenIabHelper(29837): in: 2253 select equipped 07-28 17:14:03.860: D/OpenIabHelper(29837): candidate store to be checked for billing: com.google.play 07-28 17:14:03.860: D/OpenIabHelper(29837): candidate store to be checked for billing: com.nokia.nstore 07-28 17:14:03.860: D/OpenIabHelper(29837): store with unavailable billing: com.google.play 07-28 17:14:03.905: D/OpenIabHelper(29837): store with unavailable billing: com.nokia.nstore 07-28 17:14:03.905: D/OpenIabHelper(29837): in: 2299 select non-equipped 07-28 17:14:03.905: D/OpenIabHelper(29837): in: 2299 fireSetupFinished() === SETUP DONE === result: IabResult: 3, Billing isn't supported (response: 3:Billing Unavailable) 07-28 17:14:03.920: D/IabHelper(29837): IAB helper created. 07-28 17:14:03.920: D/IabHelper(29837): Disposing. 07-28 17:14:03.920: D/OpenIabHelper(29837): in: 2316 startSetup() disposing com.google.play 07-28 17:14:03.930: D/OpenIabHelper(29837): in: 2323 startSetup() disposing com.nokia.nstore 07-28 17:14:11.165: D/OpenIabHelper(29837): package installer: null 07-28 17:14:11.165: D/OpenIabHelper(29837): options: checkInventory: true 07-28 17:14:11.165: D/OpenIabHelper(29837): options: support fortumo: false 07-28 17:14:11.165: D/OpenIabHelper(29837): options: verify mode: 0 07-28 17:14:11.165: D/OpenIabHelper(29837): options: key for store exists: com.google.play 07-28 17:14:11.165: D/OpenIabHelper(29837): in: 3 startSetup() discovered openstores: [] 07-28 17:14:12.470: D/OpenIabHelper(29837): in: 1305 1 inventory candidates 07-28 17:14:12.470: D/IabHelper(29837): IAB helper created. 07-28 17:14:12.490: D/IabHelper(29837): Starting in-app billing setup. 07-28 17:14:12.515: D/IabHelper(29837): Billing service connected. 07-28 17:14:12.515: D/IabHelper(29837): Checking for in-app billing 3 support. 07-28 17:14:12.520: D/IabHelper(29837): In-app billing version 3 supported for babachan.android.dunemediacontroller 07-28 17:14:12.525: D/IabHelper(29837): Subscriptions AVAILABLE. 07-28 17:14:12.525: D/OpenIabHelper(29837): in: 1360 billing set com.google.play 07-28 17:14:12.525: D/IabHelper(29837): Querying owned items, item type: inapp 07-28 17:14:12.525: D/IabHelper(29837): Package name: babachan.android.dunemediacontroller 07-28 17:14:12.525: D/IabHelper(29837): Calling getPurchases with continuation token: null 07-28 17:14:12.535: D/IabHelper(29837): Owned items response: 0 07-28 17:14:12.535: D/IabHelper(29837): Continuation token: null 07-28 17:14:12.535: D/IabHelper(29837): Querying owned items, item type: subs 07-28 17:14:12.535: D/IabHelper(29837): Package name: babachan.android.dunemediacontroller 07-28 17:14:12.535: D/IabHelper(29837): Calling getPurchases with continuation token: null 07-28 17:14:12.540: D/IabHelper(29837): Owned items response: 0 07-28 17:14:12.540: D/IabHelper(29837): Continuation token: null 07-28 17:14:12.540: D/OpenIabHelper(29837): in: 1375 inventoryCheck() in com.google.play found: 0 purchases 07-28 17:14:12.540: D/OpenIabHelper(29837): in: 1377 inventory check done 07-28 17:14:12.540: D/OpenIabHelper(29837): in: 1377 select equipped 07-28 17:14:12.540: D/OpenIabHelper(29837): candidate store to be checked for billing: com.google.play 07-28 17:14:12.540: D/OpenIabHelper(29837): candidate store to be checked for billing: com.nokia.nstore 07-28 17:14:12.540: D/OpenIabHelper(29837): store with available billing: com.google.play 07-28 17:14:12.570: D/OpenIabHelper(29837): store with unavailable billing: com.nokia.nstore 07-28 17:14:12.570: D/OpenIabHelper(29837): version code: 55 07-28 17:14:12.570: D/OpenIabHelper(29837): we have to choose a random store from 07-28 17:14:12.575: D/OpenIabHelper(29837): candidate store: com.google.play 07-28 17:14:12.575: D/OpenIabHelper(29837): in: 1410 select non-equipped 07-28 17:14:12.575: D/OpenIabHelper(29837): Successfully initialized with non-equipped store: com.google.play 07-28 17:14:12.575: D/OpenIabHelper(29837): in: 1410 fireSetupFinished() === SETUP DONE === result: IabResult: 0, Successfully initialized with non-equipped store: com.google.play (response: 0:OK), appstore: com.google.play 07-28 17:14:12.575: D/OpenIabHelper(29837): in: 1411 startSetup() disposing com.nokia.nstore 07-28 17:14:12.575: D/OpenIabHelper(29837): Starting async operation: refresh inventory 07-28 17:14:12.580: D/IabHelper(29837): Querying owned items, item type: inapp 07-28 17:14:12.580: D/IabHelper(29837): Package name: babachan.android.dunemediacontroller 07-28 17:14:12.580: D/IabHelper(29837): Calling getPurchases with continuation token: null 07-28 17:14:12.585: D/IabHelper(29837): Owned items response: 0 07-28 17:14:12.585: D/IabHelper(29837): Continuation token: null 07-28 17:14:12.585: D/IabHelper(29837): querySkuDetails() Querying SKU details. 07-28 17:14:12.585: D/IabHelper(29837): querySkuDetails(): nothing to do because there are no SKUs. 07-28 17:14:12.585: D/IabHelper(29837): Querying owned items, item type: subs 07-28 17:14:12.585: D/IabHelper(29837): Package name: babachan.android.dunemediacontroller 07-28 17:14:12.585: D/IabHelper(29837): Calling getPurchases with continuation token: null 07-28 17:14:12.590: D/IabHelper(29837): Owned items response: 0 07-28 17:14:12.590: D/IabHelper(29837): Continuation token: null 07-28 17:14:12.590: D/IabHelper(29837): querySkuDetails() Querying SKU details. 07-28 17:14:12.590: D/IabHelper(29837): querySkuDetails(): nothing to do because there are no SKUs. 07-28 17:14:12.590: D/OpenIabHelper(29837): Ending async operation: refresh inventory
Hello, I have experiment nearly the same bug. Sometimes my games deliver a code error 3 (billing unsupported). This seems to happens after an update of the game.
Yesterday 171 players have received an error at startup. I had 1000 players per days yesterday.
It is a big issue because players must kill my game and restart.
What work arround should I use? auto restart? ask to restart? or modify my code?
To make it faster Please, write to akarimova@onepf.org and I will share my skype contact.
I have always this kind of error at startSetup. It is very annoying but I found a work arround for the moment.
I recreate openiabhlper and call the startSetup several times like this: 1/in onCreate. 2/ if failed: I recall when my opengl thread start 3/ if failed I try when user want to buy somthing 3bis/ or when user switch app.
By doing openiab works. But why I must do this? Why openiab does not works all the time at the first time?
To know what happens on real device with real users I track all events in my google analytics account.
For instance the 16th of september on my game Jetpack High: 165 new users 176 actif users 501 events in-app (176 unique event) 499 are error_startup (code 3) (175 unique event) 2 are purchase cancel
Unique event are event per session.
Then I have 176 users and all have had the startsetup error and many times (2.8 times).
For Multi Breaker: 146 actif users 262 error (91 unique event error at startup)
For Multi Breaker: 1.6 times
When the setup is ok purchase works fine. What can I do? It is very very anoying.
I do not use fortumo. I include .jar but do not add permissions and do not create any fortumo account.
Is it possible this error at startup comes from this?
Hello I've been working on a new store picking algorithm, a lot of previous logic was rewritten and quite a few bugs fixed. Current state can be found here https://github.com/onepf/OpenIAB/tree/dev Could you please try this version and tell if this bug still present. Also please mind that this version is under development, so there might be other bugs and even crashes. Please report them as well if you encounter any.
Ok, I will try the next week. I must install and configure git (I am not a user of git)
I can provide you with relevant jar if this is more convenient to you.
Yes if you can. Akarimova have my skype and mail account. (if you are in the same team)
OpenIab.jar in-app-purchasing-2.0.0.jar Second one is a dependency. It's a temporary measure, please include them both is your project. Please note that checkInventory option may not work in this particular build, I hope to fix it today.
It is not better. code error 3: no suitable appstore found
Sometimes I have this error in logcat:
09-19 14:16:36.700: D/CHAOS_ENGINE(17660): Creating IAB helper. 09-19 14:16:36.930: D/CHAOS_ENGINE(17660): Starting setup. 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): Fatal render thread error 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): java.lang.IllegalStateException: Must be called from UI thread. 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at org.onepf.oms.OpenIabHelper.finishSetup(OpenIabHelper.java:687) 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at org.onepf.oms.OpenIabHelper.finishSetup(OpenIabHelper.java:680) 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at org.onepf.oms.OpenIabHelper.finishSetup(OpenIabHelper.java:672) 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at org.onepf.oms.OpenIabHelper.startSetup(OpenIabHelper.java:384) 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at com.chaosinteractive.chaosengine.cMyActivity.setupInAppHelper(cMyActivity.java:1487) 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at com.chaosinteractive.chaosengine.cMyActivity.run(cMyActivity.java:940) 09-19 14:16:37.130: E/CHAOS_ENGINE(17660): at java.lang.Thread.run(Thread.java:864)
Have you tried installing your application with
adb install -i %store_package% /path/to/YourApp.apk
To emulate your application being installed from appstore?
You can also try to play with new option storeSearchStrategy to hint library how it should look for appropriate store.
If you know exactly what store you what to use, try instantiating it manually and passing in options via addAvailableStores()
along with SEARCH_STRATEGY_BEST_FIT
.
As for the error, as log suggests OpenIabHelper.startSetup()
must be called from UI thread.
If you only have OpenGL thread or any other, you can always pass Runnable
to be executed on UI thread like this:
new Handler(Looper.getMainLooper().getThread()).post(new Runnable(){....});
Although you should probably cache Handler object for efficiency.
I added the store search strategy and the preferred store name. Sometimes it works and somtimes not.
edit: It seems better. less error
Please specify exact options you passed to OpenIabHelper and what stores are installed on your test device. I'll try to reproduce and investigate library behavior. Also note that in this version one successful OpenIabHelper setup should be enough.
This is my setupFonction that I call in onCreate:
private void setupInAppHelper() { this.mGoogleInAppRetryCountSetup++; if(this.mGoogleInAppRetryCountSetup >= 6) return;
// Some sanity checks to see if the developer (that's you!) really followed the
// instructions to run this sample (don't put these checks on your app!)
if (GOOGLE_PUBLIC_KEY.contains("CONSTRUCT_YOUR")) {
throw new RuntimeException("Please put your app's public key in MainActivity.java. See README.");
}
// Create the helper, passing it our context and the public key to verify signatures with
Log.d(TAG, "Creating IAB helper.");
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder()
.addStoreKey(OpenIabHelper.NAME_GOOGLE, GOOGLE_PUBLIC_KEY);
if(YANDEX_PUBLIC_KEY.contains("CONSTRUCT_YOUR") == false) // on utilise YANDEX
builder.addStoreKey(OpenIabHelper.NAME_YANDEX, YANDEX_PUBLIC_KEY);
if(APPLAND_PUBLIC_KEY.contains("CONSTRUCT_YOUR") == false) // on utilise APPLAND
builder.addStoreKey(OpenIabHelper.NAME_APPLAND, APPLAND_PUBLIC_KEY);
if(SLIDEME_PUBLIC_KEY.contains("CONSTRUCT_YOUR") == false) // on utilise SLIDEME
builder.addStoreKey(OpenIabHelper.NAME_SLIDEME, SLIDEME_PUBLIC_KEY);
if(APTOIDE_PUBLIC_KEY.contains("CONSTRUCT_YOUR") == false) // on utilise APTOIDE
builder.addStoreKey(OpenIabHelper.NAME_APTOIDE, APTOIDE_PUBLIC_KEY);
//TEST
builder.setStoreSearchStrategy(OpenIabHelper.Options.SEARCH_STRATEGY_BEST_FIT);
builder.addPreferredStoreName(OpenIabHelper.NAME_GOOGLE);
mHelper = new OpenIabHelper(this, builder.build());
// enable debug logging (for a production application, you should set this to false).
//mHelper.enableDebugLogging(true);
// Start setup. This is asynchronous and the specified listener
// will be called once setup completes.
Log.d(TAG, "Starting setup.");
mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
public void onIabSetupFinished(IabResult result) {
Log.d(TAG, "Setup finished.");
if (!result.isSuccess()) {
mGoogleInAppConfigure = false;
int res = result.getResponse();
cJNILib.sendEventData("inapp", "error_startup", ""+res);
Log.e(TAG, "error setup openiab");
// Oh noes, there was a problem.
if(mGoogleInAppRetryCountSetup>= 5)
complain("Problem setting up in-app billing: " + result);
//mHelper.dispose();
mHelper = null;
return;
}
// Have we been disposed of in the meantime? If so, quit.
if (mHelper == null) return;
mGoogleInAppConfigure = true;
// IAB is fully set up. Now, let's get an inventory of stuff we own.
Log.d(TAG, "Setup successful. Querying inventory.");
mHelper.queryInventoryAsync(mGotInventoryListener);
}
});
}
I use OpenIAB in my game engine library. Then I added this library to my c++ opengl es game.
I have google and aptoide installed on my device.
Looks at this log when a setup successful occur: 09-19 15:16:41.593: D/CHAOS_ENGINE(32200): Creating IAB helper. 09-19 15:16:41.763: D/CHAOS_ENGINE(32200): Starting setup. 09-19 15:16:42.083: D/memalloc(32200): /dev/pmem: Mapped buffer base:0x635c8000 size:12431360 offset:12185600 fd:173 09-19 15:16:43.645: E/OpenIabLibrary(32200): isBillingAvailable() billing is not supported. Initialization error. 09-19 15:16:45.526: D/CHAOS_ENGINE(32200): Setup finished. 09-19 15:16:45.526: D/CHAOS_ENGINE(32200): Setup successful. Querying inventory. 09-19 15:16:45.787: D/memalloc(32200): /dev/pmem: Unmapping buffer base:0x635c8000 size:12431360 offset:12185600 09-19 15:16:46.077: D/CHAOS_ENGINE(32200): Query inventory finished. 09-19 15:16:46.077: D/CHAOS_ENGINE(32200): Query inventory was successful.
We have isBillingAvailable() billing is not supported. Initialization error.
but the setup is ok.
When the setup failed I have same line log
Edit: I am testing and the application is not signed. Is it why isBillingAvailable return false?
isBillingAvailable() billing is not supported. Initialization error.
Don't mind that, it's just a wrong log from GooglePlay wrapper.
Can you spot any pattern of when setup finishes successfully and when it's not? Can you please try adding some delay, and wait for your app to fully initialize? Maybe try calling setup from your activity onCreate()
?
I don't know what game engine you use, but I'm pretty sure you should have access to main Activity.
Library works consistent on my side, I can't reproduce unreliable behavior you describe.
I try to call the setup from different place and in my main activity. Not better. Even if I call setup only when I click on a button of my gui, after all init and setDiscoveryTimeout to 30, error occured 9/10.
I cannot found a pattern, it is completly random. :(
I use other lib (vungle, chartboost, tapjoy, facebook, admob). Can be in conflict? I have tried without init them.
Is it mandatory to have a fortumo account?
error occured 9/10
By this you mean code error 3: no suitable appstore found
right?
I cannot found a pattern, it is completly random.
Sadly nether can I.
I use other lib (vungle, chartboost, tapjoy, facebook). Can be in conflict?
I very much doubt that.
Is it mandatory to have a fortumo account?
Fortumo is disabled in that build, so it shouldn't be a factor.
Well, we're kinda stuck here at a time. Thank you very much for your help though. I'll finish new algorithm and test it the best I can by uploading our sample in different stores. Hopefully we'll work out most of the bugs and I'll get back to you at the beginning of next week.
ok, good week end, and thank you.
I'm unsure if my issue is related but I'm getting the following error:
W (18300): Problem setting up in-app billing: IabResult: 3, Billing isn't supported (response: 3:Billing Unavailable)
It has been happening for some users and I haven't been able to track down if there's a pattern. It's consistent for these users though. The only info I have on this specific case is that it's a multiple SIM phone. Would that cause it or is that irrelevant.
Edit From the user "The device is Sony Xperia Tipo Dual under Android 4.0.4."
Problem setting up in-app billing: IabResult: 3, Billing isn't supported (response: 3:Billing Unavailable)
This error occurs when library wasn't able to connect to proper store responsible for billing. However it can't indicate why that happened.
For example, you might set up library to only work with Google Play, and if someone were to install you app on a phone without Google Play, he'll get this error. Even with a proper store installed there are still some limitations. If, for some reason Google Play can't connect to user's account - it will refuse to act as a billing service.
The best way to investigate this issue is probably to ask users about Appstores installed on their devices. Moreover, current version of store picking algorithm probably has some bugs, so they might be responsible for this error. However I hope new algorithm (which is coming up soon) should fix most of this problems.
Please note, that this error still might occur due to the nature of this library. Image if I'm to install some app on a device without any Appstores, there'll be no billing to adopt and therefore this error will be a correct response to initiate billing attempt.
Are there any suggestions as a temporary workaround in my code for this? Should I retry setting up the helper a few times before assuming it just won't work?
Hi guys, could you please provide more info about you apps? it looks like not every app has this problem.
android version is app native or not
Multi Breaker and Jetpack high are 2 games using native ndk.
Android 4.4, native.
I think my issue was around a mistake I had made in setting up Android testing. I deleted my comments, as I think they are irrelevant to this. Mine is now working as far as I can tell.
You have deleted your post but I have the same behaviour with nokia logs.
My issue was based on running the app directly from android studio to my kindle, rather than doing the command line adb install recommended in the readme. If you are working with Amazon I can help you get set up though.— Sent from Mailbox
On Tue, Sep 23, 2014 at 3:33 AM, TobyKaos notifications@github.com wrote:
You have deleted your post but I have the same behaviour with nokia logs.
Reply to this email directly or view it on GitHub: https://github.com/onepf/OpenIAB/issues/246#issuecomment-56484807
I run my game from eclipse. But when I download the game from google play i have the same behaviour.
I’m testing in Google Play later today, I’ll let you know what I see.
Gavin
— Sent from Mailbox
On Tue, Sep 23, 2014 at 8:25 AM, TobyKaos notifications@github.com wrote:
I run my game from eclipse. But when I download the game from google play i have the same behaviour.
Reply to this email directly or view it on GitHub: https://github.com/onepf/OpenIAB/issues/246#issuecomment-56511672
As someone else suggested above, as a workaround should I implement a counter and keep retrying to set up the helper up to X times? Right now I only try once when the app is started.
Our team can't reproduce it :( Sure, you can retry as many times as you think is acceptable, but current OpenIabHelper allows only one startSetup, after finishing you have to dispose and initiate it again. Also, you can patch IABHelper (the base class to work with Google Play) and reconnect to the service in case of errors.
Logs (as many as possible) are welcome.
For native apps logs can be obtained using Logger.setLoggable(true)
and enable debug lever for the OpenIabLibrary
tag
I'm not sure if this is helpful but in my testing this week, for Google Play, IABHelper throws the '3' error when I install directly from Android Studio, but if I follow Google's instructions and upload to Alpha, then install onto the device from Google Play, I'm not getting the error.
The way I coded it is the helper is initialized once in a static variable when the main app activity is created. Do you see a problem with this implementation? I wasn't calling dispose when the activity is killed either so it persists until the application process is finally killed. Could that cause any issues?
Hi,
I have test this morning updating my game from google play. Then I call the startSetup in onCreate and it fail. Recall it just before opengl thread run and it succeded. If on my device I have for instance aptoide installed. Then in the log I can see that aptoide is discovered.
I've decided to change my implementation so that the OpenIabHelper is initialized and setup for each activity rather than having a global IapHelper that is shared at the application level. My question is do I need to call dispose() in onPause() or only onDestroy() of the Activity?
I'm hoping this change in implementation will resolve some issues I'm having regarding this error status "3" that we all are reporting here in this thread.
The error you get is very strange indeed. I've tried it many times, and library works consistent every time. All I can think of is that for some reason Google Play returns different results for isBillingAvailable() call. It seems that retrying startSetup() is a best workaround at a time.
I've decided to change my implementation so that the OpenIabHelper is initialized and setup for each activity rather than having a global IapHelper that is shared at the application level.
You probably better stick to one instance for whole application. However please mind that Samsung requires Activity passed as Context
for OpenIabHelper
and it presents danger for activity being leaked.
Also please feel free to try out version from dev branch. Apart from bugfixes, and new storeSearchStrategy
option I mentioned above, it allows startSetup()
on the same OpenIabHelper
object if previous attempt failed.
By cleaning manually all generated file in eclipse and rebuild my game then openiab works better.
I continue to test but results is:
1/ if i install with adb -i
It is more better. I think it is due to eclipse build. I will tell you after more test if all is ok now.
We've tried several times using honest updates from Google Play. Works without retries. We need more detailed logs:
I've added a logDebug() line below that line you mentioned and I'll get someone affected by this problem to run the app and provide the feedback.
What exactly are you wanting when you say "current package installer"
I've added a logDebug() line below that line you mentioned and I'll get someone affected by this problem to run the app and provide the feedback.
thank you!
What exactly are you wanting when you say "current package installer"
Just in case log the installer of the package to be sure that GP is the installer of your app
So just to update on this. I think I see the discrepancy as to why it looks like billing setup fails. In OpenIabHelper#checkBillingAndFinish() you call thru to AppStore#isBillingAvailable(). In that method it attempts to make a service connection to the app store which is not an instant action. The timeout is set to 2 seconds and if the app store takes longer than that to connect then it returns false which indicates to checkBillingAndFinish() that the setup failed.
What I don't understand is why the following log is always written:
Logger.e("isBillingAvailable() billing is not supported. Initialization error.");
It doesn't matter if billingAvailable is true, that line is always logged. After that method returns, the AppStore service connection is finally established and if Service#isBillingSupported() returns a valid response code (IabHelper.BILLING_RESPONSE_RESULT_OK) then billingAvailable is set to true. You do not add any logging in there to indicate to a developer that billing IS available now and there is no callback to something like onIabSetupFinished() so a developer's code can properly handle a connected app store.
I think fixing this would alleviate a lot of the issues people are having. Perhaps these service connections should be daisy chained to callback to each other so that one is attempted and then the next and so on and when all are finished trying or if one is successful THEN you do the callback to onIabSetupFinished(). As it is right now, because these service connections aren't always instant, you're incorrectly reporting back that billing is unavailable. Thoughts?
@shafty023 Thank you so much, seems like you've found the problem. I've added fix to it, after some more testing it should become available in dev brunch.
It all finally makes sense. Large applications can take quite some time to initialize, and it seems sometimes service wasn't able to connect within 2 seconds, but second try worked fine, since app was already loaded.
As for
What I don't understand is why the following log is always written
It was actually a bug, there was else {
statement missing.
Thank you again, and let's hope it's all better now.
No problem glad I could help. BTW, just changing the timeout to 4 seconds fixed the problem for me. I definitely think there should still be a timeout there but should be >= 4. I believe your code change removed the timeout on the CountDownLatch instance which could result in an undefined hang until Android decides to terminate the startService call or it finally connects.
The very first time startSetup() is called from OnCreate() in my app it returns in-app billing unsupported. And with first time I mean right after a fresh install. Any calls after that succeed.
I'm only using Google Play Store and library 0.9.6 jar.
Here is the logcat:
... 07-04 09:46:32.434: D/OpenIabHelper(13003): in: 4 startSetup() discovered openstores: [] 07-04 09:46:32.434: D/PauseHandler(13003): pause 07-04 09:46:32.434: D/GooglePlay(13003): isBillingAvailable() packageName: babachan.android.dunemediacontroller 07-04 09:46:33.799: V/webkit(13003): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {42801788} 07-04 09:46:33.819: D/dalvikvm(13003): DexOpt: --- END 'ads-1770265885.jar' (success) --- 07-04 09:46:33.819: D/dalvikvm(13003): DEX prep '/data/data/babachan.android.dunemediacontroller/cache/ads-1770265885.jar': unzip in 0ms, rewrite 2347ms 07-04 09:46:34.274: D/dalvikvm(13003): GC_FOR_ALLOC freed 356K, 15% free 15254K/17864K, paused 118ms, total 118ms 07-04 09:46:34.274: I/dalvikvm-heap(13003): Grow heap (frag case) to 20.606MB for 3686416-byte allocation 07-04 09:46:34.299: D/dalvikvm(13003): GC_CONCURRENT freed 1K, 13% free 18853K/21468K, paused 3ms+2ms, total 26ms 07-04 09:46:34.299: D/dalvikvm(13003): WAIT_FOR_CONCURRENT_GC blocked 17ms 07-04 09:46:34.299: D/dalvikvm(13003): WAIT_FOR_CONCURRENT_GC blocked 19ms 07-04 09:46:34.304: D/dalvikvm(13003): WAIT_FOR_CONCURRENT_GC blocked 24ms 07-04 09:46:34.429: E/GooglePlayServicesUtil(13003): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included. 07-04 09:46:34.544: D/AmazonAppstore(13003): hasAmazonClasses() cannot load class com.amazon.android.Kiwi 07-04 09:46:34.544: D/AmazonAppstore(13003): isPackageInstaller() sandBox: true 07-04 09:46:34.604: D/OpenIabHelper(13003): in: 2189 0 inventory candidates 07-04 09:46:34.609: D/OpenIabHelper(13003): in: 2192 inventory check done 07-04 09:46:34.609: D/OpenIabHelper(13003): in: 2192 select equipped 07-04 09:46:34.609: D/GooglePlay(13003): isBillingAvailable() packageName: babachan.android.dunemediacontroller 07-04 09:46:34.659: D/OpenIabHelper(13003): in: 2245 select non-equipped 07-04 09:46:34.659: D/OpenIabHelper(13003): in: 2245 fireSetupFinished() === SETUP DONE === result: IabResult: 3, Billing isn't supported (response: 3:Billing Unavailable) 07-04 09:46:34.659: D/IabHelper(13003): IAB helper created. 07-04 09:46:34.659: D/IabHelper(13003): Disposing. 07-04 09:46:34.659: D/OpenIabHelper(13003): in: 2246 startSetup() disposing com.google.play 07-04 09:46:34.664: D/OpenIabHelper(13003): in: 2247 startSetup() disposing com.amazon.apps 07-04 09:46:34.664: I/dalvikvm(13003): Failed resolving Lorg/onepf/oms/appstore/TStoreRequestCallback; interface 3813 'Lcom/skplanet/dodo/IapPlugin$RequestCallback;' 07-04 09:46:34.664: W/dalvikvm(13003): Link of class 'Lorg/onepf/oms/appstore/TStoreRequestCallback;' failed 07-04 09:46:34.669: E/dalvikvm(13003): Could not find class 'org.onepf.oms.appstore.TStoreRequestCallback', referenced from method org.onepf.oms.appstore.TStoreBillingService.launchPurchaseFlow 07-04 09:46:34.669: W/dalvikvm(13003): VFY: unable to resolve new-instance 4406 (Lorg/onepf/oms/appstore/TStoreRequestCallback;) in Lorg/onepf/oms/appstore/TStoreBillingService; 07-04 09:46:34.669: D/dalvikvm(13003): VFY: replacing opcode 0x22 at 0x0017 07-04 09:46:34.669: I/dalvikvm(13003): Could not find method com.skplanet.dodo.IapPlugin.getPlugin, referenced from method org.onepf.oms.appstore.TStoreBillingService.startSetup 07-04 09:46:34.669: W/dalvikvm(13003): VFY: unable to resolve static method 28072: Lcom/skplanet/dodo/IapPlugin;.getPlugin (Landroid/content/Context;)Lcom/skplanet/dodo/IapPlugin; 07-04 09:46:34.669: D/dalvikvm(13003): VFY: replacing opcode 0x71 at 0x0002 07-04 09:46:34.669: I/dalvikvm(13003): Failed resolving Lorg/onepf/oms/appstore/TStoreRequestCallback; interface 3813 'Lcom/skplanet/dodo/IapPlugin$RequestCallback;' 07-04 09:46:34.669: W/dalvikvm(13003): Link of class 'Lorg/onepf/oms/appstore/TStoreRequestCallback;' failed 07-04 09:46:34.669: D/dalvikvm(13003): DexOpt: unable to opt direct call 0x7adf at 0x1b in Lorg/onepf/oms/appstore/TStoreBillingService;.launchPurchaseFlow 07-04 09:46:34.669: D/OpenIabHelper(13003): in: 2253 startSetup() disposing com.tmobile.store 07-04 09:46:34.669: D/OpenIabHelper(13003): in: 2253 startSetup() disposing com.nokia.nstore 07-04 09:46:37.224: D/dalvikvm(13003): GC_FOR_ALLOC freed 4374K, 31% free 15319K/21956K, paused 40ms, total 40ms ...