IAB version 3

This commit is contained in:
M66B 2015-11-18 17:56:05 +01:00
parent 0ece612508
commit 95fe0a11a2
2 changed files with 4 additions and 4 deletions

View File

@ -550,5 +550,4 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
intent.setData(Uri.parse("https://github.com/M66B/NetGuard/blob/master/FAQ.md"));
return intent;
}
}

View File

@ -45,6 +45,7 @@ public class IAB implements ServiceConnection {
private boolean available = false;
private IInAppBillingService service = null;
private static final int IAB_VERSION = 3;
// adb shell pm clear com.android.vending
// adb shell am start -n eu.faircode.netguard/eu.faircode.netguard.ActivityMain
private static final String SKU_DONATE = "donation";
@ -104,7 +105,7 @@ public class IAB implements ServiceConnection {
skuList.add(sku);
Bundle query = new Bundle();
query.putStringArrayList("ITEM_ID_LIST", skuList);
Bundle bundle = service.getSkuDetails(3, context.getPackageName(), "inapp", query);
Bundle bundle = service.getSkuDetails(IAB_VERSION, context.getPackageName(), "inapp", query);
Log.i(TAG, "getSkuDetails");
Util.logBundle(TAG, bundle);
int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1));
@ -130,7 +131,7 @@ public class IAB implements ServiceConnection {
private boolean IABisPurchased(String sku) throws RemoteException {
// Get purchases
Bundle bundle = service.getPurchases(3, context.getPackageName(), "inapp", null);
Bundle bundle = service.getPurchases(IAB_VERSION, context.getPackageName(), "inapp", null);
Log.i(TAG, "getPurchases");
Util.logBundle(TAG, bundle);
int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1));
@ -144,7 +145,7 @@ public class IAB implements ServiceConnection {
}
private IntentSender IABgetIntent(String sku) throws RemoteException {
Bundle bundle = service.getBuyIntent(3, context.getPackageName(), sku, "inapp", "");
Bundle bundle = service.getBuyIntent(IAB_VERSION, context.getPackageName(), sku, "inapp", "");
Log.i(TAG, "getBuyIntent");
Util.logBundle(TAG, bundle);
int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1));