开发者

Android In APP billing not firing event in my class

开发者 https://www.devze.com 2023-03-25 07:52 出处:网络
I am using the \'Dungeon\' example as a basis for my code, so it is the standard examplecode for now.

I am using the 'Dungeon' example as a basis for my code, so it is the standard examplecode for now.

I can call the Market place and successfully place an order. Within BillingReciever the event public void onReceive is called twice, as I would expect and I can put a breakpoint there and see the result which is fine.

checkResponseCode gets called too and starts

    Intent intent = new Intent(Consts.ACTION_RESPONSE_CODE);
    intent.setClass(context, BillingService.class);
    intent.putExtra(Consts.INAPP_REQUEST_ID, requestId);
    intent.putExtra(Consts.INAPP_RESPONSE_CODE, responseCodeIndex);
    context.startService(intent);

And there the execution stops, and my app returns to a run state.

I hav开发者_Go百科e an extended PurchaseObserver class which is supposed to respond to billing changes, which I have tried starting two different ways

mPurchaseObserver = new iPurchaseObserver(this,mHandler);

private class iPurchaseObserver extends PurchaseObserver {
            public iPurchaseObserver(UpgradeActivity upgradeActivity, Handler handler) {
                super(upgradeActivity, handler);
            }

And

mPurchaseObserver = new iPurchaseObserver(mHandler);

private class iPurchaseObserver extends PurchaseObserver {
            public iPurchaseObserver( Handler handler) {
                super(upgradeActivity.this, handler);
            }

None of the events/methods within the PurchaseObserver are fired, i.e onPurchaseStateChange.

I am suspecting it is the Activity Context I am passing or using when constructing my PurchaseObserver, but I am not sure, and advise would be appreciated!

Thanks


Found it, after loads and loads of wasted time. I had put the classes in a folder, when I moved them back to the root, they worked.

0

精彩评论

暂无评论...
验证码 换一张
取 消