Example usage for android.os RemoteException printStackTrace

List of usage examples for android.os RemoteException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:me.gpelaez.cordova.plugins.ibeacon.GPIBeacon.java

private void addRegion(JSONArray data, CallbackContext callbackContext) throws JSONException {

    final JSONObject data2 = data.getJSONObject(0);

    final CallbackContext callbackContext2 = callbackContext;

    cordova.getThreadPool().execute(new Runnable() {
        @Override/* w w  w.  j ava  2  s.  com*/
        public void run() {
            try {
                String iden = data2.getString("identifier");
                String uuid = data2.getString("uuid");
                Integer major = data2.getInt("major");
                Integer minor = data2.getInt("minor");
                beaconsData.put(iden, data2);
                Region region = new Region(iden, uuid, major, minor);
                iBeaconManager.startMonitoringBeaconsInRegion(region);
                //                  iBeaconManager.startMonitoringBeaconsInRegion(new Region("", null, null, null));
                callbackContext2.success();

            } catch (RemoteException e) {
                callbackContext2.error("Could not add region");
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });

}

From source file:edu.sage.spark.ui.ContactList.java

@Override
public final boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.contact_list_menu_settings:
        startActivity(new Intent(this, Settings.class));
        return true;
    case R.id.contact_list_menu_add_contact:
        startActivity(new Intent(ContactList.this, AddContact.class));
        return true;
    case R.id.menu_change_status:
        startActivity(new Intent(ContactList.this, ChangeStatus.class));
        return true;
    case R.id.contact_list_menu_chatlist:
        List<Contact> openedChats;
        try {//  ww w .j a v  a  2  s .  c  o  m
            openedChats = mChatManager.getOpenedChatList();
            LOGD(TAG, "opened chats = " + openedChats);
            Dialog chatList = new ChatList(ContactList.this, openedChats).create();
            chatList.show();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
        return true;

    case R.id.sageMail:
        sageMail();
        return true;// almyz125 sageMail case opens sageMail method below.

    case R.id.sageCloud:
        openCloud();
        return true;// almyz125 added to open sage cloud or find it on the market

    case R.id.menu_disconnect:
        stopService(SERVICE_INTENT);
        finish();
        return true;
    default:
        return false;
    }
}

From source file:cx.ring.fragments.SmartListFragment.java

private void bindCalls(Conference call_to_add, Conference call_target) {
    try {//from   w ww.ja  v  a2s  .  com
        Log.i(TAG, "joining calls:" + call_to_add.getId() + " and " + call_target.getId());

        if (call_target.hasMultipleParticipants() && !call_to_add.hasMultipleParticipants()) {
            mCallbacks.getService().getRemoteService()
                    .addParticipant(call_to_add.getParticipants().get(0).getCallId(), call_target.getId());
        } else if (call_target.hasMultipleParticipants() && call_to_add.hasMultipleParticipants()) {
            // We join two conferences
            mCallbacks.getService().getRemoteService().joinConference(call_to_add.getId(), call_target.getId());
        } else if (!call_target.hasMultipleParticipants() && call_to_add.hasMultipleParticipants()) {
            mCallbacks.getService().getRemoteService()
                    .addParticipant(call_target.getParticipants().get(0).getCallId(), call_to_add.getId());
        } else {
            // We join two single calls to create a conf
            mCallbacks.getService().getRemoteService().joinParticipant(
                    call_to_add.getParticipants().get(0).getCallId(),
                    call_target.getParticipants().get(0).getCallId());
        }
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:cx.ring.fragments.AccountCreationFragment.java

@SuppressWarnings("unchecked")
private void initAccountCreation() {
    try {/* w  ww .ja v a  2s  .  c  o  m*/
        HashMap<String, String> accountDetails = (HashMap<String, String>) mCallbacks.getRemoteService()
                .getAccountTemplate(mAccountType);
        accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_TYPE, mAccountType);
        //~ Checking the state of the Camera permission to enable Video or not.
        boolean hasCameraPermission = ContextCompat.checkSelfPermission(getActivity(),
                Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED;
        accountDetails.put(AccountDetailBasic.CONFIG_VIDEO_ENABLED, Boolean.toString(hasCameraPermission));
        if (mAccountType.equals(AccountDetailBasic.ACCOUNT_TYPE_RING)) {
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS, "Ring");
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME, "bootstrap.ring.cx");
            // Enable UPNP by default for Ring accounts
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_UPNP_ENABLE, AccountDetail.TRUE_STR);
        } else {
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_ALIAS, mAlias);
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_HOSTNAME, mHostname);
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_USERNAME, mUsername);
            accountDetails.put(AccountDetailBasic.CONFIG_ACCOUNT_PASSWORD, mPassword);
        }

        //~ Sipinfo is forced for any sipaccount since overrtp is not supported yet.
        //~ This will have to be removed when it will be supported.
        accountDetails.put(AccountDetailAdvanced.CONFIG_ACCOUNT_DTMF_TYPE,
                getString(R.string.account_sip_dtmf_type_sipinfo));

        createNewAccount(accountDetails);
    } catch (RemoteException e) {
        Toast.makeText(getActivity(), "Error creating account", Toast.LENGTH_SHORT).show();
        e.printStackTrace();
    }

}

From source file:org.gege.caldavsyncadapter.caldav.entities.DavCalendar.java

/**
 * creates a new androidCalendar/*from   ww w  .  j a v  a  2  s  .  co  m*/
 * @param serverCalendar
 * @param index
 * @param context
 * @return the new androidCalendar or null if fails
 */
private DavCalendar createNewAndroidCalendar(DavCalendar serverCalendar, int index,
        android.content.Context context) {
    Uri newUri = null;
    DavCalendar Result = null;

    final ContentValues contentValues = new ContentValues();
    contentValues.put(DavCalendar.URI, serverCalendar.getURI().toString());
    contentValues.put(DavCalendar.SERVERURL, this.ServerUrl);

    contentValues.put(Calendars.VISIBLE, 1);
    contentValues.put(Calendars.CALENDAR_DISPLAY_NAME, serverCalendar.getCalendarDisplayName());
    contentValues.put(Calendars.ACCOUNT_NAME, mAccount.name);
    contentValues.put(Calendars.ACCOUNT_TYPE, mAccount.type);
    contentValues.put(Calendars.OWNER_ACCOUNT, mAccount.name);
    contentValues.put(Calendars.SYNC_EVENTS, 1);
    contentValues.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_OWNER);

    if (!serverCalendar.getCalendarColorAsString().equals("")) {
        contentValues.put(Calendars.CALENDAR_COLOR, serverCalendar.getCalendarColor());
    } else {
        // find a color
        //int index = mList.size();
        index = index % CalendarColors.colors.length;
        contentValues.put(Calendars.CALENDAR_COLOR, CalendarColors.colors[index]);
    }

    try {
        newUri = mProvider.insert(asSyncAdapter(Calendars.CONTENT_URI, mAccount.name, mAccount.type),
                contentValues);
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    // it is possible that this calendar already exists but the provider failed to find it within isCalendarExist()
    // the adapter would try to create a new calendar but the provider fails again to create a new calendar.
    if (newUri != null) {
        long newCalendarId = ContentUris.parseId(newUri);

        Cursor cur = null;
        Uri uri = Calendars.CONTENT_URI;
        String selection = "(" + Calendars._ID + " = ?)";
        String[] selectionArgs = new String[] { String.valueOf(newCalendarId) };

        // Submit the query and get a Cursor object back. 
        try {
            cur = mProvider.query(uri, null, selection, selectionArgs, null);
        } catch (RemoteException e) {
            e.printStackTrace();
        }

        if (cur != null) {
            while (cur.moveToNext()) {
                Result = new DavCalendar(mAccount, mProvider, cur, this.Source, this.ServerUrl);
                Result.foundServerSide = true;
            }
            cur.close();
            //if (Result != null)
            //   this.mList.add(Result);
        }
        Log.i(TAG, "New calendar created : URI=" + Result.getAndroidCalendarUri());
        NotificationsHelper.signalSyncErrors(context, "CalDAV Sync Adapter",
                "new calendar found: " + Result.getCalendarDisplayName());
        mNotifyList.add(Result.getAndroidCalendarUri());
    }

    return Result;
}

From source file:org.ymkm.lib.controller.support.ControlledDialogFragment.java

@Override
public void onPause() {
    super.onPause();
    if (null != mControllerMessenger) {
        Message m = Message.obtain();// w w  w .  j  av  a 2  s . co  m
        m.what = FragmentController.MSG_DETACH_MESSAGE;
        m.arg1 = getControlId();
        m.obj = this;
        Bundle b = new Bundle();
        b.putString("controllableName", mControllableName);
        m.setData(b);
        try {
            mControllerMessenger.send(m);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
    mControllerMessenger = null;
}

From source file:org.ymkm.lib.controller.support.ControlledDialogFragment.java

/**
 * Sends a message to the controller via its supplied {@link Messenger}
 * <p>//from  w ww.  j  ava2s.  c o  m
 * A {@link ControlledDialogFragment} can only communicate with the
 * {@link FragmentController}.
 * </p>
 * The sent message wraps the actual message that will be dispatched by the
 * controller, and has the following values :
 * <dl>
 * <dt>what</dt>
 * <dd>{@link FragmentController#MSG_DISPATCH_MESSAGE} => Dispatches the
 * message in the controller</dd>
 * <dt>arg1</dt>
 * <dd>The control ID assigned to the ControlledDialogFragment that owns this
 * callback</dd>
 * <dt>arg2</dt>
 * <dd>The {@code what} passed as a parameter that needs to be dispatched</dd>
 * <dt>obj</dt>
 * <dd>{@link Message} that will get dispatched (the {@code what} will be
 * added to it)</dd>
 * </dl>
 * obj is a message instance that will eventually contain what, arg1, arg2,
 * obj passed as parameters of this method.<br>
 * 
 * @param what
 *            message ID to get dispatched by the controller
 * @param arg1
 *            first message int argument
 * @param arg2
 *            second message int argment
 * @param obj
 *            Object argument
 * @return {@code true} if message could be sent, {@code false} otherwise
 */
@Override
public final boolean sendToController(int what, int arg1, int arg2, Object obj) {
    if (null != mControllerMessenger) {
        Message m = Message.obtain();
        m.what = FragmentController.MSG_DISPATCH_MESSAGE;
        m.arg1 = getControlId();
        m.arg2 = what;
        m.obj = FragmentController.CallbackMessage.obtain(arg1, arg2, obj);
        Bundle b = new Bundle();
        b.putString("controllableName", mControllableName);
        m.setData(b);
        try {
            mControllerMessenger.send(m);
        } catch (RemoteException e) {
            e.printStackTrace();
            return false;
        }
    }
    return true;
}

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

private void addRegion(JSONArray data, CallbackContext callbackContext) throws JSONException {

    final JSONObject data2 = data.getJSONObject(0);

    final CallbackContext callbackContext2 = callbackContext;

    cordova.getThreadPool().execute(new Runnable() {
        @Override/*from  w  w  w.j a  v  a 2  s . c  o m*/
        public void run() {
            try {
                String iden = data2.getString("identifier");
                String uuid = data2.getString("uuid");
                Integer major = data2.getInt("major");
                Integer minor = data2.getInt("minor");
                beaconsData.put(iden, data2);

                Region region = new Region(iden, uuid, major, minor);
                iBeaconManager.startMonitoringBeaconsInRegion(region);
                // iBeaconManager.startMonitoringBeaconsInRegion(new
                // Region("", null, null, null));
                callbackContext2.success();

            } catch (RemoteException e) {
                callbackContext2.error("Could not add region");
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    });

}

From source file:org.ymkm.lib.controller.support.ControlledDialogFragment.java

@Override
public void onResume() {
    super.onResume();
    Activity activity = getActivity();/*from  www.  j  a va2s . c om*/
    if (activity instanceof ControllableActivity) {
        FragmentController controller = ((ControllableActivity) activity).getController();
        mControllerMessenger = controller.getMessenger();
    }

    if (null != mControllerMessenger) {
        Message m = Message.obtain();
        m.what = FragmentController.MSG_ATTACH_MESSAGE;
        m.arg1 = getControlId();
        m.obj = this;
        Bundle b = new Bundle();
        b.putString("controllableName", mControllableName);
        m.setData(b);
        try {
            mControllerMessenger.send(m);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}

From source file:fr.mixit.android.ui.fragments.SessionDetailsFragment.java

public void refreshSessionData() {
    if (mIsBound && mServiceReady) {
        setRefreshMode(true);//from   ww  w .j  a  va  2  s . co m

        final Message msg = Message.obtain(null,
                MixItContract.Sessions.FORMAT_LIGHTNING_TALK.equalsIgnoreCase(mSessionFormat)
                        ? MixItService.MSG_LIGHTNING_TALK
                        : MixItService.MSG_TALK,
                0, 0);
        msg.replyTo = mMessenger;
        final Bundle b = new Bundle();
        b.putInt(MixItService.EXTRA_ID, mSessionId);
        msg.setData(b);
        try {
            mService.send(msg);
        } catch (final RemoteException e) {
            e.printStackTrace();
        }

        mIsFirstLoad = false;
    }
}