In-app billingservice onServiceConnected() not called on 4.0/ICS

*爱你&永不变心* 提交于 2019-12-11 06:57:43

问题


My app has a single in-app purchase, and is modeled after the Dungeons sample that Google provides (viewable at http://code.google.com/p/marketbilling/source/browse/). The only difference is that the code to restore transactions on the first run has been separated out and placed in my app's main activity. (My modified "Dungeons" activity is where the user goes to purchase the plugin)

The restoreTransactions() code in my main activity's onCreate() works great on both a 2.3 and 1.6 test device:

    if (!initialized) 
    {
        BillingService mBillingService = new BillingService();
        mBillingService.setContext(this);

        if (mBillingService.checkBillingSupported()) 
        {
            mBillingService.restoreTransactions();
        }

        mBillingService.unbind();
    }

However on a wifi-Xoom running 4.0.4, it seems to plow right through it without actually doing anything, until I open up my "Dungeons" activity, at which point everything which was supposed to happen in the main activity, happens (almost like it queues everything up but waits for something in "Dungeons" before actually acting on it).

Digging deeper I can see that onServiceConnected() in BillingService.java is never called on the Xoom until I open my "Dungeons" activity, whereas it's called just fine on 2.3 & 1.6 without opening the same activity.

Has something changed in 4.x that is preventing this from working the way it does on earlier versions?

来源:https://stackoverflow.com/questions/10255735/in-app-billingservice-onserviceconnected-not-called-on-4-0-ics

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!