Inapp帐单responseList为空

Inapp帐单responseList为空

本文介绍了Android Inapp帐单responseList为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的应用程序中定义了一些应用程序产品.我已将APK上传到Google Play,并在Google Play中添加了inapp购买产品.

I have defined some in app products in my app. I've uploaded the apk to the Google Play and added the inapp purchase products on the Google play.

我的ServiceConnection定义如下:

ServiceConnection mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            mService = null;
        }

        @Override
        public void onServiceConnected(ComponentName name, IBinder service) {
            mService = IInAppBillingService.Stub.asInterface(service);
            connect();
        }
    };

调用onServiceConnected函数,bindService返回true.

The onServiceConnected function is called, the bindService returns true.

接下来是connect函数.

public void connect() {
        new Thread(new Runnable() {
            public void run() {
                try {

                    // Purchase type is "inapp", as required by  API v3
                    Bundle skuDetails = mService.getSkuDetails(3, PACKET, "inapp", querySkus);

                    }

                    int response = skuDetails.getInt("RESPONSE_CODE");

                    Log.e("IAP connect", response + "");


                    if (response == 0) {
                        ArrayList<String> responseList = skuDetails.getStringArrayList("DETAILS_LIST");
                        Log.e("size list", responseList.size()+"");
                        ...
                      }
                    }
            } catch (RemoteException e) {
                e.printStackTrace();
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }).start();
}

此处的PACKET设置为getPackageName().响应代码为0,但日志显示列表的大小为0.我不知道为什么列表为空,因为我向Google Play输入了总共5个项目,并且每个项目都处于活动状态.我已经等了2天,并用3台设备进行了测试,但是仍然没有任何物品通过.

PACKET here is set to the getPackageName().The response code is 0 but the Log prints that the size of the list is 0. I have no idea why the list is empty, as I have entered 5 items in total to the Google Play and each of them are active. I have waited 2 days now and tested with three devices, but still no items get through.

我几乎想尽了一切,因此欢迎提出任何建议.

I pretty much tried everything I can think of so any suggestions are welcome.

推荐答案

您需要将应用程序发布到Beta/Alpha,才能使用inapp计费功能.最近发生了变化,但他们没有宣布:)

You need to publish your application to Beta/Alpha to access inapp billing functionality.It has recenty changed, but they did not announce it:)

http://developer.android.com/google/play/billing/billing_testing.html#draft_apps

值得一提的是,您不必上载每个新版本就可以对其进行测试.只需使用相同的versionCode和versionName,并且在应用程序发布后就可以使用.

It is worth to mention that you don't have to upload every new build to be able to test it. Just use the same versionCode and versionName, and it will work if the app is published.

这篇关于Android Inapp帐单responseList为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 02:04