In-App Billing test: android.test.purchased already owned

后端 未结 16 1393
情深已故
情深已故 2020-12-07 08:09

I am currently testing In-App Billing for a future app, and after I successfully \"bought\" the test item \"android.test.purchased\" the first time, I now receive the respon

16条回答
  •  萌比男神i
    2020-12-07 08:42

    This is how we can consume the Item

     consume.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Thread t = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        String purchaseToken = "inapp:" + getPackageName() + ":android.test.purchased";
                        try {
                            Log.d("","Running");
                            int response = mService.consumePurchase(3, getPackageName(), purchaseToken);
                            if(response==0)
                            {
                                Log.d("Consumed","Consumed");
                            }else {
                                Log.d("","No"+response);
                            }
                        }catch (RemoteException e)
                        {
                            Log.d("Errorr",""+e);
                        }
    
                    }
                });
                t.start();
            }
        });
    

提交回复
热议问题