onIabPurchaseFinished从来没有所谓。 [英] onIabPurchaseFinished never called.

查看:297
本文介绍了onIabPurchaseFinished从来没有所谓。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图建立在应用内计费我的第一个应用程序,并一直在使用android.test.purchased SKU都。购买才能通过,而我设法让SKU进入我的库存,但是,正如标题所说,onIabPurchaseFinished,永远不会被调用。

我认为它可能有一些做与此日志:无法保存该视图具有焦点,因为细致地查看com.android.internal.policy.impl.PhoneWindow$DecorView@406743d0没有身份证。弹出,前右要去谷歌播放。我真的不知道这意味着什么,但...

下水报价:

  mHelper.launchPurchaseFlow(这一点,SKU,10001,mPurchaseFinishedListener,);
 

和监听器:

  IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener =新IabHelper.OnIabPurchaseFinishedListener(){

    @覆盖
    公共无效onIabPurchaseFinished(IabResult结果,购买信息){
        的System.out.println(收购完成听到了);

        如果(result.isFailure()){
             Log.d(TAG,错误采购:+结果);
             返回;
        } 其他{
                Log.d(TAG,成功!);
             }


    }
};
 

解决方案

尝试添加这调用活动 mHelper.launchPurchaseFlow(..)

  @覆盖
保护无效onActivityResult(INT申请code,INT结果code,意图数据){
    Log.d(TAG,onActivityResult(+请求code +,+结果code +,+数据);

    //传递活动结果的帮手处理
    如果(!mHelper.handleActivityResult(要求code,因此code,数据)){
        //没有处理,因此处理它自己(在这里就是你会
        //执行不相关的活动结果的任何处理在应用程序
        //结算...
        super.onActivityResult(要求code,因此code,数据);
    }
    其他 {
        Log.d(TAG,onActivityResult由IABUtil处理。);
    }
}
 

I've been trying to set up in-app billing for my first app, and have been using the android.test.purchased sku. The purchase come through, and I manage to get the SKU into my inventory, but, as the title says, onIabPurchaseFinished, is never called.

I think it may have something to do with this Log: "Couldn't save which view has focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@406743d0 has no id". That pops up, right before going of to Google Play. I'm not really sure what that means though...

Launching purchase:

mHelper.launchPurchaseFlow(this, sku, 10001, mPurchaseFinishedListener, "");

And the Listener:

IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {

    @Override
    public void onIabPurchaseFinished(IabResult result, Purchase info) {
        System.out.println("Purchase Finish heard something");

        if (result.isFailure()) {
             Log.d(TAG, "Error purchasing: " + result);
             return;
        } else{
                Log.d(TAG,"Success!");
             }


    }
};

解决方案

Try adding this to the Activity that calls mHelper.launchPurchaseFlow(..):

    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    Log.d(TAG, "onActivityResult(" + requestCode + "," + resultCode + "," + data);

    // Pass on the activity result to the helper for handling
    if (!mHelper.handleActivityResult(requestCode, resultCode, data)) {
        // not handled, so handle it ourselves (here's where you'd
        // perform any handling of activity results not related to in-app
        // billing...
        super.onActivityResult(requestCode, resultCode, data);
    }
    else {
        Log.d(TAG, "onActivityResult handled by IABUtil.");
    }
}

这篇关于onIabPurchaseFinished从来没有所谓。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆