Example usage for android.os RemoteException getLocalizedMessage

List of usage examples for android.os RemoteException getLocalizedMessage

Introduction

In this page you can find the example usage for android.os RemoteException getLocalizedMessage.

Prototype

public String getLocalizedMessage() 

Source Link

Document

Creates a localized description of this throwable.

Usage

From source file:org.codarama.haxsync.services.ContactsSyncAdapterService.java

private static void updateContactStatus(long rawContactId, String status, long timeStamp) {
    if (status != null && timeStamp != 0) {
        ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>();
        Uri rawContactUri = ContentUris.withAppendedId(RawContacts.CONTENT_URI, rawContactId);
        Uri entityUri = Uri.withAppendedPath(rawContactUri, Entity.CONTENT_DIRECTORY);
        Cursor c = mContentResolver.query(entityUri,
                new String[] { RawContacts.SOURCE_ID, Entity.DATA_ID, Entity.MIMETYPE, Entity.DATA1 }, null,
                null, null);/*from  ww  w.j av  a2  s .c o m*/
        try {
            while (c.moveToNext()) {
                if (!c.isNull(1)) {
                    String mimeType = c.getString(2);

                    if (mimeType.equals("vnd.android.cursor.item/vnd.org.codarama.haxsync.profile")) {
                        ContentProviderOperation.Builder builder = ContentProviderOperation
                                .newInsert(ContactsContract.StatusUpdates.CONTENT_URI);
                        builder.withValue(ContactsContract.StatusUpdates.DATA_ID, c.getLong(1));
                        builder.withValue(ContactsContract.StatusUpdates.STATUS, status);
                        builder.withValue(ContactsContract.StatusUpdates.STATUS_RES_PACKAGE,
                                "org.codarama.haxsync");
                        builder.withValue(ContactsContract.StatusUpdates.STATUS_LABEL, R.string.app_name);
                        builder.withValue(ContactsContract.StatusUpdates.STATUS_ICON, R.drawable.icon);
                        builder.withValue(ContactsContract.StatusUpdates.STATUS_TIMESTAMP, timeStamp);
                        operationList.add(builder.build());
                    }
                }
            }
        } finally {
            c.close();
        }
        try {
            mContentResolver.applyBatch(ContactsContract.AUTHORITY, operationList);
        } catch (RemoteException e) {
            Log.e("Error", e.getLocalizedMessage());
        } catch (OperationApplicationException e) {
            Log.e("Error", e.getLocalizedMessage());
        }
    }
}

From source file:com.jetheis.android.makeitrain.billing.googleplay.GooglePlayBillingWrapper.java

public void restoreTransactions() {
    try {/*from w  w  w .j  a v  a2  s.  com*/
        mBoundService.makeGooglePlayRestoreTransactionsRequest();
    } catch (RemoteException e) {
        Log.e(Constants.TAG, "RemoteException: " + e.getLocalizedMessage());
    }
}

From source file:com.jetheis.android.grades.billing.googleplay.GooglePlayBillingWrapper.java

@Override
public void restorePurchases() {
    try {/*from  w ww .j a  va 2s  . c om*/
        mBoundService.makeGooglePlayRestoreTransactionsRequest();
    } catch (RemoteException e) {
        Log.e(Constants.TAG, "RemoteException: " + e.getLocalizedMessage());
    }
}

From source file:com.jetheis.android.grades.billing.googleplay.GooglePlayBillingWrapper.java

public void requestPurchaseInfo(String[] notifyIds) {
    try {// w w w.j a va2 s  .  c  om
        mBoundService.makeGooglePlayPurchaseInformationRequest(notifyIds);
    } catch (RemoteException e) {
        Log.e(Constants.TAG, "RemoteException: " + e.getLocalizedMessage());
        return;
    }
}

From source file:com.jetheis.android.grades.billing.googleplay.GooglePlayBillingWrapper.java

public void sendNotificationConformation(String[] notificationIds) {
    Log.v(Constants.TAG, "Confirming " + notificationIds.length + " notification(s)");

    try {/*from w  ww.j  a v a2 s .c o  m*/
        mBoundService.makeGooglePlayConfirmNotificationsRequest(notificationIds);
    } catch (RemoteException e) {
        Log.e(Constants.TAG, "RemoteException: " + e.getLocalizedMessage());
    }
}

From source file:com.jetheis.android.makeitrain.billing.googleplay.GooglePlayBillingWrapper.java

public void requestVipStatus() {
    Bundle response;//w ww. j a  v a 2  s .co m

    try {
        response = mBoundService.makeGooglePlayPurchaseRequest(Constants.GOOGLE_PLAY_PRODUCT_ID);
    } catch (RemoteException e) {
        Log.e(Constants.TAG, "RemoteException: " + e.getLocalizedMessage());
        return;
    }

    if (response.getInt(Constants.GOOGLE_PLAY_BUNDLE_KEY_RESPONSE_CODE) != GooglePlayResponseCode.RESULT_OK
            .ordinal()) {
        return;
    }

    PendingIntent pendingIntent = response.getParcelable(Constants.GOOGLE_PLAY_BUNDLE_KEY_PURCHASE_INTENT);

    try {
        mContext.startIntentSender(pendingIntent.getIntentSender(), new Intent(), 0, 0, 0);
    } catch (SendIntentException e) {
        Log.e(Constants.TAG, "SendIntentException: " + e.getLocalizedMessage());
    }
}

From source file:com.jetheis.android.grades.billing.googleplay.GooglePlayBillingWrapper.java

@Override
public void requestPurchase(String itemId) {
    Log.d(Constants.TAG, "Requesting purchase of " + itemId);

    Bundle response;//from w ww  . j  a v  a  2  s.  c o  m

    try {
        response = mBoundService.makeGooglePlayPurchaseRequest(itemId);
    } catch (RemoteException e) {
        Log.e(Constants.TAG, "RemoteException: " + e.getLocalizedMessage());
        return;
    }

    if (response.getInt(
            GooglePlayBillingConstants.GOOGLE_PLAY_BUNDLE_KEY_RESPONSE_CODE) != GooglePlayResponseCode.RESULT_OK
                    .ordinal()) {
        return;
    }

    PendingIntent pendingIntent = response
            .getParcelable(GooglePlayBillingConstants.GOOGLE_PLAY_BUNDLE_KEY_PURCHASE_INTENT);

    try {
        mContext.startIntentSender(pendingIntent.getIntentSender(), new Intent(), 0, 0, 0);
    } catch (SendIntentException e) {
        Log.e(Constants.TAG, "SendIntentException: " + e.getLocalizedMessage());
    }

}

From source file:info.guardianproject.otr.app.im.app.ContactListFilterView.java

void removeContact(Cursor c) {
    final IImConnection conn = getConnection(c);

    String nickname = c.getString(c.getColumnIndexOrThrow(Imps.Contacts.NICKNAME));
    final String address = c.getString(c.getColumnIndexOrThrow(Imps.Contacts.USERNAME));
    DialogInterface.OnClickListener confirmListener = new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            try {
                IContactListManager manager = conn.getContactListManager();
                int res = manager.removeContact(address);
                if (res != ImErrorInfo.NO_ERROR) {
                    mHandler.showAlert(R.string.error, ErrorResUtils.getErrorRes(getResources(), res, address));
                }//www  .j  a  v a  2 s  . c  om
            } catch (RemoteException e) {

                mHandler.showServiceErrorAlert(e.getLocalizedMessage());
                LogCleaner.error(ImApp.LOG_TAG, "remote error", e);
            }
        }
    };

    Resources r = getResources();

    new AlertDialog.Builder(mContext).setTitle(R.string.confirm)
            .setMessage(r.getString(R.string.confirm_delete_contact, nickname))
            .setPositiveButton(R.string.yes, confirmListener) // default button
            .setNegativeButton(R.string.no, null).setCancelable(false).show();

}

From source file:info.guardianproject.otr.app.im.app.ContactListFilterView.java

void blockContact(Cursor c) {

    final IImConnection conn = getConnection(c);

    String nickname = c.getString(c.getColumnIndexOrThrow(Imps.Contacts.NICKNAME));
    final String address = c.getString(c.getColumnIndexOrThrow(Imps.Contacts.USERNAME));
    DialogInterface.OnClickListener confirmListener = new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
            try {
                IContactListManager manager = conn.getContactListManager();

                int res = -1;

                if (manager.isBlocked(address))
                    res = manager.unBlockContact(address);
                else {
                    res = manager.blockContact(address);

                    if (res != ImErrorInfo.NO_ERROR) {
                        mHandler.showAlert(R.string.error,
                                ErrorResUtils.getErrorRes(getResources(), res, address));
                    }//w w w .  j a va 2  s.  c  o m
                }
            } catch (RemoteException e) {

                mHandler.showServiceErrorAlert(e.getLocalizedMessage());
                LogCleaner.error(ImApp.LOG_TAG, "remote error", e);
            }
        }
    };

    Resources r = getResources();

    new AlertDialog.Builder(mContext).setTitle(R.string.confirm)
            .setMessage(r.getString(R.string.confirm_block_contact, nickname))
            .setPositiveButton(R.string.yes, confirmListener) // default button
            .setNegativeButton(R.string.no, null).setCancelable(false).show();

}

From source file:com.ingeneo.cordova.plugins.ibeacon.GPIBeacon.java

@Override
public void didEnterRegion(Region region) {
    Log.d(TAG, "I just saw an iBeacon for the first time!");

    try {/*from   w w w  .ja v a2 s. co m*/

        JSONObject obj = beaconsData.get(region.getUniqueId());
        obj.put("foreground", this.gForeground);

        JSONObject result = new JSONObject();
        result.put("ibeacon", obj);

        if (!obj.has("range")) {
            result.put("event", "ibeaconmsg");
            if (this.gForeground) {
                performJSEvent(result.getString("event"), result);
            } else {
                itemsNotification.add(obj.getString("identifier"));
                createNotification(this.getApplicationContext(), result);
            }
        } else if (obj.get("range") == null || obj.getString("range").equalsIgnoreCase("enter")) {
            result.put("event", "ibeaconmsg");
            if (this.gForeground) {
                performJSEvent(result.getString("event"), result);
            } else {
                itemsNotification.add(obj.getString("identifier"));
                createNotification(this.getApplicationContext(), result);
            }
        } else {
            iBeaconManager.startRangingBeaconsInRegion(region);
            iBeaconManager.setRangeNotifier(this);
        }
        if (this.gForeground) {
            result.put("event", "ibeaconenter");
            performJSEvent(result.getString("event"), result);
        }

    } catch (RemoteException e) {
        Log.e(TAG, e.getLocalizedMessage());
    } catch (JSONException e) {
        Log.e(TAG, e.getLocalizedMessage());
    }
}