List of usage examples for android.os RemoteException printStackTrace
public void printStackTrace()
From source file:org.gateshipone.odyssey.fragments.FilesFragment.java
/** * Call the PBS to play the selected file. * A previous playlist will be cleared./* w w w . j a v a 2 s. c o m*/ * * @param position the position of the selected file */ private void playFile(int position) { // clear playlist and play selected file try { mServiceConnection.getPBS().clearPlaylist(); enqueueFile(position, false); mServiceConnection.getPBS().jumpTo(0); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }
From source file:org.gateshipone.odyssey.fragments.FilesFragment.java
/** * Call the PBS to play all music files from the selected folder (excluding subfolders) and starts with the selected file. * A previous playlist will be cleared.//from w w w. j a v a 2 s . c o m * * @param position the position of the selected file in the adapter */ private void playFolder(int position) { try { mServiceConnection.getPBS().clearPlaylist(); mServiceConnection.getPBS().enqueueDirectory(mCurrentDirectory.getPath()); // compute position int index = position - mCurrentDirectory.getNumberOfSubFolders(); mServiceConnection.getPBS().jumpTo(index); } catch (RemoteException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } }
From source file:com.morlunk.mumbleclient.service.PlumbleService.java
/** * Called when the user makes a change to their preferences. Should update all preferences relevant to the service. *//*from www . j a va2 s .co m*/ @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { if (!isConnected()) return; // These properties should all be set on connect regardless. if (Settings.PREF_INPUT_METHOD.equals(key)) { /* Convert input method defined in settings to an integer format used by Jumble. */ int inputMethod = mSettings.getJumbleInputMethod(); try { getBinder().setTransmitMode(inputMethod); } catch (RemoteException e) { e.printStackTrace(); } mChannelOverlay.setPushToTalkShown(inputMethod == Constants.TRANSMIT_PUSH_TO_TALK); } else if (Settings.PREF_HANDSET_MODE.equals(key)) { setProximitySensorOn(mSettings.isHandsetMode()); } else if (Settings.PREF_THRESHOLD.equals(key)) { try { getBinder().setVADThreshold(mSettings.getDetectionThreshold()); } catch (RemoteException e) { e.printStackTrace(); } } else if (Settings.PREF_HOT_CORNER_KEY.equals(key)) { mHotCorner.setGravity(mSettings.getHotCornerGravity()); mHotCorner.setShown(mSettings.isHotCornerEnabled()); } else if (Settings.PREF_USE_TTS.equals(key)) { if (mTTS == null && mSettings.isTextToSpeechEnabled()) mTTS = new TextToSpeech(this, mTTSInitListener); else if (mTTS != null && !mSettings.isTextToSpeechEnabled()) { mTTS.shutdown(); mTTS = null; } } else if (Settings.PREF_AMPLITUDE_BOOST.equals(key)) { try { getBinder().setAmplitudeBoost(mSettings.getAmplitudeBoostMultiplier()); } catch (RemoteException e) { e.printStackTrace(); } } else if (Settings.PREF_HALF_DUPLEX.equals(key)) { try { getBinder().setHalfDuplex(mSettings.isHalfDuplex()); } catch (RemoteException e) { e.printStackTrace(); } } else if (Settings.PREF_PTT_SOUND.equals(key)) { mPTTSoundEnabled = mSettings.isPttSoundEnabled(); } }
From source file:com.androzic.plugin.tracker.SMSReceiver.java
@Override public void onReceive(Context context, Intent intent) { String Sender = ""; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); Log.e(TAG, "SMS received"); Bundle extras = intent.getExtras();/*from w w w . ja v a2 s . c om*/ if (extras == null) return; StringBuilder messageBuilder = new StringBuilder(); Object[] pdus = (Object[]) extras.get("pdus"); for (int i = 0; i < pdus.length; i++) { SmsMessage msg = SmsMessage.createFromPdu((byte[]) pdus[i]); String text = msg.getMessageBody(); Sender = msg.getDisplayOriginatingAddress(); Log.w(TAG, "Sender: " + Sender); if (text == null) continue; messageBuilder.append(text); } String text = messageBuilder.toString(); boolean flexMode = prefs.getBoolean(context.getString(R.string.pref_tracker_use_flex_mode), context.getResources().getBoolean(R.bool.def_flex_mode)); Log.i(TAG, "SMS: " + text); Tracker tracker = new Tracker(); if (!parseXexunTK102(text, tracker) && !parseJointechJT600(text, tracker) && !parseTK102Clone1(text, tracker) && !(parseFlexMode(text, tracker) && flexMode)) return; if (tracker.message != null) { tracker.message = tracker.message.trim(); if ("".equals(tracker.message)) tracker.message = null; } tracker.sender = Sender; if (!"".equals(tracker.sender)) { // Save tracker data TrackerDataAccess dataAccess = new TrackerDataAccess(context); dataAccess.updateTracker(tracker); try { Application application = Application.getApplication(); tracker = dataAccess.getTracker(tracker.sender);//get latest positon of tracker application.sendTrackerOnMap(dataAccess, tracker); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } dataAccess.close(); context.sendBroadcast(new Intent(Application.TRACKER_DATE_RECEIVED_BROADCAST)); // Show notification boolean notifications = prefs.getBoolean(context.getString(R.string.pref_tracker_notifications), context.getResources().getBoolean(R.bool.def_notifications)); if (notifications) { Intent i = new Intent("com.androzic.COORDINATES_RECEIVED"); i.putExtra("title", tracker.message != null ? tracker.message : tracker.name); i.putExtra("sender", tracker.name); i.putExtra("origin", context.getApplicationContext().getPackageName()); i.putExtra("lat", tracker.latitude); i.putExtra("lon", tracker.longitude); String msg = context.getString(R.string.notif_text, tracker.name); NotificationCompat.Builder builder = new NotificationCompat.Builder(context); builder.setContentTitle(context.getString(R.string.app_name)); if (tracker.message != null) builder.setContentText(tracker.name + ": " + tracker.message); else builder.setContentText(msg); PendingIntent contentIntent = PendingIntent.getBroadcast(context, (int) tracker._id, i, PendingIntent.FLAG_ONE_SHOT); builder.setContentIntent(contentIntent); builder.setSmallIcon(R.drawable.ic_stat_tracker); builder.setTicker(msg); builder.setWhen(tracker.time); int defaults = Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND; boolean vibrate = prefs.getBoolean(context.getString(R.string.pref_tracker_vibrate), context.getResources().getBoolean(R.bool.def_vibrate)); if (vibrate) defaults |= Notification.DEFAULT_VIBRATE; builder.setDefaults(defaults); builder.setAutoCancel(true); Notification notification = builder.build(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify((int) tracker._id, notification); } // Conceal SMS boolean concealsms = prefs.getBoolean(context.getString(R.string.pref_tracker_concealsms), context.getResources().getBoolean(R.bool.def_concealsms)); if (concealsms) abortBroadcast(); } }
From source file:edu.vuum.mocca.ui.story.CreateStoryFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Get the EditTexts titleET = (EditText) getView().findViewById(R.id.story_create_value_title); bodyET = (EditText) getView().findViewById(R.id.story_create_value_body); audioCaptureButton = (Button) getView().findViewById(R.id.story_create_value_audio_link); videoCaptureButton = (Button) getView().findViewById(R.id.story_create_value_video_button); imageNameET = (EditText) getView().findViewById(R.id.story_create_value_image_name); imageCaptureButton = (Button) getView().findViewById(R.id.story_create_value_image_button); storyTimeET = (TextView) getView().findViewById(R.id.story_create_value_story_time); locationButton = (Button) getView().findViewById(R.id.story_create_value_location_button); imageLocation = (TextView) getView().findViewById(R.id.story_create_value_image_location); videoLocation = (TextView) getView().findViewById(R.id.story_create_value_video_location); audioLocation = (TextView) getView().findViewById(R.id.story_create_value_audio_location); latitudeValue = (TextView) getView().findViewById(R.id.story_create_value_latitude); longitudeValue = (TextView) getView().findViewById(R.id.story_create_value_longitude); buttonClear = (Button) getView().findViewById(R.id.story_create_button_reset); buttonCancel = (Button) getView().findViewById(R.id.story_create_button_cancel); buttonCreate = (Button) getView().findViewById(R.id.story_create_button_save); buttonClear.setOnClickListener(new OnClickListener() { @Override// w w w . ja va 2 s .co m public void onClick(View v) { titleET.setText("" + ""); bodyET.setText("" + ""); videoCaptureButton.setText("" + ""); imageNameET.setText("" + ""); imageCaptureButton.setText("" + ""); storyTimeET.setText("" + 0); locationButton.setText("" + 0); } }); buttonCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (getResources().getBoolean(R.bool.isTablet) == true) { // put mOpener.openViewStoryFragment(0); } else { getActivity().finish(); // same as hitting 'back' button } } }); buttonCreate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // local Editables Editable titleCreateable = titleET.getText(); Editable bodyCreateable = bodyET.getText(); Editable imageNameCreateable = imageNameET.getText(); String storyTimeCreateable = storyTimeET.getText().toString(); // Try to parse the date into long format try { date = StoryData.FORMAT.parse(storyTimeCreateable.toString()); } catch (ParseException e1) { // TODO Auto-generated catch block Log.e("CreateStoryFragment", "Date was not parsable, reverting to current time"); date = new Date(); } // For future expansion: The loginId and storyId need to be generated by the system long loginId = 0; long storyId = 0; String title = ""; String body = ""; String audioLink = ""; String videoLink = ""; String imageName = ""; String imageData = ""; long storyTime = 0; double latitude = 0; double longitude = 0; // pull values from Editables title = String.valueOf(titleCreateable.toString()); body = String.valueOf(bodyCreateable.toString()); if (audioPath != null) audioLink = audioPath; if (fileUri != null) videoLink = fileUri.toString(); imageName = String.valueOf(imageNameCreateable.toString()); if (imagePathFinal != null) imageData = imagePathFinal.toString(); if (loc != null) { latitude = loc.getLatitude(); longitude = loc.getLongitude(); } storyTime = date.getTime(); Log.i(LOG_TAG, String.valueOf(storyTime)); // new StoryData object with above info StoryData newData = new StoryData(-1, // -1 row index, because there is no way to know which // row it will go into loginId, storyId, title, body, audioLink, videoLink, imageName, imageData, "", 0, storyTime, latitude, longitude); Log.d(CreateStoryFragment.class.getCanonicalName(), "imageName" + imageNameET.getText()); Log.d(CreateStoryFragment.class.getCanonicalName(), "newStoryData:" + newData); // insert it through Resolver to be put into ContentProvider try { resolver.insert(newData); } catch (RemoteException e) { Log.e(LOG_TAG, "Caught RemoteException => " + e.getMessage()); e.printStackTrace(); } // return back to proper state if (getResources().getBoolean(R.bool.isTablet) == true) { // put mOpener.openViewStoryFragment(0); } else { getActivity().finish(); // same as hitting 'back' button } } }); }
From source file:com.ariesmcrae.mymemories.ui.story.CreateStoryFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // Get the EditTexts titleET = (EditText) getView().findViewById(R.id.story_create_value_title); bodyET = (EditText) getView().findViewById(R.id.story_create_value_body); audioCaptureButton = (Button) getView().findViewById(R.id.story_create_value_audio_link); videoCaptureButton = (Button) getView().findViewById(R.id.story_create_value_video_button); imageNameET = (EditText) getView().findViewById(R.id.story_create_value_image_name); imageCaptureButton = (Button) getView().findViewById(R.id.story_create_value_image_button); storyTimeET = (TextView) getView().findViewById(R.id.story_create_value_story_time); locationButton = (Button) getView().findViewById(R.id.story_create_value_location_button); imageLocation = (TextView) getView().findViewById(R.id.story_create_value_image_location); videoLocation = (TextView) getView().findViewById(R.id.story_create_value_video_location); audioLocation = (TextView) getView().findViewById(R.id.story_create_value_audio_location); latitudeValue = (TextView) getView().findViewById(R.id.story_create_value_latitude); longitudeValue = (TextView) getView().findViewById(R.id.story_create_value_longitude); buttonClear = (Button) getView().findViewById(R.id.story_create_button_reset); buttonCancel = (Button) getView().findViewById(R.id.story_create_button_cancel); buttonCreate = (Button) getView().findViewById(R.id.story_create_button_save); buttonClear.setOnClickListener(new OnClickListener() { @Override//from w w w . j a v a 2 s.c om public void onClick(View v) { titleET.setText("" + ""); bodyET.setText("" + ""); imageNameET.setText("" + ""); imageLocation.setText("" + ""); videoLocation.setText("" + ""); audioLocation.setText("" + ""); storyTimeET.setText("Click text to set"); latitudeValue.setText("" + "0"); longitudeValue.setText("" + "0"); } }); buttonCancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (getResources().getBoolean(R.bool.isTablet) == true) { // put mOpener.openViewStoryFragment(0); } else { getActivity().finish(); // same as hitting 'back' button } } }); buttonCreate.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // local Editables Editable titleCreateable = titleET.getText(); Editable bodyCreateable = bodyET.getText(); Editable imageNameCreateable = imageNameET.getText(); String storyTimeCreateable = storyTimeET.getText().toString(); // Try to parse the date into long format try { date = StoryData.FORMAT.parse(storyTimeCreateable.toString()); } catch (ParseException e1) { Log.e("CreateStoryFragment", "Date was not parsable, reverting to current time"); date = new Date(); } // For future expansion: The loginId and storyId need to be // generated by the system long loginId = 0; long storyId = 0; String title = ""; String body = ""; String audioLink = ""; String videoLink = ""; String imageName = ""; String imageData = ""; long storyTime = 0; double latitude = 0; double longitude = 0; // pull values from Editables title = String.valueOf(titleCreateable.toString()); body = String.valueOf(bodyCreateable.toString()); if (audioPath != null) audioLink = audioPath; if (fileUri != null) videoLink = fileUri.toString(); imageName = String.valueOf(imageNameCreateable.toString()); if (imagePathFinal != null) imageData = imagePathFinal.toString(); if (loc != null) { latitude = loc.getLatitude(); longitude = loc.getLongitude(); } storyTime = date.getTime(); Log.i(LOG_TAG, String.valueOf(storyTime)); // new StoryData object with above info StoryData newData = new StoryData(-1, // -1 row index, because there is no way to know which // row it will go into loginId, storyId, title, body, audioLink, videoLink, imageName, imageData, "", 0, storyTime, latitude, longitude); Log.d(CreateStoryFragment.class.getCanonicalName(), "imageName" + imageNameET.getText()); Log.d(CreateStoryFragment.class.getCanonicalName(), "newStoryData:" + newData); // insert it through Resolver to be put into ContentProvider try { resolver.insert(newData); } catch (RemoteException e) { Log.e(LOG_TAG, "Caught RemoteException => " + e.getMessage()); e.printStackTrace(); } // return back to proper state if (getResources().getBoolean(R.bool.isTablet) == true) { // put mOpener.openViewStoryFragment(0); } else { getActivity().finish(); // same as hitting 'back' button } } }); }
From source file:com.github.michalbednarski.intentslab.editor.BundleAdapter.java
public Bundle getBundle() { if (mUseSandbox && mSandboxedBundle != null) { try {//from w w w . j a v a 2 s . co m mBundle = mSandboxedBundle.getBundle(); } catch (RemoteException e) { // There was some problem with sandbox, // but we can't do anything about that e.printStackTrace(); } } return mBundle; }
From source file:com.yschi.castscreen.MainActivity.java
private void doUnbindService() { if (mServiceMessenger != null) { try {// w w w . j av a 2 s . c o m Message msg = Message.obtain(null, Common.MSG_UNREGISTER_CLIENT); msg.replyTo = mMessenger; mServiceMessenger.send(msg); } catch (RemoteException e) { Log.d(TAG, "Failed to send unregister message to service, e: " + e.toString()); e.printStackTrace(); } unbindService(mServiceConnection); } }
From source file:edu.nd.darts.cimon.CimonListView.java
/** * Unregister periodic update monitor which was registered through administration activity. * This method is called by the onCheckedChanged listener for the Enable button * of the administration rows when the state is changed to disable. * //from ww w .j a va 2s . c o m * @param metric integer representing metric (per {@link Metrics}) to unregister */ public void unregisterPeriodic(int metric) { if (DebugLog.DEBUG) Log.d(TAG, "CimonListView.OnClickListener - unregister periodic"); if (mCimonInterface != null) { try { int monitorId = adminObserver.getMonitor(metric); if (monitorId >= 0) { mCimonInterface.unregisterPeriodic(metric, monitorId); adminObserver.setInactive(metric, monitorId); } } catch (RemoteException e) { if (DebugLog.INFO) Log.i(TAG, "CimonListView.OnClickListener - unregister failed"); e.printStackTrace(); } } }
From source file:org.mozilla.mozstumbler.service.sync.UploadReports.java
public void uploadReports(boolean ignoreNetworkStatus, SyncResult syncResult) { long uploadedObservations = 0; long uploadedCells = 0; long uploadedWifis = 0; long queueMinId, queueMaxId; if (!ignoreNetworkStatus && Prefs.getInstance().getUseWifiOnly() && !NetworkUtils.getInstance().isWifiAvailable()) { if (SharedConstants.isDebug) Log.d(LOGTAG, "not on WiFi, not sending"); syncResult.stats.numIoExceptions += 1; return;/*w w w .j av a 2 s .c o m*/ } Uri uri = DatabaseContract.Reports.CONTENT_URI.buildUpon() .appendQueryParameter("limit", String.valueOf(REQUEST_BATCH_SIZE)).build(); queueMinId = 0; queueMaxId = getMaxId(); Submitter submitter = new Submitter(); while (queueMinId < queueMaxId) { BatchRequestStats batch = null; Cursor cursor = mContentResolver.query(uri, null, DatabaseContract.Reports._ID + " > ? AND " + DatabaseContract.Reports._ID + " <= ?", new String[] { String.valueOf(queueMinId), String.valueOf(queueMaxId) }, DatabaseContract.Reports._ID); if (cursor == null) { break; } try { batch = getRequestBody(cursor); if (batch == null) { break; } if (submitter.cleanSend(batch.body)) { deleteObservations(batch.minId, batch.maxId); uploadedObservations += batch.observations; uploadedWifis += batch.wifis; uploadedCells += batch.cells; } else { syncResult.stats.numIoExceptions += 1; increaseRetryCounter(cursor, syncResult); } } finally { cursor.close(); submitter.close(); } queueMinId = batch.maxId; } try { updateSyncStats(uploadedObservations, uploadedCells, uploadedWifis); } catch (RemoteException e) { Log.e(LOGTAG, "Update sync stats failed", e); syncResult.stats.numIoExceptions += 1; } catch (OperationApplicationException e) { Log.e(LOGTAG, "Update sync stats failed", e); syncResult.stats.numIoExceptions += 1; e.printStackTrace(); } }