Пример #1
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);
   }
 }
 /**
  * Requests purchase information for the specified notification. Immediately followed by a call to
  * {@link #onPurchaseInformationResponse(long, boolean)} and later to {@link
  * #onPurchaseStateChanged(Context, String, String)}, if the request is successful.
  *
  * @param context
  * @param notifyId id of the notification whose purchase information is requested.
  */
 private static void getPurchaseInformation(Context context, String notifyId) {
   final long nonce = Security.generateNonce();
   BillingService.getPurchaseInformation(context, new String[] {notifyId}, nonce);
 }