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:mobilelecture.cdp12_app.RecoRangingActivity.java

@Override
protected void stop(ArrayList<RECOBeaconRegion> regions) {
    for (RECOBeaconRegion region : regions) {
        try {//from   ww w .  j  av a2 s  .c  o m
            mRecoManager.stopRangingBeaconsInRegion(region);
        } catch (RemoteException e) {
            Log.i("RECORangingActivity", "Remote Exception");
            e.printStackTrace();
        } catch (NullPointerException e) {
            Log.i("RECORangingActivity", "Null Pointer Exception");
            e.printStackTrace();
        }
    }
}

From source file:com.drinviewer.droiddrinviewer.ServerListFragment.java

/**
 * Updates isPaired status on an Host and redraws the
 * list to set the appropriate icon/*from  w  w  w  .j  ava2 s  .  c o  m*/
 * 
 * @param position the position of the host to be paired in the list
 * @param isPaired true if the host is paired
 */
public void updateIsPaired(int position, boolean isPaired) {
    getAdapter().updateIsPaired(position, isPaired);
    getAdapter().notifyDataSetChanged();

    // notify the DiscoverServerService of the change
    try {
        if (discoverServerApi != null) {
            discoverServerApi.updatePairState(position, isPaired);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:com.yangtsaosoftware.pebblemessenger.services.NotificationService.java

@Override
public void onNotificationPosted(StatusBarNotification sbn) {
    if (sbn == null)
        return;//from  w w w  . jav a 2 s  .  c  om
    Constants.log(LOG_TAG, "New Access Event:" + sbn.getPackageName() + " tag:" + sbn.getTag());
    /*if(event.getEventType()!= AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED){
            
    return;
    }
    */
    PowerManager powMan = (PowerManager) this.getSystemService(POWER_SERVICE);
    if (!notifScreenOn && powMan.isScreenOn()) {
        Constants.log(LOG_TAG, "because screen out!");
        return;
    }
    //Parcelable parcelable=event.getParcelableData();
    //if(!(parcelable instanceof Notification)) return;
    Notification notif = sbn.getNotification();
    if (sbn.isOngoing()) {
        Constants.log(LOG_TAG, "because is Ongoing!");
        return;
    }

    String eventPackageName;

    if (sbn.getPackageName() != null) {
        eventPackageName = sbn.getPackageName();
    } else {
        Constants.log(LOG_TAG, "Can't get event package name. Returning.");
        return;
    }

    boolean found = false;
    for (String packageName : packages) {
        if (packageName.equalsIgnoreCase(eventPackageName)) {
            found = true;
            break;
        }
    }
    if (!found) {
        Constants.log(LOG_TAG, eventPackageName + " was not found in the include list. Returning.");
        return;
    }
    String title = eventPackageName.substring(eventPackageName.lastIndexOf('.') + 1);
    // get the notification text
    Bundle notiBundle = notif.extras;
    StringBuilder notifySb = new StringBuilder();
    CharSequence notifyChars = notiBundle.getCharSequence(Notification.EXTRA_TITLE);
    if (notifyChars != null) {
        notifySb.append(notifyChars);
    } else {
        Constants.log(LOG_TAG, "empty message title,return!");
        return;
    }

    CharSequence bodyCS = notiBundle.getCharSequence(Notification.EXTRA_TEXT);
    if (bodyCS != null) {
        notifySb.append(":");
        notifySb.append(bodyCS);
    } else {
        Constants.log(LOG_TAG, "empty message body,return!" + notifySb.toString());
        return;
    }
    bodyCS = notiBundle.getCharSequence(Notification.EXTRA_SUB_TEXT);
    if (bodyCS != null) {
        notifySb.append(bodyCS);
    }

    Message msg = Message.obtain();
    msg.what = MessageProcessingService.MSG_NEW_MESSAGE;
    Bundle b = new Bundle();
    b.putString(MessageDbHandler.COL_MESSAGE_APP, title);
    b.putString(MessageDbHandler.COL_MESSAGE_CONTENT, notifySb.toString());
    Constants.log(LOG_TAG, "Send new message title:" + title + " body:" + notifySb.toString());
    msg.setData(b);
    try {
        rMessageProcessHandler.send(msg);
    } catch (RemoteException e) {
        e.printStackTrace();
        Constants.log(LOG_TAG, "Error when sending message to MessageProcessingService.");
    }
}

From source file:com.a3did.partner.recosample.RecoBackgroundMonitoringService.java

private void startMonitoring() {
    Log.i("BackMonitoringService", "startMonitoring()");

    mRecoManager.setScanPeriod(mScanDuration);
    mRecoManager.setSleepPeriod(mSleepDuration);

    for (RECOBeaconRegion region : mRegions) {
        try {/*from   w w w .  ja va  2 s .c  om*/
            mRecoManager.startMonitoringForRegion(region);
        } catch (RemoteException e) {
            Log.e("BackMonitoringService",
                    "RemoteException has occured while executing RECOManager.startMonitoringForRegion()");
            e.printStackTrace();
        } catch (NullPointerException e) {
            Log.e("BackMonitoringService",
                    "NullPointerException has occured while executing RECOManager.startMonitoringForRegion()");
            e.printStackTrace();
        }
    }
}

From source file:com.terracom.mumbleclient.channel.ChannelListFragment.java

@Override
public void onLocalUserStateUpdated(final User user) {
    try {/*from w w  w.  jav  a  2s. co m*/
        mChannelListAdapter.notifyDataSetChanged();

        // Add or remove registered user from local mute history
        final QRPushToTalkDatabase database = mDatabaseProvider.getDatabase();
        final Server server = getService().getConnectedServer();

        if (user.getUserId() >= 0 && server.isSaved()) {
            new Thread(new Runnable() {
                @Override
                public void run() {
                    if (user.isLocalMuted()) {
                        database.addLocalMutedUser(server.getId(), user.getUserId());
                    } else {
                        database.removeLocalMutedUser(server.getId(), user.getUserId());
                    }
                    if (user.isLocalIgnored()) {
                        database.addLocalIgnoredUser(server.getId(), user.getUserId());
                    } else {
                        database.removeLocalIgnoredUser(server.getId(), user.getUserId());
                    }
                }
            }).start();
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:org.musicmod.android.app.MusicBrowserActivity.java

private void updatePlayPauseButton() {
    if (mService == null)
        return;//www  .  java  2s  .c  om
    try {
        if (mService.isPlaying()) {
            mPlayPauseButton.setImageResource(R.drawable.ic_action_media_pause);
        } else {
            mPlayPauseButton.setImageResource(R.drawable.ic_action_media_play);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:com.terracom.mumbleclient.channel.ChannelListFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    MenuItem muteItem = menu.findItem(R.id.menu_mute_button);
    MenuItem deafenItem = menu.findItem(R.id.menu_deafen_button);

    try {/*  w  w  w  .  ja  v a2 s  . c  om*/
        if (getService() != null && getService().isConnected() && getService().getSessionUser() != null) {
            // Color the action bar icons to the primary text color of the theme, TODO move this elsewhere
            int foregroundColor = getActivity().getTheme()
                    .obtainStyledAttributes(new int[] { android.R.attr.textColorPrimaryInverse })
                    .getColor(0, -1);

            User self = getService().getSessionUser();
            muteItem.setIcon(self.isSelfMuted() ? R.drawable.ic_action_microphone_muted
                    : R.drawable.ic_action_microphone);
            deafenItem.setIcon(
                    self.isSelfDeafened() ? R.drawable.ic_action_audio_muted : R.drawable.ic_action_audio);
            muteItem.getIcon().mutate().setColorFilter(foregroundColor, PorterDuff.Mode.MULTIPLY);
            deafenItem.getIcon().mutate().setColorFilter(foregroundColor, PorterDuff.Mode.MULTIPLY);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }

    /*try {
    if(getService() != null) {
        MenuItem bluetoothItem = menu.findItem(R.id.menu_bluetooth);
        bluetoothItem.setChecked(getService().isBluetoothAvailable());
    }
    } catch (RemoteException e) {
    e.printStackTrace();
    }*/
}

From source file:me.trashout.service.TrashHunterService.java

private void makeUseOfNewLocation(LatLng location) throws IOException {
    Log.d("TrashHunter", "makeUseOfNewLocation: new location = " + location + " - this = " + this.toString());
    Log.d("TrashHunter", "makeUseOfNewLocation: "
            + PositionUtils.centerPointAndRadiusToBounds(location, trashHunterState.getAreaSize()));

    Call<List<Trash>> call = getApiServer()
            .getTrashList(ApiGetTrashListParam.getTrashHunterOptions(location, trashHunterState.getAreaSize()));
    call.enqueue(new Callback<List<Trash>>() {
        @Override//from  w w  w  .ja  va 2s.  c o m
        public void onResponse(Call<List<Trash>> call, Response<List<Trash>> response) {
            if (response.isSuccessful()) {

                int trashChangeCount = 0;
                if ((trashChangeCount = getTrashListChangeCount(response.body())) > 0
                        && !isApplicationOnTop()) {
                    createNotification(trashChangeCount, trashHunterState.getAreaSize());
                }

                try {
                    updateListener(false, response.body().size());
                } catch (RemoteException e) {
                    e.printStackTrace();
                }
            }
        }

        @Override
        public void onFailure(Call<List<Trash>> call, Throwable t) {
        }
    });

}

From source file:mobilelecture.cdp12_app.RecoRangingActivity.java

@Override
protected void start(ArrayList<RECOBeaconRegion> regions) {

    /**//  www  .  jav  a  2s  .  c  o m
     * There is a known android bug that some android devices scan BLE devices only once. (link: http://code.google.com/p/android/issues/detail?id=65863)
     * To resolve the bug in our SDK, you can use setDiscontinuousScan() method of the RECOBeaconManager.
     * This method is to set whether the device scans BLE devices continuously or discontinuously.
     * The default is set as FALSE. Please set TRUE only for specific devices.
     *
     * mRecoManager.setDiscontinuousScan(true);
     */

    for (RECOBeaconRegion region : regions) {
        try {
            mRecoManager.startRangingBeaconsInRegion(region);
        } catch (RemoteException e) {
            Log.i("RECORangingActivity", "Remote Exception");
            e.printStackTrace();
        } catch (NullPointerException e) {
            Log.i("RECORangingActivity", "Null Pointer Exception");
            e.printStackTrace();
        }
    }

}

From source file:com.piusvelte.mosaic.android.MosaicMap.java

@Override
public void onServiceConnected(ComponentName name, IBinder service) {
    iLocationService = ILocationService.Stub.asInterface(service);
    try {//from ww w . j  a  v  a2s. c  o m
        iLocationService.setCallback(iMain);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}