本文整理汇总了Java中com.amazon.device.iap.PurchasingService类的典型用法代码示例。如果您正苦于以下问题:Java PurchasingService类的具体用法?Java PurchasingService怎么用?Java PurchasingService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PurchasingService类属于com.amazon.device.iap包,在下文中一共展示了PurchasingService类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: queryInventory
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public Inventory queryInventory(boolean querySkuDetails, List<String> moreSkus) throws IabException {
Log.d(TAG,"queryInventory");
try {
mInventory = new Inventory();
Log.d(TAG,"getPurchaseUpdates");
synchronized(mLock) {
PurchasingService.getPurchaseUpdates(true);
mLock.wait(10000);
}
Log.d(TAG,"getProductData");
synchronized(mLock) {
PurchasingService.getProductData(new HashSet<String>(moreSkus));
mLock.wait(10000);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
return mInventory;
}
开发者ID:archos-sa,项目名称:aos-Video,代码行数:26,代码来源:AmazonIabHelper.java
示例2: install
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void install (final PurchaseObserver observer, PurchaseManagerConfig config, boolean autoFetchInformation) {
this.observer = observer;
this.config = config;
// --- copy all available products to the list of productIdentifiers
int offerSize = config.getOfferCount();
productIdentifiers = new HashSet<String>(offerSize);
for (int z = 0; z < config.getOfferCount(); z++) {
productIdentifiers.add(config.getOffer(z).getIdentifierForStore(storeName()));
}
PurchasingService.registerListener(activity.getApplicationContext(), this);
// PurchasingService.IS_SANDBOX_MODE returns a boolean value.
// Use this boolean value to check whether your app is running in test mode under the App Tester
// or in the live production environment.
showMessage(LOGTYPELOG, "Amazon IAP: sandbox mode is:" + PurchasingService.IS_SANDBOX_MODE);
observer.handleInstall();
PurchasingService.getUserData();
PurchasingService.getProductData(productIdentifiers);
}
开发者ID:libgdx,项目名称:gdx-pay,代码行数:26,代码来源:PurchaseManagerAndroidAmazon.java
示例3: startSetup
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void startSetup(OnIabSetupFinishedListener listener) {
mOnIabSetupFinishedListener = listener;
if (mPurchasingObserver == null) {
mPurchasingObserver = new PurchasingObserver();
}
mHandler.removeMessages(MSG_SETUP_TIMEOUT);
mHasSetupTimeout = false;
mHandler.sendEmptyMessageAtTime(MSG_SETUP_TIMEOUT, SETUP_TIMEOUT);
PurchasingService.registerListener(ArchosUtils.getGlobalContext(), mPurchasingObserver);
PurchasingService.getUserData();
}
开发者ID:archos-sa,项目名称:aos-Video,代码行数:14,代码来源:AmazonIabHelper.java
示例4: launchPurchaseFlow
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void launchPurchaseFlow(Activity act, String sku, int requestCode, OnIabPurchaseFinishedListener listener, String extraData) {
mExtraData = extraData;
mLastOperationSKU = sku;
mOnIabPurchaseFinishedListener = listener;
PurchasingService.purchase(sku);
}
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:AmazonIabHelper.java
示例5: init
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void init(String key) {
mAmazonBillingListener = new AmazonBillingListener(this);
PurchasingService.registerListener(context, mAmazonBillingListener);
final Set<String> productSkus = new HashSet<>(iapkeys);
PurchasingService.getProductData(productSkus);
PurchasingService.getPurchaseUpdates(true);
}
开发者ID:eggheadgames,项目名称:android-in-app-payments,代码行数:11,代码来源:AmazonBillingService.java
示例6: purchase
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void purchase(final String productId, int quantity, PurchaseCallback callback) {
dispatchCallback(new Runnable() {
@Override
public void run() {
notifyPurchaseStarted(productId);
}
});
RequestId request = PurchasingService.purchase(productId);
mProductIds.put(request, productId);
mPurchaseCallbacks.put(request, callback);
}
开发者ID:ludei,项目名称:atomic-plugins-inapps,代码行数:15,代码来源:AmazonInAppService.java
示例7: handleReceipt
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
/**
* Method to handle receipts
*
* @param requestId
* @param receipt
* @param userData
*/
public void handleReceipt(final String requestId, final Receipt receipt, final UserData userData) {
showMessage(LOGTYPELOG, "Handle receipt: requestId (" + requestId
+ ") receipt: "
+ receipt
+ ")");
// convert receipt to transaction
Transaction trans = AmazonTransactionUtils.convertReceiptToTransaction(1, requestId, receipt, userData); // provides cancleState also
switch (receipt.getProductType()) {
case CONSUMABLE:
// inform the listener
observer.handlePurchase(trans);
// Automatically consume item
PurchasingService.notifyFulfillment(receipt.getReceiptId(), FulfillmentResult.FULFILLED);
break;
case ENTITLED:
// inform the listener
observer.handlePurchase(trans);
break;
case SUBSCRIPTION:
// TODO: check subscription sample for how to handle consumable purchases
break;
}
}
开发者ID:libgdx,项目名称:gdx-pay,代码行数:37,代码来源:PurchaseManagerAndroidAmazon.java
示例8: getInstance
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@SuppressWarnings("PMD.NonThreadSafeSingleton")
public static AmazonBillingHelper getInstance(@NonNull final Context context) {
if (instance == null) {
instance = new AmazonBillingHelper();
PurchasingService.registerListener(context, instance);
}
return instance;
}
开发者ID:onepf,项目名称:OPFIab,代码行数:9,代码来源:AmazonBillingHelper.java
示例9: getUserData
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
/**
* Requests user data form Amazon SDK.
*
* @return User data if received withing {@link #USER_DATA_TIMEOUT}, null otherwise.
*/
@Nullable
UserData getUserData() {
final SyncedReference<UserData> syncUserData = new SyncedReference<>();
try {
this.syncUserData = syncUserData;
PurchasingService.getUserData();
return syncUserData.get(USER_DATA_TIMEOUT);
} finally {
this.syncUserData = null;
}
}
开发者ID:onepf,项目名称:OPFIab,代码行数:17,代码来源:AmazonBillingHelper.java
示例10: handleFailure
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
/**
* Tries to guess appropriate error code.
*
* @return Most suitable status.
*/
protected Status handleFailure() {
// Unfortunately Amazon doesn't report a reason for error
if (!PurchasingService.IS_SANDBOX_MODE && !OPFUtils.isConnected(context)) {
return SERVICE_UNAVAILABLE;
}
return UNKNOWN_ERROR;
}
开发者ID:onepf,项目名称:OPFIab,代码行数:14,代码来源:AmazonBillingProvider.java
示例11: isAvailable
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public boolean isAvailable() {
final PackageManager packageManager = context.getPackageManager();
for (final PackageInfo info : packageManager.getInstalledPackages(0)) {
if (PATTERN_STORE_PACKAGE.matcher(info.packageName).matches()) {
// Check sdk tester package if app is in sandbox mode.
return !PurchasingService.IS_SANDBOX_MODE
|| OPFUtils.isInstalled(context, TESTER_PACKAGE);
}
}
return false;
}
开发者ID:onepf,项目名称:OPFIab,代码行数:13,代码来源:AmazonBillingProvider.java
示例12: consume
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void consume(@NonNull final ConsumeRequest request) {
final Purchase purchase = request.getPurchase();
final String token = purchase.getToken();
if (!TextUtils.isEmpty(token)) {
PurchasingService.notifyFulfillment(token, FulfillmentResult.FULFILLED);
postResponse(new ConsumeResponse(SUCCESS, getName(), purchase));
} else {
postEmptyResponse(request, ITEM_UNAVAILABLE);
}
}
开发者ID:onepf,项目名称:OPFIab,代码行数:12,代码来源:AmazonBillingProvider.java
示例13: startSetupInner
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
/**
* see parent
*/
@Override
protected void startSetupInner() {
if (mPurchasingObserver == null) {
mPurchasingObserver = new PurchasingObserver();
}
PurchasingService.registerListener(SoomlaApp.getAppContext(), mPurchasingObserver);
PurchasingService.getUserData();
}
开发者ID:soomla,项目名称:android-store-amazon,代码行数:13,代码来源:AmazonIabHelper.java
示例14: fetchSkusDetailsAsyncInner
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
/**
* see parent
*/
@Override
protected void fetchSkusDetailsAsyncInner(List<String> skus) {
if (skus == null || skus.isEmpty()){
SoomlaUtils.LogDebug(TAG, "skus is null or empty, nothing to fetch.");
// Finish the fetch so it doesn't get stuck
AmazonIabHelper.this.fetchSkusDetailsSuccess(new IabInventory());
return;
}
PurchasingService.getProductData(new HashSet<String>(skus));
}
开发者ID:soomla,项目名称:android-store-amazon,代码行数:15,代码来源:AmazonIabHelper.java
示例15: startSetup
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
/**
* @param listener - is triggered when {@link #onUserDataResponse(UserDataResponse)} happens
*/
@Override
public void startSetup(IabHelper.OnIabSetupFinishedListener listener) {
this.setupListener = listener;
PurchasingService.registerListener(context, this);
PurchasingService.getUserData();
}
开发者ID:onepf,项目名称:OpenIAB,代码行数:10,代码来源:AmazonAppstoreBillingService.java
示例16: onPurchaseUpdatesResponse
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void onPurchaseUpdatesResponse(final PurchaseUpdatesResponse purchaseUpdatesResponse) {
final PurchaseUpdatesResponse.RequestStatus requestStatus = purchaseUpdatesResponse.getRequestStatus();
final RequestId requestId = purchaseUpdatesResponse.getRequestId();
Logger.d("onPurchaseUpdatesResponse() reqStatus: ", requestStatus,
"reqId: ", requestId);
switch (requestStatus) {
case SUCCESSFUL:
for (final String sku : inventory.getAllOwnedSkus()) {
inventory.erasePurchase(sku);
}
final UserData userData = purchaseUpdatesResponse.getUserData();
final String userId = userData.getUserId();
if (!userId.equals(currentUserId)) {
Logger.w("onPurchaseUpdatesResponse() Current UserId: ", currentUserId,
", purchase UserId: ", userId);
break;
}
for (final Receipt receipt : purchaseUpdatesResponse.getReceipts()) {
inventory.addPurchase(getPurchase(receipt));
}
if (purchaseUpdatesResponse.hasMore()) {
PurchasingService.getPurchaseUpdates(false);
Logger.d("Initiating Another Purchase Updates with offset: ");
return;
}
break;
case FAILED:
break;
}
final CountDownLatch countDownLatch = inventoryLatchQueue.poll();
if (countDownLatch != null) {
countDownLatch.countDown();
}
}
开发者ID:onepf,项目名称:OpenIAB,代码行数:37,代码来源:AmazonAppstoreBillingService.java
示例17: launchPurchaseFlow
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void launchPurchaseFlow(
final Activity activity,
final String sku,
final String itemType,
final int requestCode,
final IabHelper.OnIabPurchaseFinishedListener listener,
final String extraData) {
final RequestId requestId = PurchasingService.purchase(sku);
requestSkuMap.put(requestId, sku);
requestListeners.put(requestId, listener);
}
开发者ID:onepf,项目名称:OpenIAB,代码行数:13,代码来源:AmazonAppstoreBillingService.java
示例18: buy
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void buy(Activity activity, String sku, int id) {
PurchasingService.purchase(sku);
}
开发者ID:eggheadgames,项目名称:android-in-app-payments,代码行数:5,代码来源:AmazonBillingService.java
示例19: subscribe
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
@Override
public void subscribe(Activity activity, String sku, int id) {
PurchasingService.purchase(sku);
}
开发者ID:eggheadgames,项目名称:android-in-app-payments,代码行数:5,代码来源:AmazonBillingService.java
示例20: AmazonBillingListener
import com.amazon.device.iap.PurchasingService; //导入依赖的package包/类
AmazonBillingListener(AmazonBillingService amazonBillingService) {
this.amazonBillingService = amazonBillingService;
logDebug("IS_SANDBOX_MODE:" + PurchasingService.IS_SANDBOX_MODE);
}
开发者ID:eggheadgames,项目名称:android-in-app-payments,代码行数:5,代码来源:AmazonBillingListener.java
注:本文中的com.amazon.device.iap.PurchasingService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论