Skip to content

Instantly share code, notes, and snippets.

@mediavrog
Last active December 24, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mediavrog/6722710 to your computer and use it in GitHub Desktop.
Save mediavrog/6722710 to your computer and use it in GitHub Desktop.
Setup Crittercism
/*######################
* Crittercism
* crittercism.com
######################*/
JSONObject crittercismConfig = new JSONObject();
JSONObject crittermeta = new JSONObject();
try {
crittermeta.put("screen_name", "" + screen_name);
crittermeta.put("user_id", "" + user_id);
} catch (Exception e) {
e.printStackTrace();
Tracking.logException(e);
}
try {
crittercismConfig.put("delaySendingAppLoad", true);
if (debugFlag) {
crittercismConfig.put("customVersionName", versionName);
}
} catch (Exception e) {
e.printStackTrace();
Tracking.logException(e);
}
Crittercism.init(ctx.getApplicationContext(), CRITTERCISM_KEY, crittercismConfig);
// only add username and id if we have a logged in user, otherwise let crittercism decide on a guest name
if (screen_name != null && user_id != null && !"".equals(screen_name) && !"".equals(user_id)) {
Crittercism.setUsername(screen_name + " - " + user_id);
}
Crittercism.setMetadata(crittermeta);
Crittercism.sendAppLoadData();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment