List of usage examples for android.os RemoteException getMessage
public String getMessage()
From source file:co.beem.project.beem.FacebookTextService.java
public void makeNotificationForFavorite(User user) { NotificationCompat.Builder notif = new NotificationCompat.Builder(FacebookTextService.this); try {/*from w ww. j ava 2 s .c o m*/ String contactJid = user.getJabberId(); Contact c = getBind().getRoster().getContact(contactJid); String contactName = contactJid; if (c != null) { contactName = c.getName(); Bitmap avatar = getAvatar(c); notif.setLargeIcon(avatar); } notif.setTicker(contactName).setContentTitle(contactName); notif.setContentText(getString(R.string.is_now_online)); notif.setSmallIcon(R.drawable.ic_stat_ic_launcher_fbtext); notif.setContentIntent(makeChatIntent(user)); notif.setAutoCancel(true).setWhen(System.currentTimeMillis()); sendNotification(user.getJabberId().hashCode(), notif.getNotification()); } catch (RemoteException e) { Log.e(TAG, e.getMessage()); } }
From source file:com.netcompss.ffmpeg4android_client.BaseWizard.java
public void invokeFileInfoService(String inputFilePath) { Log.i(Prefs.TAG, "invokeFileInfoService called"); if (invokeFlag) { if (conn == null) { // Toast.makeText(this, "Cannot invoke - service not bound", Toast.LENGTH_SHORT).show(); } else {//from w w w . j a va 2s . com try { //FileUtils.deleteFile(workingFolder + outputFile); String command = "ffmpeg -i " + inputFilePath; if (remoteService != null) { deleteLogs(); FileUtils.writeToLocalLog("command: " + command); Log.i(Prefs.TAG, "command: " + command); remoteService.setFfmpegCommand(command); Log.d(Prefs.TAG, "Client invokeService()"); remoteService.runTranscoding(); } else { Log.w(Prefs.TAG, "Invoke failed, remoteService is null."); } } catch (android.os.DeadObjectException e) { Log.d(Prefs.TAG, "ignoring DeadObjectException (FFmpeg process exit)"); } catch (RemoteException re) { Log.e(Prefs.TAG, re.getMessage(), re); } } handleInfoServiceFinished(); invokeFlag = false; } else { Log.d(Prefs.TAG, "Not invoking"); } }
From source file:com.netcompss.ffmpeg4android_client.BaseWizard.java
public void invokeService() { Log.i(Prefs.TAG, "invokeService called"); // needed for demo client for grasfull fail int rc = isLicenseValid(getApplicationContext()); if (rc < 0) { String message = ""; if (rc == -1) message = "Trial expired, please contact support@netcompss.com"; else/* w w w .j a va 2 s.c o m*/ message = "License Validation failed, please contact support@netcompss.com"; new AlertDialog.Builder(this).setTitle("License Validation failed").setMessage(message) .setPositiveButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); return; } setRemoteNotificationInfo(); // this call with handle license gracefully. // If it will be removed, the fail will be in the native code, causing the progress dialog to start. //if (! isLicenseValid()) return; if (invokeFlag) { if (conn == null) { Toast.makeText(this, "Cannot invoke - service not bound", Toast.LENGTH_SHORT).show(); } else { try { String command = getCommand(); if (remoteService != null) { if (command != null) remoteService.setFfmpegCommand(command); else { remoteService.setComplexFfmpegCommand(commandComplex); } remoteService.setWorkingFolder(Prefs.getWorkFolder()); runWithCommand(command); } else { Log.w(Prefs.TAG, "Invoke failed, remoteService is null."); } } catch (android.os.DeadObjectException e) { Log.d(Prefs.TAG, "ignoring DeadObjectException (FFmpeg process exit)"); } catch (RemoteException re) { Log.e(Prefs.TAG, re.getMessage(), re); } } invokeFlag = false; } else { Log.d(Prefs.TAG, "Not invoking"); } }
From source file:com.ubiLive.GameCloud.googlepurchaseutil.IabHelper.java
/** * Starts the setup process. This will start up the setup process asynchronously. * You will be notified through the listener when the setup process is complete. * This method is safe to call from a UI thread. * * @param listener The listener to notify when the setup process is complete. *//*from ww w . ja v a 2 s .c om*/ public void startSetup(final OnIabSetupFinishedListener listener) { // If already set up, can't do it again. checkNotDisposed(); if (mSetupDone) throw new IllegalStateException("IAB helper is already set up."); // Connection to IAB service logDebug("Starting in-app billing setup."); mServiceConn = new ServiceConnection() { @Override public void onServiceDisconnected(ComponentName name) { logDebug("Billing service disconnected."); mService = null; } @Override public void onServiceConnected(ComponentName name, IBinder service) { if (mDisposed) return; logDebug("Billing service connected."); mService = IInAppBillingService.Stub.asInterface(service); String packageName = mContext.getPackageName(); try { logDebug("Checking for in-app billing 3 support."); // check for in-app billing v3 support int response = mService.isBillingSupported(3, packageName, ITEM_TYPE_INAPP); if (response != BILLING_RESPONSE_RESULT_OK) { if (listener != null) listener.onIabSetupFinished( new IabResult(response, "Error checking for billing v3 support.")); // if in-app purchases aren't supported, neither are subscriptions. mSubscriptionsSupported = false; return; } logDebug("In-app billing version 3 supported for " + packageName); // check for v3 subscriptions support response = mService.isBillingSupported(3, packageName, ITEM_TYPE_SUBS); if (response == BILLING_RESPONSE_RESULT_OK) { logDebug("Subscriptions AVAILABLE."); mSubscriptionsSupported = true; } else { logDebug("Subscriptions NOT AVAILABLE. Response: " + response); } mSetupDone = true; } catch (RemoteException e) { if (listener != null) { listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION, "RemoteException while setting up in-app billing.")); } DebugLog.d(TAG, "exception = " + e.getMessage()); return; } if (listener != null) { listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_OK, "Setup successful.")); } } }; Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND"); serviceIntent.setPackage("com.android.vending"); if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) { // service available to handle that Intent mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE); } else { // no service available to handle that Intent if (listener != null) { listener.onIabSetupFinished(new IabResult(BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE, "Billing service unavailable on device.")); } } }
From source file:net.sf.aria2.MainActivity.java
private boolean changeAriaServiceState(Preference p) { if (p.isEnabled()) { // it looks unsightly when current session overlaps with previous one... ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(R.id.nf_status); pref.setEnabled(false);//w w w . ja v a2 s . co m uiThreadHandler.postDelayed(() -> pref.setEnabled(true), 4000); if (pref.isChecked()) { try { serviceLink.askToStop(); } catch (RemoteException e) { // likely service process dying during the call // let's hope, that onSerivceDisconnected will fix it for us e.printStackTrace(); setPrefEnabled(false); } } else { final Intent intent; try { intent = new ConfigBuilder(this).constructServiceCommand(new Intent(sericeMoniker)) .putExtra(Config.EXTRA_INTERACTIVE, true); if (startService(intent) == null) setPrefEnabled(false); } catch (Exception e) { Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show(); } } } return true; }
From source file:com.commontime.plugin.LocationManager.java
private void stopMonitoringForRegion(final JSONObject arguments, final CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override/*from ww w.ja v a 2s.com*/ public PluginResult run() { try { Region region = parseRegion(arguments); iBeaconManager.stopMonitoringBeaconsInRegion(region); PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(true); return result; } catch (RemoteException e) { Log.e(TAG, "'stopMonitoringForRegion' service error: " + e.getCause()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } catch (Exception e) { Log.e(TAG, "'stopMonitoringForRegion' exception " + e.getCause()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } } }); }
From source file:com.commontime.plugin.LocationManager.java
private void stopRangingBeaconsInRegion(final JSONObject arguments, CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override// w ww . jav a2 s. c o m public PluginResult run() { try { Region region = parseRegion(arguments); iBeaconManager.stopRangingBeaconsInRegion(region); PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(true); return result; } catch (RemoteException e) { Log.e(TAG, "'stopRangingBeaconsInRegion' service error: " + e.getCause()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } catch (Exception e) { Log.e(TAG, "'stopRangingBeaconsInRegion' exception " + e.getCause()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } } }); }
From source file:com.commontime.plugin.LocationManager.java
private void startRangingBeaconsInRegion(final JSONObject arguments, final CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override/* w w w .jav a 2s . c om*/ public PluginResult run() { try { Region region = parseRegion(arguments); iBeaconManager.startRangingBeaconsInRegion(region); PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(true); return result; } catch (RemoteException e) { Log.e(TAG, "'startRangingBeaconsInRegion' service error: " + e.getCause()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } catch (Exception e) { Log.e(TAG, "'startRangingBeaconsInRegion' exception " + e.getCause()); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } } }); }
From source file:ro.ciubex.keepscreenlock.MainApplication.java
/** * Send a message to service.//from www.ja va2 s . com */ public void sendToKeepScreenLockService(String messageKey, String messageValue) { if (mBound) { Message msg = Message.obtain(); Bundle bundle = new Bundle(); bundle.putString(messageKey, messageValue); msg.setData(bundle); try { mService.send(msg); } catch (RemoteException e) { logE(TAG, "sendMessageToService(" + messageKey + "," + messageValue + "): " + e.getMessage(), e); } } }
From source file:com.commontime.plugin.LocationManager.java
private void startMonitoringForRegion(final JSONObject arguments, final CallbackContext callbackContext) { _handleCallSafely(callbackContext, new ILocationManagerCommand() { @Override// ww w . java 2s. c om public PluginResult run() { Region region = null; try { region = parseRegion(arguments); iBeaconManager.startMonitoringBeaconsInRegion(region); PluginResult result = new PluginResult(PluginResult.Status.OK); result.setKeepCallback(true); beaconServiceNotifier.didStartMonitoringForRegion(region); return result; } catch (RemoteException e) { Log.e(TAG, "'startMonitoringForRegion' service error: " + e.getCause()); beaconServiceNotifier.monitoringDidFailForRegion(region, e); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } catch (Exception e) { Log.e(TAG, "'startMonitoringForRegion' exception " + e.getCause()); beaconServiceNotifier.monitoringDidFailForRegion(region, e); return new PluginResult(PluginResult.Status.ERROR, e.getMessage()); } } }); }