Skip to content

Instantly share code, notes, and snippets.

@helpshift
Last active December 14, 2015 00:59
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 helpshift/5003358 to your computer and use it in GitHub Desktop.
Save helpshift/5003358 to your computer and use it in GitHub Desktop.
Android SDK v1 docs gists.
hs.getNotificationCount(countHandler, failHandler);
private Handler countHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
Bundle countData = (Bundle) msg.obj;
Integer count = countData.getInt("value");
Boolean cache = countData.getBoolean("cache");
if (cache) {
Log.d("Notification Count", "local" + count);
} else {
Log.d("Notification Count", "server" + count);
}
}
};
private Handler countHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
Bundle countData = (Bundle) msg.obj;
Integer count = countData.getInt("value");
Boolean cache = countData.getBoolean("cache");
if (cache) {
Log.d("Notification Count", "local" + count);
} else {
Log.d("Notification Count", "server" + count);
}
}
};
public void onResume() {
super.onResume();
hs.startNotifCountPolling (countHandler, failHandler); // The polling interval will be 10 seconds.
}
public void onResume() {
super.onResume();
hs.startNotifCountPolling (countHandler, failHandler, 3);
}
public void onPause() {
super.onPause();
hs.stopNotifCountPolling ();
}
hs.showReportIssue(MyActivity.this);
hs.showSupport(MyActivity.this);
Integer notifCount = hs.getNotificationCount();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment