List of usage examples for android.os RemoteException getMessage
public String getMessage()
From source file:com.cbtec.eliademy.BillingPlugin.java
private void getPurchasedItems(CallbackContext callbackContext) { try {/*w ww. j a va 2s.c o m*/ JSONArray products = new JSONArray(); Bundle ownedItems = Eliademy.sBillingService.getPurchases(3, Eliademy.sInstance.getPackageName(), "inapp", null); if (ownedItems.getInt("RESPONSE_CODE") == 0) { final ArrayList<String> items = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); for (int i = 0; i < items.size(); i++) { products.put(items.get(i)); } } callbackContext.success(products); } catch (RemoteException e) { callbackContext.error(e.getMessage()); } }
From source file:com.manning.androidhacks.hack043.service.SQLContentProviderService.java
@Override protected void onHandleIntent(Intent intent) { Builder builder = null;// w w w . j a v a 2 s.c o m ContentResolver contentResolver = getContentResolver(); ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(); builder = ContentProviderOperation.newDelete(MySQLContentProvider.CONTENT_URI); operations.add(builder.build()); for (int i = 1; i <= 100; i++) { ContentValues cv = new ContentValues(); cv.put(MySQLContentProvider.COLUMN_TEXT, "" + i); builder = ContentProviderOperation.newInsert(MySQLContentProvider.CONTENT_URI); builder.withValues(cv); operations.add(builder.build()); } try { contentResolver.applyBatch(MySQLContentProvider.AUTHORITY, operations); } catch (RemoteException e) { Log.e(TAG, "Couldn't apply batch: " + e.getMessage()); } catch (OperationApplicationException e) { Log.e(TAG, "Couldn't apply batch: " + e.getMessage()); } }
From source file:com.manning.androidhacks.hack043.service.BatchService.java
@Override protected void onHandleIntent(Intent intent) { Builder builder = null;//from www . j a v a2s .c o m ContentResolver contentResolver = getContentResolver(); ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(); builder = ContentProviderOperation.newDelete(BatchNumbersContentProvider.CONTENT_URI); operations.add(builder.build()); for (int i = 1; i <= 100; i++) { ContentValues cv = new ContentValues(); cv.put(NoBatchNumbersContentProvider.COLUMN_TEXT, "" + i); builder = ContentProviderOperation.newInsert(BatchNumbersContentProvider.CONTENT_URI); builder.withValues(cv); operations.add(builder.build()); } try { contentResolver.applyBatch(BatchNumbersContentProvider.AUTHORITY, operations); } catch (RemoteException e) { Log.e(TAG, "Couldn't apply batch: " + e.getMessage()); } catch (OperationApplicationException e) { Log.e(TAG, "Couldn't apply batch: " + e.getMessage()); } }
From source file:jp.alessandro.android.iab.ItemGetter.java
/** * In your application, you can query the item details from Google Play using the In-app Billing Version 3 API. * To pass a request to the In-app Billing service, first create a Bundle that contains * a String ArrayList of product IDs with key "ITEM_ID_LIST", * where each string is a product ID for an purchasable item. * See https://developer.android.com/google/play/billing/billing_integrate.html#QueryDetails * * @param service in-app billing service * @param itemType "inapp" or "subs"//from w w w .j a v a 2 s . c om * @param itemIds contains the list of item ids that you want to request * @return * @throws BillingException */ ItemDetails get(IInAppBillingService service, String itemType, ArrayList<String> itemIds) throws BillingException { ItemDetails itemDetails = new ItemDetails(); List<ArrayList<String>> splitItemIdList = new ArrayList<>(); // There reason why it splits the item ids per request // It's because there is a known bug on Google Api // https://code.google.com/archive/p/marketbilling/issues/137 for (int i = 0; i < itemIds.size(); i += ItemGetter.MAX_SKU_PER_REQUEST) { int fromIndex = i; int toIndex = Math.min(itemIds.size(), i + ItemGetter.MAX_SKU_PER_REQUEST); ArrayList<String> list = new ArrayList<>(itemIds.subList(fromIndex, toIndex)); splitItemIdList.add(list); } for (ArrayList<String> splitItemIds : splitItemIdList) { try { Bundle itemIdsBundle = createBundleItemListFromArray(splitItemIds); Bundle skuDetails = service.getSkuDetails(mApiVersion, mPackageName, itemType, itemIdsBundle); List<String> detailList = getItemsFromResponse(skuDetails); putAll(detailList, itemDetails); } catch (RemoteException e) { throw new BillingException(Constants.ERROR_REMOTE_EXCEPTION, e.getMessage()); } } return itemDetails; }
From source file:jp.alessandro.android.iab.PurchaseGetter.java
private Bundle getPurchasesBundle(IInAppBillingService service, String itemType, String continueToken) throws BillingException { try {/*ww w . ja va 2 s.com*/ return service.getPurchases(mApiVersion, mPackageName, itemType, continueToken); } catch (RemoteException e) { throw new BillingException(Constants.ERROR_REMOTE_EXCEPTION, e.getMessage()); } }
From source file:com.canelmas.let.sample.ContactsActivity.java
/** * Accesses the Contacts content provider directly to insert a new contact. * <p>//from ww w . j a va 2 s . c o m * The contact is called "__DUMMY ENTRY" and only contains a name. */ private void insertDummyContact() { // Two operations are needed to insert a new contact. ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(2); // First, set up a new raw contact. ContentProviderOperation.Builder op = ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null); operations.add(op.build()); // Next, set the name for the contact. op = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, DUMMY_CONTACT_NAME); operations.add(op.build()); // Apply the operations. ContentResolver resolver = getContentResolver(); try { resolver.applyBatch(ContactsContract.AUTHORITY, operations); } catch (RemoteException e) { Log.d(TAG, "Could not add a new contact: " + e.getMessage()); } catch (OperationApplicationException e) { Log.d(TAG, "Could not add a new contact: " + e.getMessage()); } }
From source file:com.commonsware.android.advservice.remotebinding.client.DownloadFragment.java
@Override public void onClick(View view) { try {/*from w w w.j a v a2s . c o m*/ binding.download(TO_DOWNLOAD); } catch (RemoteException e) { Log.e(getClass().getSimpleName(), "Exception requesting download", e); Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show(); } }
From source file:jp.alessandro.android.iab.PurchaseFlowLauncher.java
private Bundle getBuyIntent(IInAppBillingService service, List<String> oldItemIds, String itemId, String developerPayload) throws BillingException { try {// ww w . j a va 2 s. c o m // Purchase an item if (oldItemIds == null || oldItemIds.isEmpty()) { return service.getBuyIntent(mApiVersion, mPackageName, itemId, mItemType, developerPayload); } // Upgrade/downgrade of subscriptions must be done on api version 5 // See https://developer.android.com/google/play/billing/billing_reference.html#upgrade-getBuyIntentToReplaceSkus return service.getBuyIntentToReplaceSkus(BillingApi.VERSION_5.getValue(), mPackageName, oldItemIds, itemId, mItemType, developerPayload); } catch (RemoteException e) { throw new BillingException(Constants.ERROR_REMOTE_EXCEPTION, e.getMessage()); } }
From source file:cn.pjt.rxjava.contacts.ContactsFragment.java
/** * Accesses the Contacts content provider directly to insert a new contact. * <p>//from w ww . j av a 2s . co m * The contact is called "__DUMMY ENTRY" and only contains a name. */ private void insertDummyContact() { // Two operations are needed to insert a new contact. ArrayList<ContentProviderOperation> operations = new ArrayList<ContentProviderOperation>(2); // First, set up a new raw contact. ContentProviderOperation.Builder op = ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null); operations.add(op.build()); // Next, set the name for the contact. op = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, DUMMY_CONTACT_NAME); operations.add(op.build()); // Apply the operations. ContentResolver resolver = getActivity().getContentResolver(); try { resolver.applyBatch(ContactsContract.AUTHORITY, operations); } catch (RemoteException e) { Log.d(TAG, "Could not add a new contact: " + e.getMessage()); } catch (OperationApplicationException e) { Log.d(TAG, "Could not add a new contact: " + e.getMessage()); } }
From source file:com.commonsware.android.advservice.callbackbinding.client.DownloadFragment.java
@Override public void onClick(View view) { try {/* w ww. j ava2 s . co m*/ binding.download(TO_DOWNLOAD, cb); } catch (RemoteException e) { Log.e(getClass().getSimpleName(), "Exception requesting download", e); Toast.makeText(getActivity(), e.getMessage(), Toast.LENGTH_LONG).show(); } }