This repository has been archived by the owner on Apr 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 171
Appland, AppMall Aptoide, SlideME, Yandex.Store
akarimova edited this page Dec 9, 2014
·
8 revisions
It is a general instruction how to support the Open Stores. For more specific information, please visit the corresponding store page.
-
Add the billing permission
<uses-permission android:name="org.onepf.openiab.permission.BILLING" />
-
Provide your public keys for required stores
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder(); builder.addStoreKey(OpenIABHelper.NAME_APPMALL, appmallPublicKey) builder.addStoreKey(OpenIABHelper.NAME_APPLAND, applandPublicKey); builder.addStoreKey(OpenIABHelper.NAME_APTOIDE, aptoidePublicKey); builder.addStoreKey(OpenIABHelper.NAME_SLIDEME, slidemePublicKey); builder.addStoreKey(OpenIABHelper.NAME_YANDEX, yandexPublicKey); mHelper = new OpenIabHelper(this, builder.build());
otherwise verify purchases on your server side.
-
Map the SKUs if they are different for the required stores
OpenIabHelper.mapSku(SKU_PREMIUM, OpenIabHelper.STORE_NAME, "org.onepf.trivialdrive.storename.premium"); OpenIabHelper.mapSku(SKU_GAS, OpenIabHelper.STORE_NAME, "org.onepf.trivialdrive.storename.gas"); OpenIabHelper.mapSku(SKU_INFINITE_GAS, OpenIabHelper.STORE_NAME, "org.onepf.trivialdrive.storename.infinite_gas");
-
For store environment
To test .apk, please ensure
- your .apk is submitted to the Developer Console - versionCode in AndroidManifest.xml of your .apk is equal to versionCode of .apk submitted to the Developer Console - you are logged in
-
For OpenIAB
# install for Open Store: adb install -i store_package_name /path/to/YourApp.apk
e.g. store_package_name can be com.yandex.store, cm.aptoide.pt.
-
Create OpenIabHelper with "Skip signature verification" option and no publicKeys. If you specify no publicKeys and forget VERIFY_SKIP option, an IllegalArgumentException will be thrown
OpenIabHelper.Options.Builder builder = new OpenIabHelper.Options.Builder(); builder.setVerifyMode(OpenIabHelper.Options.VERIFY_SKIP); mHelper = new OpenIabHelper(context, builder.build());
-
Get receipt data and signature from Purchase object and send it to your server
new IabHelper.OnIabPurchaseFinishedListener() { public void onIabPurchaseFinished(IabResult result, Purchase purchase) { // … different result checks ... String receiptData = purchase.getOriginalJson(); String receiptSignature = purchase.getSignature(); String storeName = purchase.getAppstoreName(); String urlToContent = yourRequestReceiptVerificationOnServer(receiptData, receiptSignature, storeName); // … further code ... } }
or use store-specific methods:
- for Yandex.Store
- for Appland
- ...