Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

google analytics - Not being able to establish connection for In app billing in android

I am trying to integrate In app billing v3 in my app. I call the following function to initialize.

public static void SetupInappBilling()
{
    mHelper = new IabHelper(context, base64EncodedPublicKey);
    mHelper.enableDebugLogging(true);
    mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() 
    {
        public void onIabSetupFinished(IabResult result) 
        {
            if (result.isSuccess())
            {
                Log.e("tag", "connected");
                ConnectionEstablished = true;

            } 
            else
            {
                    Log.e("tag", "not connected");

                    ConnectionEstablished = false;
                }
            }
        });
    }

but i dont get call back in OnIabSetupFinishedListener Can anyone tell me how to fix this issue

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As discussed, the example IabHelper implementation ignores the return value of the bindService() call.

bindService() returns false if it cannot bind to the Service. In this case, no callbacks will ever get called. In this respect, the return value of bindService() is essential for the program logic and should never be ignored; the example application is not exactly perfect here.

If I recall this correctly, conditions where binding to the IAB V3 will not work are:

  • Only IAB V2 is available (it uses a different class name)
  • Google Play is not fully set up

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...