From 0aa9ceb29f1207bc0f0bf525763173b76d317634 Mon Sep 17 00:00:00 2001 From: patrick Date: Thu, 7 Sep 2017 19:24:59 +0200 Subject: [PATCH] REMOTE: adjust to a protocol change: the purchase endpoint no longer provides the download urls, but still needs to be called to add the app to the list of deliverables --- .../java/com/akdeniz/googleplaycrawler/GooglePlayAPI.java | 5 +++++ .../java/de/onyxbits/raccoon/gplay/AppDownloadWorker.java | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/akdeniz/googleplaycrawler/GooglePlayAPI.java b/src/main/java/com/akdeniz/googleplaycrawler/GooglePlayAPI.java index 25f5f8e..c947aaf 100644 --- a/src/main/java/com/akdeniz/googleplaycrawler/GooglePlayAPI.java +++ b/src/main/java/com/akdeniz/googleplaycrawler/GooglePlayAPI.java @@ -434,6 +434,11 @@ public DownloadData delivery(String packageName, int versionCode, int offerType) .getAppDeliveryData(); return new DownloadData(this, appDeliveryData); } + + public DownloadData purchaseAndDeliver(String packageName, int versionCode, int offerType) throws IOException { + purchase(packageName, versionCode, offerType); + return delivery(packageName, versionCode, offerType); + } /** * Posts given check-in request content and returns diff --git a/src/main/java/de/onyxbits/raccoon/gplay/AppDownloadWorker.java b/src/main/java/de/onyxbits/raccoon/gplay/AppDownloadWorker.java index 81c3c50..664f10d 100644 --- a/src/main/java/de/onyxbits/raccoon/gplay/AppDownloadWorker.java +++ b/src/main/java/de/onyxbits/raccoon/gplay/AppDownloadWorker.java @@ -90,7 +90,7 @@ public AppDownloadWorker(Globals globals, DocV2 doc) { DocUtil.getAppIconUrl(doc)); profile = globals.get(DatabaseManager.class).get(PlayProfileDao.class) .get(); - paid = true; //doc.getOffer(0).getCheckoutFlowRequired(); + paid = doc.getOffer(0).getCheckoutFlowRequired(); } @Override @@ -171,7 +171,7 @@ public void onPrepare() throws Exception { } else { // for apps that can be downloaded free of charge. - data = api.download(packageName, versionCode, offerType); + data = api.purchaseAndDeliver(packageName, versionCode, offerType); } this.totalBytes = data.getTotalSize();