Last active
December 14, 2015 00:59
-
-
Save helpshift/5003358 to your computer and use it in GitHub Desktop.
Android SDK v1 docs gists.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hs.getNotificationCount(countHandler, failHandler); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onResume() { | |
super.onResume(); | |
hs.startNotifCountPolling (countHandler, failHandler); // The polling interval will be 10 seconds. | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onResume() { | |
super.onResume(); | |
hs.startNotifCountPolling (countHandler, failHandler, 3); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void onPause() { | |
super.onPause(); | |
hs.stopNotifCountPolling (); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hs.showReportIssue(MyActivity.this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hs.showSupport(MyActivity.this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Integer notifCount = hs.getNotificationCount(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment