Android app update, getpurchases () returns nothing

I have an app published on Google Play with In-App Billing features, everything works fine until I upload the new version to the developer console.

If I download the updated google apk servers, it seems to have forgotten about the purchases I made.

If I don't update, everything works fine, Google returns the package with all the purchases I made, what's going on here?

//Service to establish a connection with google play
    mServiceConn = new ServiceConnection() {
        @Override
        public void onServiceDisconnected(ComponentName name) {
            mService = null;
        }

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

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

//AsyncTask to check if Pro Version is purchased
class checkProVersion extends AsyncTask<Void, Void, Void> {

    @Override
    protected Void doInBackground(Void... params) {

        Bundle proBundle = new Bundle();

        try {
            proBundle = mService.getPurchases(3, getPackageName(), "inapp", null);
        } catch (RemoteException e) {
            e.printStackTrace();
        }

        int response = proBundle.getInt("RESPONSE_CODE");
        if (response == 0) {
            ArrayList<String> ownedSkus = proBundle.getStringArrayList("INAPP_PURCHASE_ITEM_LIST");
            ArrayList<String> purchaseDataList = proBundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST");
            ArrayList<String> signatureList = proBundle.getStringArrayList("INAPP_DATA_SIGNATURE_LIST");

            if (purchaseDataList.size() > 0) {
                for (int i = 0; i < purchaseDataList.size(); i++) {
                    String purchaseData = purchaseDataList.get(i);
                    String signature = signatureList.get(i);
                    String sku = ownedSkus.get(i);

                    if (verifyPurchase(buildPublicKey(), purchaseData, signature)) {
                        if(sku.equals("name_of_the_sku")) {
                            buy_pro_btn.setVisibility(View.GONE);
                        }
                    }
                }
            }
        }

        return null;
    }
}

      

When I update my application PurchaseDataList.size () returns 0.

Thank!!

+3


source to share





All Articles