Example usage for android.os RemoteException printStackTrace

List of usage examples for android.os RemoteException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static void sendMsg2Client(int iMsg, int arg1, int arg2, Bundle extras) {
    if (mMessenger == null) {
        return;//from w  ww .  j av a  2s. com
    }

    try {
        Message msgBack = Message.obtain(null, iMsg);

        if (msgBack != null) {
            msgBack.arg1 = arg1;
            msgBack.arg2 = arg2;
            msgBack.setData(extras);
            mMessenger.send(msgBack);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void sendMsg2Client(Messenger messenger, String sKey, String sObjParam, int iMsg) {
    if (messenger == null) {
        return;/*  w  ww.  j  a  v  a 2  s  .c  o  m*/
    }

    try {
        Bundle b = new Bundle();

        if (null != sKey) {
            b.putString(sKey, sObjParam);
        }

        Message msgBack = Message.obtain(null, iMsg);

        if (msgBack != null) {
            msgBack.setData(b);
            messenger.send(msgBack);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:org.ohmage.logprobe.OhmageAnalyticsProbeWriter.java

public static void prompt(String type, String id, Status status) {
    try {//  w w w. ja  v  a2s  .com
        ProbeBuilder probe = new ProbeBuilder(OBSERVER_ID, OBSERVER_VERSION);
        probe.setStream(STREAM_PROMPT, STREAM_PROMPT_VERSION);

        JSONObject data = new JSONObject();
        data.put("type", type);
        data.put("id", id);
        data.put("status", status);
        probe.setData(data.toString());
        probe.withId().now();

        probe.write(LogProbe.probeWriter);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:org.ohmage.logprobe.OhmageAnalyticsProbeWriter.java

public static void trigger(TriggerStatus action, String type, int count, String campaign) {
    try {/* w  w  w . j  a va 2 s .  c  o  m*/
        ProbeBuilder probe = new ProbeBuilder(OBSERVER_ID, OBSERVER_VERSION);
        probe.setStream(STREAM_TRIGGER, STREAM_TRIGGER_VERSION);

        JSONObject data = new JSONObject();
        data.put("action", action);
        data.put("type", type);
        data.put("count", count);
        data.put("campaign", campaign);
        probe.setData(data.toString());
        probe.withId().now();

        probe.write(LogProbe.probeWriter);
    } catch (RemoteException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (JSONException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}

From source file:com.rukman.emde.smsgroups.platform.GMSContactOperations.java

/**
 * Find the group whose SOURCE_ID column matches the parameter.
 * //from  w w  w .j a v a  2s  .  c om
 * @param provider - ContentProviderClient
 * @param account - User account
 * @param sourceId - Cloud Id of the group.
 * @return Cursor object returned from query with projection:
 *     new String[] { RawContacts._ID, RawContacts.SOURCE_ID }; 
 */
public static Cursor findGroupInContacts(ContentProviderClient provider, Account account, String sourceId) {
    Cursor cursor = null;
    try {
        Uri uri = RawContacts.CONTENT_URI.buildUpon()
                .appendQueryParameter(RawContacts.ACCOUNT_NAME, account.name)
                .appendQueryParameter(RawContacts.ACCOUNT_TYPE, GMSApplication.ACCOUNT_TYPE).build();
        cursor = provider.query(uri, new String[] { RawContacts._ID, RawContacts.SOURCE_ID },
                RawContacts.SOURCE_ID + "=?", new String[] { sourceId }, null);
        return cursor;
    } catch (RemoteException e) {
        e.printStackTrace();
    }
    return cursor;
}

From source file:cn.sharesdk.analysis.EventManager.java

/**Save and send log to server on the service*/
private static void startSettingService(String action, String extraValue) {
    try {/*  ww  w  .j a va2 s .c o m*/
        if (aidlService != null) {
            aidlService.setting(action, extraValue);
        } else {
            settingEventList.add(new AIDLCacheEvent(EventType.SETTING, action, extraValue));
            isServiceConnect(context);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:cn.sharesdk.analysis.EventManager.java

/** upload all log */
public static void uploadLog(Context context) {
    init(context);// w w  w . j av a  2 s.  co m
    try {
        if (aidlService != null) {
            aidlService.uploadLog();
        } else {
            cacheEventList.add(new AIDLCacheEvent(EventType.UPLOAD_LOG));
            isServiceConnect(context);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:cn.sharesdk.analysis.EventManager.java

/**Save and send log to server on the service*/
public static void startLogService(String action, JSONObject jsonObject) {
    try {/*from   ww w.j  av a  2 s  . c  o  m*/
        if (jsonObject == null) {
            return;
        }
        String json = jsonObject.toString();
        if (TextUtils.isEmpty(json)) {
            return;
        }
        if (aidlService != null) {
            aidlService.saveLog(action, json);
        } else {
            cacheEventList.add(new AIDLCacheEvent(EventType.SAVELOG, action, json));
            isServiceConnect(context);
        }
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:de.elanev.studip.android.app.widget.UserListFragment.java

private static void addUserToGroup(final String userId, final String groupId, final Context context) {
    String contactsUrl = String.format(context.getString(R.string.restip_contacts_groups_groupid_userid),
            mApiUrl, groupId, userId);//from w w w .  ja v a  2s. c  o m
    JacksonRequest<ContactGroups> userAddRequest = new JacksonRequest<ContactGroups>(contactsUrl,
            ContactGroups.class, null, new Listener<ContactGroups>() {
                public void onResponse(ContactGroups response) {
                    try {
                        mResolver.applyBatch(AbstractContract.CONTENT_AUTHORITY,
                                new ContactGroupHandler(response.group).parse());
                        SyncHelper.getInstance(context).forcePerformContactsSync(null);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    } catch (OperationApplicationException e) {
                        e.printStackTrace();
                    }

                    Toast.makeText(context, R.string.successfully_added, Toast.LENGTH_SHORT).show();
                }
            }, new ErrorListener() {
                public void onErrorResponse(VolleyError error) {
                    if (error.getMessage() != null)
                        Log.e(TAG, error.getMessage());
                    Toast.makeText(context, "Fehler: " + error.getMessage(), Toast.LENGTH_SHORT).show();
                }
            }, Method.PUT);
    try {
        Server server = Prefs.getInstance(context).getServer();
        OAuthConnector.with(server).sign(userAddRequest);
    } catch (OAuthMessageSignerException e) {
        e.printStackTrace();
    } catch (OAuthExpectationFailedException e) {
        e.printStackTrace();
    } catch (OAuthCommunicationException e) {
        e.printStackTrace();
    } catch (OAuthNotAuthorizedException e) {
        StuffUtil.startSignInActivity(context);
    }
    userAddRequest.setPriority(Request.Priority.IMMEDIATE);
    StudIPApplication.getInstance().addToRequestQueue(userAddRequest);

}

From source file:de.elanev.studip.android.app.widget.UserListFragment.java

private static void addUserToContacts(final String userId, final Context context) {
    String contactsUrl = String.format(context.getString(R.string.restip_contacts_contactid), mApiUrl, userId);
    JacksonRequest<Contacts> contactAddRequest = new JacksonRequest<Contacts>(contactsUrl, Contacts.class, null,
            new Listener<Contacts>() {
                public void onResponse(Contacts response) {
                    try {
                        mResolver.applyBatch(AbstractContract.CONTENT_AUTHORITY,
                                new ContactsHandler(response).parse());
                        SyncHelper.getInstance(context).forcePerformContactsSync(null);
                    } catch (RemoteException e) {
                        e.printStackTrace();
                    } catch (OperationApplicationException e) {
                        e.printStackTrace();
                    }//from   w w  w . j a v  a 2s. c  o m
                    Toast.makeText(context, R.string.successfully_added, Toast.LENGTH_SHORT).show();
                }
            }, new ErrorListener() {
                /*
                 * (non-Javadoc)
                 *
                 * @see com.android.volley.Response.ErrorListener
                 * #onErrorResponse(com.android.volley. VolleyError)
                 */
                public void onErrorResponse(VolleyError error) {
                    if (error.getMessage() != null)
                        Log.e(TAG, error.getMessage());
                    Toast.makeText(context, "Fehler: " + error.getMessage(), Toast.LENGTH_SHORT).show();
                }
            }, Method.PUT);
    try {
        Server server = Prefs.getInstance(context).getServer();
        OAuthConnector.with(server).sign(contactAddRequest);
    } catch (OAuthMessageSignerException e) {
        e.printStackTrace();
    } catch (OAuthExpectationFailedException e) {
        e.printStackTrace();
    } catch (OAuthCommunicationException e) {
        e.printStackTrace();
    } catch (OAuthNotAuthorizedException e) {
        StuffUtil.startSignInActivity(context);
    }
    contactAddRequest.setPriority(Request.Priority.IMMEDIATE);
    StudIPApplication.getInstance().addToRequestQueue(contactAddRequest);
}