-
-
Save kapilreddy/4195547 to your computer and use it in GitHub Desktop.
helpshift initialization android
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.leaveBreadCrumb("Went to Preferences Screen"); |
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); | |
Log.d("Notification Count", msg.toString()); | |
} | |
}; |
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.install(this, | |
"<YOUR_API_KEY>", | |
"<yourcompany>.helpshift.com", | |
"<YOUR_APP_ID>"); |
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
final Helpshift hs = new Helpshift(); |
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 Notification buildNotification(String alert, Map<String, String> extras) { | |
Context c = UAirship.shared().getApplicationContext(); | |
if(!hs.isForeground(c)) { | |
return super.buildNotification(alert, extras); | |
} else { | |
return null; | |
} | |
} |
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
String action = intent.getAction(); | |
if (action.equals(PushManager.ACTION_REGISTRATION_FINISHED)) { | |
hs.setDeviceToken(UAirship.shared().getApplicationContext(), | |
PushManager.shared().getAPID()); | |
} |
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
String action = intent.getAction(); | |
if (action.equals(PushManager.ACTION_NOTIFICATION_OPENED)) { | |
if(intent.getExtras().getString("origin").equals("helpshift")) { | |
hs.showSupportOnPush(UAirship.shared().getApplicationContext(), | |
intent); | |
} | |
} |
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.setDeviceIdentifier("user-id-100"); |
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.setUsername("John"); | |
hs.setEmail("[email protected]"); |
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
<uses-permission android:name="android.permission.INTERNET" /> | |
<uses-sdk | |
android:minSdkVersion="8" | |
android:targetSdkVersion="17" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment