onyxbits / raccoon4

APK Downloader for Google Play
https://raccoon.onyxbits.de
Apache License 2.0
644 stars 90 forks source link

api.purchaseAndDeliver sometimes fails with `GooglePlayException: Your device is not compatible with this item` #76

Open paulo-raca opened 4 years ago

paulo-raca commented 4 years ago

I've copied the core logic from AppDownloadWorker in my own tool. However, a few downloads fail with GooglePlayException: Your device is not compatible with this item.

As far as I can tell, this only happened sometimes, and only when downloading com.android.chrome.

Interestingly, api.delivery() seems to works every time, without issues.

My hacky code currently looks like this:

int offerType = appDetails.getOffer(0).getOfferType();
boolean paid = appDetails.getOffer(0).getCheckoutFlowRequired();

DownloadData download;
if (paid) {
    download = api.delivery(packageName, (int)downloadVersionCode, offerType);
} else {
    try {
        download = api.purchaseAndDeliver(packageName, (int) downloadVersionCode, offerType);
    } catch (GooglePlayException e) {
        // FIXME: Sometimes api.purchaseAndDeliver fails with "GooglePlayException: Your device is not compatible with this item."
        // However api.delivery() works without problems
        download = api.delivery(packageName, (int)downloadVersionCode, offerType);
    }
}

However I have no idea what I am doing. Ideas?