/**
  * Returns the in-app product billing support status, and checks it asynchronously if it is
  * currently unknown. Observers will receive a {@link IBillingObserver#onBillingChecked(boolean)}
  * notification in either case.
  *
  * <p>In-app product support does not imply subscription support. To check if subscriptions are
  * supported, use {@link BillingController#checkSubscriptionSupported(Context)}.
  *
  * @param context
  * @return the current in-app product billing support status (unknown, supported or unsupported).
  *     If it is unsupported, subscriptions are also unsupported.
  * @see IBillingObserver#onBillingChecked(boolean)
  * @see BillingController#checkSubscriptionSupported(Context)
  */
 public static BillingStatus checkBillingSupported(Context context) {
   if (billingStatus == BillingStatus.UNKNOWN) {
     BillingService.checkBillingSupported(context);
   } else {
     boolean supported = billingStatus == BillingStatus.SUPPORTED;
     onBillingChecked(supported);
   }
   return billingStatus;
 }
Exemplo n.º 2
0
 private void handleCommand(Intent intent, int startId) {
   final Action action = getActionFromIntent(intent);
   if (action == null) {
     return;
   }
   switch (action) {
     case CHECK_BILLING_SUPPORTED:
       checkBillingSupported(startId);
       break;
     case REQUEST_PURCHASE:
       requestPurchase(intent, startId);
       break;
     case GET_PURCHASE_INFORMATION:
       getPurchaseInformation(intent, startId);
       break;
     case CONFIRM_NOTIFICATIONS:
       confirmNotifications(intent, startId);
       break;
     case RESTORE_TRANSACTIONS:
       restoreTransactions(intent, startId);
   }
 }