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:cx.ring.fragments.CallFragment.java

public void onKeyUp(int keyCode, KeyEvent event) {
    try {/*from   www.ja  va2s. c o m*/

        switch (keyCode) {
        case KeyEvent.KEYCODE_VOLUME_DOWN:
        case KeyEvent.KEYCODE_VOLUME_UP:
            break;
        default:
            String toSend = Character.toString(event.getDisplayLabel());
            toSend = toSend.toUpperCase(Locale.getDefault());
            Log.d(TAG, "toSend " + toSend);
            mCallbacks.getRemoteService().playDtmf(toSend);
            break;
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    } catch (NullPointerException e) {
        e.printStackTrace();
    }
}

From source file:com.smedic.tubtub.BackgroundAudioService.java

/**
 * Initializes media sessions and receives media events
 *///w w  w .j  a  v a2  s.  com
private void initMediaSessions() {
    PendingIntent buttonReceiverIntent = PendingIntent.getBroadcast(getApplicationContext(), 0,
            new Intent(Intent.ACTION_MEDIA_BUTTON), PendingIntent.FLAG_UPDATE_CURRENT);

    mSession = new MediaSessionCompat(getApplicationContext(), "simple player session", null,
            buttonReceiverIntent);

    try {
        mController = new MediaControllerCompat(getApplicationContext(), mSession.getSessionToken());

        mSession.setCallback(new MediaSessionCompat.Callback() {
            @Override
            public void onPlay() {
                super.onPlay();
                buildNotification(generateAction(android.R.drawable.ic_media_pause, "Pause", ACTION_PAUSE));
            }

            @Override
            public void onPause() {

                super.onPause();
                pauseVideo();
                buildNotification(generateAction(android.R.drawable.ic_media_play, "Play", ACTION_PLAY));
            }

            @Override
            public void onSkipToNext() {
                super.onSkipToNext();
                playNext();
                buildNotification(generateAction(android.R.drawable.ic_media_pause, "Pause", ACTION_PAUSE));
            }

            @Override
            public void onSkipToPrevious() {
                super.onSkipToPrevious();
                playPrevious();
                buildNotification(generateAction(android.R.drawable.ic_media_pause, "Pause", ACTION_PAUSE));
            }

            @Override
            public void onStop() {
                super.onStop();
                stopPlayer();
                //remove notification and stop service
                NotificationManager notificationManager = (NotificationManager) getApplicationContext()
                        .getSystemService(Context.NOTIFICATION_SERVICE);
                notificationManager.cancel(1);
                Intent intent = new Intent(getApplicationContext(), BackgroundAudioService.class);
                stopService(intent);
            }

            @Override
            public void onSetRating(RatingCompat rating) {
                super.onSetRating(rating);
            }
        });
    } catch (RemoteException re) {
        re.printStackTrace();
    }
}

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

private void initOutGoingCallDisplay() {
    Log.i(TAG, "Start outgoing display");

    final SipCall call = getConference().getParticipants().get(0);
    initContactDisplay(call);// ww  w.j a  va  2s. c  o m

    acceptButton.setVisibility(View.GONE);
    refuseButton.setVisibility(View.GONE);

    hangupButton.setVisibility(View.VISIBLE);
    hangupButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                mCallbacks.getRemoteService().hangUp(call.getCallId());
                mCallbacks.terminateCall();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    });

}

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

private void initNormalStateDisplay() {
    Log.i(TAG, "Start normal display");
    mCallbacks.startTimer();// ww w  . j  a  va 2  s. c o  m
    acceptButton.setVisibility(View.GONE);
    refuseButton.setVisibility(View.GONE);

    final SipCall call = getConference().getParticipants().get(0);
    final String call_id = call.getCallId();
    initContactDisplay(call);

    hangupButton.setVisibility(View.VISIBLE);
    hangupButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            try {
                mCallbacks.getRemoteService().hangUp(call_id);
                mCallbacks.terminateCall();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
        }
    });

    updateSecurityDisplay();
}

From source file:com.example.activitydemo.app.service.GameService.java

public void updateScore(long score) {
    if (mBinderService.isConnected()) {
        try {/*from w w w  . j  a va2  s  .c om*/
            mBinderService.mCallbacks.onScoreChanged(score);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}

From source file:com.turbulenz.turbulenz.googlepayment.java

void threadQueryProduct(final String sku, final long context) {
    ArrayList skuList = new ArrayList();
    skuList.add(sku);//from   w  ww.j  av a2  s .co m
    Bundle productQueryBundle = new Bundle();
    productQueryBundle.putStringArrayList("ITEM_ID_LIST", skuList);

    Bundle skuDetails;
    try {
        skuDetails = mService.getSkuDetails(3, mActivity.getPackageName(), ITEM_TYPE_INAPP, productQueryBundle);
    } catch (RemoteException e) {
        _error("threadQueryProduct: remote exception: " + e);
        e.printStackTrace();
        sendProductInfoError(context, sku);
        return;
    }

    int response = getResponseCodeFromBundle(skuDetails);
    if (BILLING_RESPONSE_RESULT_OK != response) {
        _log("threadQueryProduct: bad response from getSkuDetails: " + response);
        sendProductInfoError(context, sku);
        return;
    }

    if (!skuDetails.containsKey(RESPONSE_GET_SKU_DETAILS_LIST)) {
        _log("threadQueryProduct: bundle doens't contain list");
        sendProductInfoError(context, sku);
        return;
    }

    ArrayList<String> responseList = skuDetails.getStringArrayList(RESPONSE_GET_SKU_DETAILS_LIST);

    if (1 != responseList.size()) {
        _log("threadQueryProduct: repsonse list has unexpected length: " + responseList.size());
        sendProductInfoError(context, sku);
        return;
    }

    String responseString = responseList.get(0);
    try {
        JSONObject o = new JSONObject(responseString);
        final String _sku = o.getString("productId");
        final String title = o.getString("title");
        final String description = o.getString("description");

        // TODO: something with price
        final String price = o.getString("price");

        // TOOD: check _sku == sku

        sendProductInfo(context, sku, title, description, price);
    } catch (JSONException e) {
        _error("threadQueryProduct: failed parsing JSON");
        sendProductInfoError(context, sku);
    }
}

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

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    SipCall transfer;/*from ww  w  . j a v a 2 s .  c o m*/
    if (requestCode == REQUEST_TRANSFER) {
        switch (resultCode) {
        case TransferDFragment.RESULT_TRANSFER_CONF:
            Conference c = data.getParcelableExtra("target");
            transfer = data.getParcelableExtra("transfer");
            try {

                mCallbacks.getRemoteService().attendedTransfer(transfer.getCallId(),
                        c.getParticipants().get(0).getCallId());

            } catch (RemoteException e) {
                e.printStackTrace();
            }
            break;

        case TransferDFragment.RESULT_TRANSFER_NUMBER:
            String to = data.getStringExtra("to_number");
            transfer = data.getParcelableExtra("transfer");
            try {
                mCallbacks.getRemoteService().transfer(transfer.getCallId(), to);
                mCallbacks.getRemoteService().hangUp(transfer.getCallId());
            } catch (RemoteException e) {
                e.printStackTrace();
            }
            break;
        case Activity.RESULT_CANCELED:
        default:
            initNormalStateDisplay();
            break;
        }
    }
}

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

private void initIncomingCallDisplay() {
    Log.i(TAG, "Start incoming display");
    if (mCallbacks.getService().getAccount(getConference().getParticipants().get(0).getAccount())
            .isAutoanswerEnabled()) {//  w w w .  ja  va2s.c  o  m
        try {
            mCallbacks.getRemoteService().accept(getConference().getParticipants().get(0).getCallId());
        } catch (RemoteException e) {
            e.printStackTrace();
        } catch (NullPointerException e) {
            e.printStackTrace();
        }
    } else {
        final SipCall call = getConference().getParticipants().get(0);
        initContactDisplay(call);
        acceptButton.setVisibility(View.VISIBLE);
        acceptButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                acceptButton.setOnClickListener(null);
                refuseButton.setOnClickListener(null);
                try {
                    mCallbacks.getRemoteService().accept(call.getCallId());
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        });
        refuseButton.setVisibility(View.VISIBLE);
        refuseButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                acceptButton.setOnClickListener(null);
                refuseButton.setOnClickListener(null);
                try {
                    mCallbacks.getRemoteService().refuse(call.getCallId());
                    mCallbacks.terminateCall();
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        });
        hangupButton.setVisibility(View.GONE);
    }
}

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

/**
 * example: 1143/* ww w  .  ja  va2  s .  c  o  m*/
 */
public void setCTag(String cTag, boolean Update) {
    this.setContentValueAsString(DavCalendar.CTAG, cTag);
    if (Update) {
        //serverCalendar.updateAndroidCalendar(androidCalendarUri, Calendar.CTAG, serverCalendar.getcTag());
        try {
            this.updateAndroidCalendar(this.getAndroidCalendarUri(), CTAG, cTag);
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}

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

/**
 * COMPAT: the calendar Uri was stored as calendar Name. this function updates the URI (_SYNC_ID)
 * @param calendarUri the real calendarUri
 * @return success of this function/* w  w  w  . ja  v  a 2 s  .c  o m*/
 */
private boolean correctSyncID(String calendarUri) {
    boolean Result = false;
    Log.v(TAG,
            "correcting SyncID for calendar:" + this.getContentValueAsString(Calendars.CALENDAR_DISPLAY_NAME));

    ContentValues mUpdateValues = new ContentValues();
    mUpdateValues.put(DavCalendar.URI, calendarUri);

    try {
        mProvider.update(this.SyncAdapterCalendar(), mUpdateValues, null, null);
        Result = true;
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    return Result;
}