Last active
December 14, 2015 01:09
-
-
Save helpshift/5003847 to your computer and use it in GitHub Desktop.
Android SDK v2 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
<activity android:name="com.helpshift.HelpshiftActivity" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSAddIssue" | |
android:theme="@style/HSThemeLight"/> | |
<activity android:name="com.helpshift.HSAddProfile" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSMessages" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSQuestionsList" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSQuestion" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSSection" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSInbox" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSFaqs" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> |
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
<activity android:name="com.helpshift.HelpshiftActivity" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSAddIssue" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSAddProfile" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSMessages" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSQuestionsList" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSQuestion" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSSection" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> | |
<activity android:name="com.helpshift.HSInbox" | |
android:hardwareAccelerated="true" | |
android:configChanges="orientation|screenSize" | |
android:theme="@style/HSThemeLight" /> |
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 class GCMIntentReceiver extends BroadcastReceiver { | |
@Override | |
public void onReceive(Context context, Intent 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
<receiver android:name="GCMIntentReceiver" > | |
<intent-filter> | |
<action android:name="YOUR_ACTION_NAME" /> | |
</intent-filter> | |
</receiver> |
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
@Override | |
public void onReceive(Context context, Intent intent) { | |
Helpshift hs = new Helpshift(context); | |
final String regId = GCMRegistrar.getRegistrationId(context); | |
hs.setDeviceToken(regId); | |
} |
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
@Override | |
protected void onRegistered(Context context, String registrationId) { | |
Intent intent = new Intent(); | |
intent.setAction("YOUR_ACTION_NAME"); | |
sendBroadcast(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
@Override | |
protected void onMessage(Context context, Intent intent) { | |
Helpshift hs = new Helpshift(context); | |
if(!hs.isForeground()) { | |
generateNotification(context, 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
private void generateNotification(Context context, Intent i) { | |
PendingIntent intent; | |
Helpshift hs = new Helpshift(context); | |
if(i.getExtras().getString("origin").equals("helpshift")) { | |
intent = hs.getPendingIntentOnPush(context, i); | |
} | |
int icon = R.drawable.ic_launcher; | |
Bundle extras = i.getExtras(); | |
String message = extras.getString("alert"); | |
long when = System.currentTimeMillis(); | |
Notification notification = new Notification(icon, message, when); | |
String title = context.getString(R.string.app_name); | |
notification.setLatestEventInfo(context, title, message, intent); | |
notification.flags |= Notification.FLAG_AUTO_CANCEL; | |
NotificationManager notificationManager = (NotificationManager) | |
context.getSystemService(Context.NOTIFICATION_SERVICE); | |
notificationManager.notify(0, notification); | |
} |
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
<attr name="hs_activityHeaderStyleRef" format="reference"/> | |
...etc | |
<!-- Light theme colors --> | |
<color name="hs_light_header_background_color">#58759d</color> | |
...etc | |
<!-- Dark theme colors --> | |
<color name="hs_dark_header_background_color">#222222</color> | |
...etc |
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
<style name="HSThemeCustom" parent="style/HSThemeLight"> | |
<!-- Attributes --> | |
<item name="hs_activityHeaderStyleRef">@style/hs_customActivityHeaderStyle</item> | |
...etc | |
</style> | |
<style name="hs_customActivityHeaderStyle"> | |
<item name="android:background">@color/hs_custom_header_background_color</item> | |
<item name="android:textColor">@color/hs_custom_header_font_color</item> | |
</style> | |
...etc |
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
<style name="HSThemeDark" parent="@android:style/Theme.Black.NoTitleBar"> | |
<!-- Attributes --> | |
<item name="hs_activityHeaderStyleRef">@style/hs_darkActivityHeaderStyle</item> | |
...etc | |
</style> | |
<style name="hs_darkActivityHeaderStyle"> | |
<item name="android:background">@color/hs_dark_header_background_color</item> | |
<item name="android:textColor">@color/hs_dark_header_font_color</item> | |
</style> |
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
<style name="HSThemeLight" parent="@android:style/Theme.Light.NoTitleBar"> | |
<!-- Attributes --> | |
<item name="hs_activityHeaderStyleRef">@style/hs_lightActivityHeaderStyle</item> | |
...etc | |
</style> | |
<style name="hs_lightActivityHeaderStyle"> | |
<item name="android:background">@color/hs_light_header_background_color</item> | |
<item name="android:textColor">@color/hs_light_header_font_color</item> | |
</style> |
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
import com.helpshift.HSCallable; | |
k.put ("hello", "world"); | |
k.put ("foo", "bar"); | |
hs.setMetadataCallback (new HSCallable (){ | |
public HashMap call() { | |
return k; | |
} | |
}); |
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
Helpshift hs; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
hs = new Helpshift (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
<path id="helpshift-classpath"> | |
<fileset dir="./libs/"> | |
<include name="Helpshift.jar"/> | |
</fileset> | |
</path> | |
<java classname="com.helpshift.HSPostCompileCheck" failonerror="true"> | |
<classpath refid="helpshift-classpath"/> | |
<arg value="<YOUR.APPLICATION.NAMESPACE>"/> | |
</java> |
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
-keepattributes InnerClasses | |
-keep class **.R | |
-keep class **.R$* { | |
<fields>; | |
} | |
-keep class com.helpshift.** { *; } | |
-keep class com.ibm.** { *; } |
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.showInbox(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.showQuestion(MyActivity.this, "QUESTION_PUBLISH_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
hs.showSection(MyActivity.this, "SECTION_PUBLISH_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
HashMap config = new HashMap (); | |
config.put("showConvOnReportIssue", true); | |
config.put("showReportIssue", true); | |
hs.showFaqs(MyActivity.this, config); |
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
HashMap config = new HashMap (); | |
config.putExtra("showConvOnReportIssue", true); | |
hs.showReportIssue(MyActivity.this, HashMap config); |
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
HashMap config = new HashMap (); | |
config.putExtra("showConvOnReportIssue", true); | |
hs.showSupport(MyActivity.this, HashMap config); |
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(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(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
public Notification buildNotification(String alert, Map<String, String> extras) { | |
if(!hs.isForeground()) { | |
return super.buildNotification(alert, extras); | |
} else { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment