Closed oilushin closed 6 years ago
@oilushin , @yeriomin I catch the problem at last week also, refer to a python api, you can change User-Agent , Android-Finsky/4.4.3 (api=3,versionCode=8016014,sdk=23,device=hammerhead,hardware=hammerhead,product=hammerhead)" , use this user-agent can purchase app, not change other.
Solved. I captured real android device while downloading an apk. It issues "purchase" request, returning empty downloadUrl, and then "delivery" request which returns correct downloadUrl. So, "purchase" no longer works, need to use "delivery" instead.
@oilushin @shamolvshu Depending on the device, purchase
might still be required. On newer devices it isn't.
To make sure your code works for every device, you should first make a purchase
, check if it contains the download link, and if it doesn't, make a delivery
.
An example:
GooglePlayAPI api = // initialization
String packageName = "com.publisher.someapp";
int versionCode = 111;
BuyResponse buyResponse = api.purchase(packageName, versionCode, 1);
if (buyResponse.hasPurchaseStatusResponse()
&& buyResponse.getPurchaseStatusResponse().hasAppDeliveryData()
&& buyResponse.getPurchaseStatusResponse().getAppDeliveryData().hasDownloadUrl()
) {
// success - we have a download url
}
if (!buyResponse.hasDownloadToken()) {
// if no download url is returned, lets check for the download token
}
DeliveryResponse deliveryResponse = api.delivery(
packageName,
versionCode,
1,
buyResponse.getDownloadToken()
);
if (deliveryResponse.hasAppDeliveryData()
&& deliveryResponse.getAppDeliveryData().hasDownloadUrl()
) {
// success
}
Recently purchase request stopped working. The buyResponse.purchaseStatusResponse.appDeliveryData contains empty downloadUrl and downloadAuthCookie. (purchaseResponse.status is zero)
Details request still works - I get the version code etc.
I tried several google accounts (including one from real device and gsfid). This worked for me before and stopped working few days ago.
Can you please verify this? Thanks!