Example usage for android.os RemoteException toString

List of usage examples for android.os RemoteException toString

Introduction

In this page you can find the example usage for android.os RemoteException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:eu.andlabs.gcp.GCPService.java

private void dispatchMessage(int what, String thing) {
    try {//w w w .  j  a va 2s . com
        mChatGame.send(Message.obtain(mHandler, what, thing));
    } catch (RemoteException e) {
        log("Error: " + e.toString());
    }
}

From source file:com.sentaroh.android.TaskAutomation.TaskManager.java

static final public void callBackToActivity(TaskManagerParms taskMgrParms, EnvironmentParms envParms,
        CommonUtilities util, String resp_time, String resp_id, String grp, String task, String action,
        String dlg_id, int resp_cd, String msg) {
    if (envParms.settingDebugLevel >= 2)
        util.addDebugMsg(2, "I", "callBackToActivity entered, resp=", resp_id, ", task=", task, ", action=",
                action, ", msg=", msg);
    synchronized (taskMgrParms.callBackList) {
        int on = taskMgrParms.callBackList.beginBroadcast();
        if (on != 0) {
            ISchedulerCallback isv = null;
            for (int i = 0; i < on; i++) {
                try {
                    isv = taskMgrParms.callBackList.getBroadcastItem(i);
                    if (isv != null && envParms != null)
                        isv.notifyToClient(resp_time, resp_id, grp, task, action, dlg_id,
                                envParms.statsActiveTaskCount, resp_cd, msg);
                } catch (RemoteException e) {
                    e.printStackTrace();
                    util.addLogMsg("E", "callBackToActivity error, num=", String.valueOf(on), "\n",
                            e.toString());
                }//  w  ww.j  a va  2  s  .c o  m
            }
            taskMgrParms.callBackList.finishBroadcast();
        }
    }
}

From source file:com.piusvelte.taplock.client.core.TapLockToggle.java

@Override
protected void onPause() {
    super.onPause();
    if ((mProgressDialog != null) && mProgressDialog.isShowing())
        mProgressDialog.cancel();//from   ww w  .j a va2  s  . com
    if (mServiceInterface != null) {
        try {
            mServiceInterface.stop();
        } catch (RemoteException e) {
            Log.e(TAG, e.toString());
        }
        unbindService(this);
    }
}

From source file:com.piusvelte.taplock.client.core.TapLockToggle.java

@Override
protected void onResume() {
    super.onResume();
    mProgressDialog = new ProgressDialog(this);
    mProgressDialog.setTitle(R.string.title_toggle);
    mProgressDialog.setMessage(mProgressMessage);
    mProgressDialog.setCancelable(true);
    mProgressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
        @Override//w  w w  . ja v a2 s .  c om
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    });
    mProgressDialog.setButton(getString(R.string.close), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (mServiceInterface != null) {
                try {
                    mServiceInterface.cancelRequest();
                } catch (RemoteException e) {
                    Log.e(TAG, e.toString());
                }
            }
            dialog.cancel();
        }
    });
    mProgressDialog.show();
    mDevices.clear();
    final SharedPreferences sp = getSharedPreferences(KEY_PREFS, MODE_PRIVATE);
    Set<String> devices = sp.getStringSet(KEY_DEVICES, null);
    if (devices != null) {
        for (String device : devices) {
            try {
                mDevices.add(new JSONObject(device));
            } catch (JSONException e) {
                Log.e(TAG, e.toString());
            }
        }
    }
    // start the service before binding so that the service stays around for faster future connections
    startService(TapLock.getPackageIntent(this, TapLockService.class));
    bindService(TapLock.getPackageIntent(this, TapLockService.class), this, BIND_AUTO_CREATE);
}

From source file:com.piusvelte.taplock.client.core.TapLockToggle.java

@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
    mServiceInterface = ITapLockService.Stub.asInterface(binder);
    if (mUIInterface != null) {
        try {/*from w  w  w  .j a v  a  2  s.  c  o  m*/
            mServiceInterface.setCallback(mUIInterface);
        } catch (RemoteException e) {
            Log.e(TAG, e.toString());
        }
    }
    Intent intent = getIntent();
    if (intent != null) {
        String action = intent.getAction();
        if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)
                && intent.hasExtra(NfcAdapter.EXTRA_NDEF_MESSAGES)) {
            Log.d(TAG, "service connected, NDEF_DISCOVERED");
            Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
            NdefMessage message;
            if (rawMsgs != null) {
                // process the first message
                message = (NdefMessage) rawMsgs[0];
                // process the first record
                NdefRecord record = message.getRecords()[0];
                if (record.getTnf() == NdefRecord.TNF_WELL_KNOWN) {
                    try {
                        byte[] payload = record.getPayload();
                        /*
                         * payload[0] contains the "Status Byte Encodings" field, per the
                         * NFC Forum "Text Record Type Definition" section 3.2.1.
                         *
                         * bit7 is the Text Encoding Field.
                         *
                         * if (Bit_7 == 0): The text is encoded in UTF-8 if (Bit_7 == 1):
                         * The text is encoded in UTF16
                         *
                         * Bit_6 is reserved for future use and must be set to zero.
                         *
                         * Bits 5 to 0 are the length of the IANA language code.
                         */
                        String textEncoding = ((payload[0] & 0200) == 0) ? "UTF-8" : "UTF-16";
                        int languageCodeLength = payload[0] & 0077;
                        String taggedDeviceName = new String(payload, languageCodeLength + 1,
                                payload.length - languageCodeLength - 1, textEncoding);
                        manageDevice(taggedDeviceName, ACTION_TOGGLE);
                    } catch (UnsupportedEncodingException e) {
                        // should never happen unless we get a malformed tag.
                        Log.e(TAG, e.toString());
                        finish();
                    }
                } else
                    finish();
            } else
                finish();
        } else if (intent.getData() != null) {
            String taggedDeviceName = intent.getData().getHost();
            if (taggedDeviceName != null)
                manageDevice(taggedDeviceName, ACTION_TOGGLE);
            else
                finish();
        } else if (ACTION_UNLOCK.equals(action) || ACTION_LOCK.equals(action) || ACTION_TOGGLE.equals(action))
            manageDevice(intent.getStringExtra(EXTRA_DEVICE_NAME), action);
        else
            finish();
    } else
        finish();
}

From source file:eu.andlabs.studiolounge.gcp.GCPService.java

private void dispatchMessage(int what, Object thing) {
    try {/*  w  w w  .ja va  2 s  .  c o  m*/
        mApp.send(Message.obtain(mHandler, what, thing));
    } catch (RemoteException e) {
        log("Error: " + e.toString());
    }
}

From source file:com.yschi.castscreen.MainActivity.java

private void doUnbindService() {
    if (mServiceMessenger != null) {
        try {/*  w  w  w.ja va2 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:com.turbulenz.turbulenz.googlepayment.java

public boolean doConsume(final String token) {
    if (!mReady) {
        _error("doConsume: !! not ready.  leaving.");
        return false;
    }/*from  w w  w . j  ava2 s  .co  m*/

    if (null == token || token.equals("")) {
        _error("doConsume: !! null or empty token");
        return false;
    }

    _print("doConsume: token: " + token);
    try {
        int response = mService.consumePurchase(3, mActivity.getPackageName(), token);

        if (BILLING_RESPONSE_RESULT_OK == response) {
            _log("doConsume: successfully consumed");
            return true;
        } else {
            _error("doConsume: !! failed to consume.  response: " + response);
        }
    } catch (RemoteException e) {
        _error("doConsume: !! exception " + e.toString());
    }

    return false;
}

From source file:com.piusvelte.taplock.client.core.TapLockSettings.java

@Override
public void onServiceConnected(ComponentName name, IBinder binder) {
    mServiceInterface = ITapLockService.Stub.asInterface(binder);
    if (mUIInterface != null) {
        try {//w  ww.java2s . c  om
            mServiceInterface.setCallback(mUIInterface);
        } catch (RemoteException e) {
            Log.e(TAG, e.toString());
        }
    }
}

From source file:com.piusvelte.taplock.client.core.TapLockSettings.java

@Override
protected void onPause() {
    super.onPause();
    if (!mInWriteMode) {
        if (mServiceInterface != null) {
            try {
                mServiceInterface.stop();
            } catch (RemoteException e) {
                Log.e(TAG, e.toString());
            }//from ww  w . j a  v  a2 s  .c o  m
            unbindService(this);
        }
        if ((mDialog != null) && mDialog.isShowing())
            mDialog.cancel();
        if ((mProgressDialog != null) && mProgressDialog.isShowing())
            mProgressDialog.cancel();
    }
}