List of usage examples for android.os RemoteException printStackTrace
public void printStackTrace()
From source file:ServiceConsumerActivity.java
public void queryService() { if (isBound) { Bundle bundle = new Bundle(); bundle.putString("location", editText.getText().toString().trim()); Message message = Message.obtain(); message.replyTo = messengerFromService; message.setData(bundle);//from www .ja v a 2s . co m try { messengerToService.send(message); } catch (RemoteException e) { e.printStackTrace(); } } else { textView.setText(R.string.report_appears_here); doToast(R.string.service_not_bound); } }
From source file:org.wso2.carbon.iot.android.sense.beacon.BeaconDetactorService.java
@Override public void onBeaconServiceConnect() { iBeaconManager.setMonitorNotifier(new MonitorNotifier() { @Override/*from w w w . j av a 2 s .c o m*/ public void didEnterRegion(Region region) { Log.e("BeaconDetactorService", "didEnterRegion"); generateNotification(BeaconDetactorService.this, region.getUniqueId() + ": just saw this iBeacon for the first time"); } @Override public void didExitRegion(Region region) { Log.e("BeaconDetactorService", "didExitRegion"); generateNotification(BeaconDetactorService.this, region.getUniqueId() + ": is no longer visible"); } @Override public void didDetermineStateForRegion(int state, Region region) { Log.e("BeaconDetactorService", "didDetermineStateForRegion:" + state); } }); try { iBeaconManager.startMonitoringBeaconsInRegion(new Region("myMonitoringUniqueId", null, null, null)); } catch (RemoteException e) { e.printStackTrace(); } }
From source file:com.terracom.mumbleclient.channel.ChannelEditFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { LayoutInflater inflater = LayoutInflater.from(getActivity()); View view = inflater.inflate(R.layout.fragment_channel_edit, null, false); mNameField = (TextView) view.findViewById(R.id.channel_edit_name); mDescriptionField = (TextView) view.findViewById(R.id.channel_edit_description); mPositionField = (TextView) view.findViewById(R.id.channel_edit_position); mTemporaryBox = (CheckBox) view.findViewById(R.id.channel_edit_temporary); try {// w w w. java 2 s . co m // If we can only make temporary channels, remove the option. Channel parentChannel = mServiceProvider.getService().getChannel(getParent()); int combinedPermissions = mServiceProvider.getService().getPermissions() | parentChannel.getPermissions(); boolean canMakeChannel = (combinedPermissions & Permissions.MakeChannel) > 0; boolean canMakeTempChannel = (combinedPermissions & Permissions.MakeTempChannel) > 0; boolean onlyTemp = canMakeTempChannel && !canMakeChannel; mTemporaryBox.setChecked(onlyTemp); mTemporaryBox.setEnabled(!onlyTemp); } catch (RemoteException e) { e.printStackTrace(); } return new AlertDialog.Builder(getActivity()) .setTitle(isAdding() ? R.string.channel_add : R.string.channel_edit).setView(view) .setPositiveButton(isAdding() ? R.string.add : R.string.save, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { if (isAdding()) { mServiceProvider.getService().createChannel(getParent(), mNameField.getText().toString(), mDescriptionField.getText().toString(), Integer.parseInt(mPositionField.getText().toString()), // We can guarantee this to be an int. InputType is numberSigned. mTemporaryBox.isChecked()); } else { // TODO } } catch (RemoteException e) { e.printStackTrace(); } } }) .setNegativeButton(android.R.string.cancel, null).create(); }
From source file:wseemann.media.fmpdemo.FMPDemo.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fmpdemo); final EditText uriText = (EditText) findViewById(R.id.uri); // Uncomment for debugging //uriText.setText("http://..."); Intent intent = getIntent();/*from w w w .j a va2s . c om*/ // Populate the edit text field with the intent uri, if available Uri uri = intent.getData(); if (intent.getExtras() != null && intent.getExtras().getCharSequence(Intent.EXTRA_TEXT) != null) { uri = Uri.parse(intent.getExtras().getCharSequence(Intent.EXTRA_TEXT).toString()); } if (uri != null) { try { uriText.setText(URLDecoder.decode(uri.toString(), "UTF-8")); } catch (UnsupportedEncodingException e1) { } } setIntent(null); Button goButton = (Button) findViewById(R.id.go_button); goButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Clear the error message uriText.setError(null); // Hide the keyboard InputMethodManager imm = (InputMethodManager) FMPDemo.this .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(uriText.getWindowToken(), 0); String uri = uriText.getText().toString(); if (uri.equals("")) { uriText.setError(getString(R.string.uri_error)); return; } String uriString = uriText.getText().toString(); try { mService.openFile(uriString); } catch (RemoteException e) { e.printStackTrace(); } } }); mToken = MusicUtils.bindToService(this, this); }
From source file:com.android.messaging.FakeContentProvider.java
@Override public String getType(final Uri uri) { String type = mTypes.get(uri.toString()); if (type == null) { try {/* w ww .java 2 s. c o m*/ type = mProvider.getType(uri); } catch (final RemoteException e) { e.printStackTrace(); } } return type; }
From source file:com.morlunk.mumbleclient.channel.actionmode.ChannelActionModeCallback.java
@Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { super.onCreateActionMode(actionMode, menu); TintedMenuInflater inflater = new TintedMenuInflater(mContext, actionMode.getMenuInflater()); inflater.inflate(R.menu.context_channel, menu); actionMode.setTitle(mChannel.getName()); actionMode.setSubtitle(R.string.current_chat_target); try {/*from w w w.j a v a 2 s . c o m*/ // Request permissions update from server, if we don't have channel permissions if (mChannel.getPermissions() == 0) mService.requestPermissions(mChannel.getId()); } catch (RemoteException e) { e.printStackTrace(); } return true; }
From source file:com.morlunk.mumbleclient.channel.actionmode.ChannelActionModeCallback.java
@Override public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { int perms = mChannel.getPermissions(); // This breaks uMurmur ACL. Put in a fix based on server version perhaps? //menu.getMenu().findItem(R.id.menu_channel_add) // .setVisible((permissions & (Permissions.MakeChannel | Permissions.MakeTempChannel)) > 0); menu.findItem(R.id.context_channel_edit).setVisible((perms & Permissions.Write) > 0); menu.findItem(R.id.context_channel_remove).setVisible((perms & Permissions.Write) > 0); menu.findItem(R.id.context_channel_view_description) .setVisible(mChannel.getDescription() != null || mChannel.getDescriptionHash() != null); try {/*from w ww . ja v a2 s. c om*/ Server server = mService.getConnectedServer(); if (server != null) { menu.findItem(R.id.context_channel_pin) .setChecked(mDatabase.isChannelPinned(server.getId(), mChannel.getId())); } } catch (RemoteException e) { e.printStackTrace(); } return false; }
From source file:com.android.messaging.FakeContentProvider.java
@Override public Cursor query(final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder) { LogUtil.w(LogUtil.BUGLE_TAG,/*from w ww . j a v a 2 s . co m*/ "FakeContentProvider: query " + uri.toString() + " for " + (projection == null ? null : TextUtils.join(",", projection)) + " where " + selection + " with " + (selectionArgs == null ? null : TextUtils.join(";", selectionArgs))); for (final ContentOverride content : mOverrides) { if (content.match(uri.toString(), selection, selectionArgs)) { return new FakeCursor(projection, content.columns, content.data); } } if (mProvider != null) { try { LogUtil.w(LogUtil.BUGLE_TAG, "FakeContentProvider: delgating"); final Cursor cursor = mProvider.query(uri, projection, selection, selectionArgs, sortOrder); LogUtil.w(LogUtil.BUGLE_TAG, "FakeContentProvider: response size " + cursor.getCount() + " contains " + TextUtils.join(",", cursor.getColumnNames()) + " type(0) " + cursor.getType(0)); return cursor; } catch (final RemoteException e) { e.printStackTrace(); } } return null; }
From source file:com.duguang.baseanimation.ui.listivew.listviews.ListViewsMainActivity.java
private void buy(String sku) { try {/*from w w w .ja v a2 s . co m*/ Bundle buyIntentBundle = mService.getBuyIntent(3, getPackageName(), sku, "inapp", "bGoa+V7g/ysDXvKwqq+JTFn4uQZbPiQJo4pf9RzJ"); PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT"); if (pendingIntent != null) { startIntentSenderForResult(pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)); } } catch (RemoteException e) { e.printStackTrace(); } catch (SendIntentException e) { e.printStackTrace(); } }
From source file:vn.cybersoft.obs.android.fragments.ConsumptionFragment.java
private void refreshStats() { mAppListGroup.removeAll();// w ww .ja v a 2 s.com mAppListGroup.setOrderingAsAdded(false); try { int noUidMask = mCounterService.getNoUidMask(); byte[] rawUidInfo = mCounterService.getUidInfo(Counter.WINDOW_TOTAL, noUidMask | 0); if (rawUidInfo != null) { UidInfo[] uidInfos = (UidInfo[]) new ObjectInputStream(new ByteArrayInputStream(rawUidInfo)) .readObject(); double total = 0; for (UidInfo uidInfo : uidInfos) { if (uidInfo.uid == SystemInfo.AID_ALL) continue; uidInfo.key = uidInfo.totalEnergy; uidInfo.unit = "J"; total += uidInfo.key; } if (total == 0) { total = 1; } for (UidInfo uidInfo : uidInfos) { uidInfo.percentage = (uidInfo.key / total) * 100; } Arrays.sort(uidInfos); for (int i = 0; i < uidInfos.length; i++) { UidInfo info = uidInfos[i]; final double percentOfTotal = info.percentage; if (info.uid == SystemInfo.AID_ALL || percentOfTotal < HIDE_UID_THRESHOLD) { continue; } PackageManager packageManager = getActivity().getPackageManager(); SystemInfo systemInfo = SystemInfo.getInstance(); String name = systemInfo.getUidName(info.uid, packageManager); if (name.equals(getString(R.string.app_name))) { continue; } Drawable icon = systemInfo.getUidIcon(info.uid, packageManager); PowerGaugePreference pref = new PowerGaugePreference(getActivity(), icon, info); pref.setTitle(name); pref.setOrder(Integer.MAX_VALUE - (int) info.key); pref.setPercent(percentOfTotal, percentOfTotal); pref.setKey(Integer.toString(info.uid)); mAppListGroup.addPreference(pref); } } } catch (RemoteException e) { e.printStackTrace(); } catch (OptionalDataException e) { e.printStackTrace(); } catch (StreamCorruptedException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }