List of usage examples for android.os RemoteException toString
public String toString()
From source file:com.piusvelte.taplock.client.core.TapLockSettings.java
private void addDevice() { // Get a set of currently paired devices BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter(); if (btAdapter.isEnabled()) { Set<BluetoothDevice> pairedDevices = btAdapter.getBondedDevices(); // launch dialog to select device if (pairedDevices.size() > 0) { int p = 0; final String[] pairedDeviceNames = new String[pairedDevices.size()]; final String[] pairedDeviceAddresses = new String[pairedDevices.size()]; for (BluetoothDevice device : pairedDevices) { pairedDeviceNames[p] = device.getName(); pairedDeviceAddresses[p++] = device.getAddress(); }/*from w w w . j a va 2s . c o m*/ mDialog = new AlertDialog.Builder(TapLockSettings.this) .setItems(pairedDeviceNames, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { addNewDevice(pairedDeviceNames[which], pairedDeviceAddresses[which]); } }) .setPositiveButton(getString(R.string.btn_bt_scan), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (mServiceInterface != null) { try { mServiceInterface.requestDiscovery(); mProgressDialog = new ProgressDialog(TapLockSettings.this); mProgressDialog.setMessage(getString(R.string.msg_scanning)); mProgressDialog.setCancelable(true); mProgressDialog.show(); } catch (RemoteException e) { Log.e(TAG, e.toString()); } } } }).create(); mDialog.show(); } else { if (mServiceInterface != null) { try { mServiceInterface.requestDiscovery(); mProgressDialog = new ProgressDialog(this); mProgressDialog.setMessage(getString(R.string.msg_scanning)); mProgressDialog.setCancelable(true); mProgressDialog.show(); } catch (RemoteException e) { Log.e(TAG, e.toString()); } } } } else { mDialog = new AlertDialog.Builder(TapLockSettings.this).setTitle(R.string.ttl_enablebt) .setMessage(R.string.msg_enablebt) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (mServiceInterface != null) { try { mServiceInterface.enableBluetooth(); } catch (RemoteException e) { Log.e(TAG, e.toString()); } } } }).create(); mDialog.show(); } }
From source file:com.sentaroh.android.TaskAutomation.ActivityTaskStatus.java
private void unsetCallbackListener() { try {// w w w . j a v a 2 s . com svcServer.removeCallBack(svcClientCallback); } catch (RemoteException e) { e.printStackTrace(); util.addLogMsg("E", "unsetCallbackListener error :", e.toString()); } }
From source file:com.sentaroh.android.TaskAutomation.ActivityTaskStatus.java
private void stopSvcSchduler() { util.addDebugMsg(1, "I", "stopSvcSchduler entered"); if (svcClientCallback != null) { try {/*ww w . j av a 2 s . c o m*/ svcServer.removeCallBack(svcClientCallback); svcClientCallback = null; } catch (RemoteException e) { e.printStackTrace(); util.addLogMsg("E", "removeListener error :", e.toString()); } } unbindService(svcConnScheduler); }
From source file:com.sentaroh.android.TaskAutomation.ActivityTaskStatus.java
final private void setCallbackListener() { final Handler handler = new Handler(); util.addDebugMsg(1, "I", "setCallbackListener entered"); svcClientCallback = new ISchedulerCallback.Stub() { final public void notifyToClient(String resp_time, final String resp, final String grp, final String task, final String action, String dialog_id, final int atc, final int resp_cd, final String msg) throws RemoteException { if (envParms.settingDebugLevel >= 2) util.addDebugMsg(1, "I", "Notify received ", "Resp=", resp, ", Task=", task, ", action=", action, ", dialog_id=", dialog_id); handler.post(new Runnable() { @Override// w w w . j a v a 2s.c o m public void run() { updateActiveTaskByResponse(atc, resp, grp, task); setSchedulerStatus(); } }); } }; try { svcServer.setCallBack(svcClientCallback); } catch (RemoteException e) { e.printStackTrace(); util.addLogMsg("E", "setCallbackListener error :", e.toString()); } }
From source file:org.ohmage.triggers.types.location.LocTrigService.java
private void stopMotionDetection() { Log.i(DEBUG_TAG, "LocTrigService: Stopping motion detection..."); if (mWiFiGPSServ != null) { try {//from w w w . j av a 2 s. c o m mWiFiGPSServ.unregisterCallback(REMOTE_CLIENT_NAME, mMotionDetectCB); /* * A stop call is actually not required. But to be * on the safer side... */ mWiFiGPSServ.stop(REMOTE_CLIENT_NAME); } catch (RemoteException e) { Log.e(DEBUG_TAG, "LocTrigService: Exception while " + "stopping motion detection"); Log.v(DEBUG_TAG, e.toString()); } } disconnectRemoteServices(); }
From source file:org.ohmage.triggers.types.location.LocTrigService.java
@SuppressWarnings("unchecked") private boolean hasUserMoved() { List<Double> fList = null; try {/*from w ww . j ava 2 s . co m*/ //TODO cast problem //AccelService must return a typed list fList = mAccelServ.getLastForce(); } catch (RemoteException e) { Log.e(DEBUG_TAG, "LocTrigService: Exception while " + "getLastForce"); Log.v(DEBUG_TAG, e.toString()); return false; } if (fList == null) { Log.e(DEBUG_TAG, "LocTrigService: AccelService returned null" + " force list"); return false; } if (fList.size() == 0) { Log.i(DEBUG_TAG, "LocTrigService: AccelService returned empty" + " force list"); return false; } double mean = 0; for (double force : fList) { mean += force; } mean /= fList.size(); double var = 0; for (double force : fList) { var += Math.pow(force - mean, 2); } var /= fList.size(); var *= 1000; Log.i(DEBUG_TAG, "LocTrigService: Variance = " + var); if (var < MOTION_DETECT_ACCEL_THRESHOLD) { return false; } Log.i(DEBUG_TAG, "LocTrigService: Motion detected"); return true; }
From source file:org.ohmage.triggers.types.location.LocTrigService.java
private void registerMotionDetectionCB() { Log.i(DEBUG_TAG, "LocTrigService: Registering for WifiGPS CB"); if (mWiFiGPSServ == null || mAccelServ == null) { Log.i(DEBUG_TAG, "LocTrigService: Not all services are connected yet." + " Skipping..."); return;/*from w w w . j a v a 2s . c om*/ } Log.i(DEBUG_TAG, "LocTrigService: All services connected, " + "attempting to register"); //Use the services opportunistically. Do not start //motion detection if the services are not already //running try { if (!mWiFiGPSServ.isRunning() || !mAccelServ.isRunning()) { Log.i(DEBUG_TAG, "LocTrigService: Motion detection NOT started " + "as the services are not already running"); disconnectRemoteServices(); return; } mMotionDetectTS = SystemClock.elapsedRealtime(); //Register a location change cb with wifigps mWiFiGPSServ.registerCallback(REMOTE_CLIENT_NAME, mMotionDetectCB); /* * The following line is a hack/work-around. If this is not done, * the WifiGPS service will continue to run even after all the other * have stopped. Essentially, the 'registerCallback' function above * will increase the 'clientCount' inside the service even if we didnt * start it explicitly. Thus, we need to call stop to nullify the effect. */ mWiFiGPSServ.stop(REMOTE_CLIENT_NAME); } catch (RemoteException e) { Log.e(DEBUG_TAG, "LocTrigService: Exception while " + "registering wifigps cb"); Log.v(DEBUG_TAG, e.toString()); } }
From source file:info.guardianproject.otr.app.im.app.NewChatActivity.java
public void startGroupChat(String room, String server, String nickname, IImConnection conn) { mLastConnGroup = conn;/* w w w . j ava 2 s . co m*/ new AsyncTask<String, Long, String>() { private ProgressDialog dialog; @Override protected void onPreExecute() { dialog = new ProgressDialog(NewChatActivity.this); dialog.setMessage(getString(R.string.connecting_to_group_chat_)); dialog.setCancelable(true); dialog.show(); } @Override protected String doInBackground(String... params) { String roomAddress = (params[0] + '@' + params[1]).toLowerCase(Locale.US).replace(' ', '_'); String nickname = params[2]; try { IChatSessionManager manager = mLastConnGroup.getChatSessionManager(); IChatSession session = manager.getChatSession(roomAddress); if (session == null) { session = manager.createMultiUserChatSession(roomAddress, nickname, true); if (session != null) { mRequestedChatId = session.getId(); publishProgress(mRequestedChatId); } else { return getString(R.string.unable_to_create_or_join_group_chat); } } else { mRequestedChatId = session.getId(); publishProgress(mRequestedChatId); } return null; } catch (RemoteException e) { return e.toString(); } } @Override protected void onProgressUpdate(Long... showChatId) { showChat(showChatId[0]); } @Override protected void onPostExecute(String result) { super.onPostExecute(result); if (dialog.isShowing()) { dialog.dismiss(); } if (result != null) { mHandler.showServiceErrorAlert(result); } } }.execute(room, server, nickname); }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private void unsetCallbackListener() { try {/*from w ww . jav a2s . c om*/ mSvcServer.removeCallBack(mSvcClientCallback); } catch (RemoteException e) { e.printStackTrace(); mGlblParms.util.addLogMsg("E", "unsetCallbackListener error :" + e.toString()); } }
From source file:com.sentaroh.android.TaskAutomation.Config.ActivityMain.java
final private String[] getActiveTaskList() { String[] atl = null;/*from w w w .ja va 2 s.c o m*/ // String[] all_task=null; try { atl = mSvcServer.aidlGetActiveTaskList(); // all_task=svcServer.aidlGetTaskList(); } catch (RemoteException e) { e.printStackTrace(); mGlblParms.util.addLogMsg("E", "aidlGetActiveTaskList error :" + e.toString()); } return atl; }