本文介绍了应用内结算v3-BILLING_RESPONSE_RESULT_DEVELOPER_ERROR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将我的应用放入应用帐单v3.

I try to put in my app In app billing v3.

我关注了: http://developer.android.com/google/play /billing/billing_integrate.html

我将我的应用上传到develepors控制台3天,并设置了应用产品.

I uploaded my app to develepors console 3 days and set in app product.

我放入了我的Base64编码的RSA公钥和我的应用内商品ID.

i put my Base64-encoded RSA public key and my in app product id.

当我开始购买时,出现错误信息.当我通过google检查我的RESPONSE_CODE 5时

When i start the purchase i get error message. When i check my RESPONSE_CODE its 5 and by google

应用内结算参考( http://developer. android.com/google/play/billing/billing_reference.html#billing-codes )

似乎我的应用程序设置有问题.

Its seems that i have problem with my app set up.

当我尝试使用像android.test.purchased这样的Google测试ID时,我会得到很好的结果.

When i try google test id like android.test.purchased i get good results.

这是我的代码,也许我在这里做错了:

this is my code, maybe im doing something wrong here:

some_id is my test in app product id.


protected void onCreate(Bundle savedInstanceState) {

..
..
..
Helper = new IabHelper(this, base64EncodedPublicKey);

         mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
               public void onIabSetupFinished(IabResult result) {
                  if (!result.isSuccess()) {                  
                     Toast.makeText(getApplicationContext(), "connection bad",Toast.LENGTH_SHORT).show();           
                  }
                     Toast.makeText(getApplicationContext(), "connection good",Toast.LENGTH_SHORT).show();
               }
            });

          mServiceConn = new ServiceConnection() {


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

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

          bindService(new 
                    Intent("com.android.vending.billing.InAppBillingService.BIND"),
                            mServiceConn, Context.BIND_AUTO_CREATE);

...
...
..

我的购买代码:

IabHelper.QueryInventoryFinishedListener 
       mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
       public void onQueryInventoryFinished(IabResult result, Inventory inventory)   
       {
          if (result.isFailure()) {
             // handle error
             return;
           }

           String applePrice =
              inventory.getSkuDetails("some_id").getPrice();


           // update the UI 
       }
    };

    ArrayList<String> skuList = new ArrayList<String>();
    skuList.add("some_id");
    Bundle querySkus = new Bundle();
    querySkus.putStringArrayList("ITEM_ID_LIST", skuList);

    Bundle skuDetails = new Bundle();
    try {
        skuDetails = mService.getSkuDetails(3, getPackageName(), "inapp", querySkus);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    String sku = "some_id";
    Bundle buyIntentBundle = new Bundle();

    try {
        buyIntentBundle = mService.getBuyIntent(3, getPackageName(), sku, "inapp", "j");
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


    PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");

    try {
        startIntentSenderForResult(pendingIntent.getIntentSender(),1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0));
    } catch (SendIntentException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    try {
        Bundle ownedItems = mService.getPurchases(3, getPackageName(), "inapp", null);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

推荐答案

您不能使用开发者帐户来测试In App Billing.那是因为你不能从自己身上得到任何东西.您必须创建另一个帐户,并在开发人员控制台中为其赋予测试人员特权(但前提是您尚未发布应用程序-接受应用程序开发人员的任何人都可以购买应用程序).另外请注意,必须在开发者控制台中激活购买.

You can't use developer account to test In App Billing. That's because you can't by anything from yourself. You must create another account and give it tester privileges in developer console (but only if you haven't published application yet - anyone accept of app developer can make in app purchases). Also note that purchases must be activated in developer console.

查看设置测试购买部分(无法使此链接引用该部分本身,因此请手动滚动到该部分.)

Check out Setting Up for Test Purchases section (can't make this link refer to the section itself, so scroll to it manually).

P.S.还要注意,测试者帐户必须是系统中的主帐户,例如您在硬重置后首先设置的帐户.原因即使您正在使用其他帐户登录,也只能对主帐户进行购买.但是您可以测试一下,也许在过去的几个月中有所改变.

P.S. Also note that tester account must be main account in the system - the one you set first after hard reset for example. Cause even if you are logging into play with another account purchases can be done only for the main account. But you can test this, maybe something changed for a past few months.

这篇关于应用内结算v3-BILLING_RESPONSE_RESULT_DEVELOPER_ERROR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 18:34