java.lang.Object | |
↳ | com.helpshift.Core |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Core() |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static void | handlePush(Context context, Bundle data) | ||||||||||
static void |
handlePush(Context context, Intent intent)
This will handle push received from Helpshift using either GCM push or Urban Airship.
| ||||||||||
static void |
init(Core.ApiProvider apiProvider)
Initialize the Core class with the Helpshift service that you want to use.
| ||||||||||
static void |
install(Application application, String apiKey, String domain, String appId)
Installs the Helpshift Android SDK in your app.
| ||||||||||
static void |
install(Application application, String apiKey, String domain, String appId, Map config)
Installs the Helpshift Android SDK in your app with Config.
| ||||||||||
static void |
login(String userId, String name, String email)
Login a user with a given user identifier, name and email.
| ||||||||||
static void |
logout()
Logout a currently logged in user.
| ||||||||||
static void |
registerDeviceToken(Context context, String deviceToken)
If you are using GCM push or Urban Airship and if you want to enable Push Notification in the
Helpshift Android SDK, set the Android Push ID (APID) using this method, inside your IntentReceiver for Handling of Push Events.
| ||||||||||
static void |
setNameAndEmail(String name, String email)
(Optional) You can specify the name and email for your User.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
This will handle push received from Helpshift using either GCM push or Urban Airship. This will handle all the push received from Campaigns and Support. It will group all alerts received via. push by their respective issue id. This will also perform the proper isForeground check to see if that issue is visible. For Example (GCM) :- Inside your GCMIntentService
@Override protected void onMessage(Context context, Intent intent) { if(intent.getExtras().getString("origin").equals("helpshift")) { Intent i = new Intent(); i.setAction("HS_ON_MESSAGE"); i.putExtras(intent); sendBroadcast(i); } } }And inside your GCMIntentReceiver
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(action.equals("HS_ON_MESSAGE")) { Core.handlePush(context, intent); } }For Example (Urban Airship) :-
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(PushManager.ACTION_PUSH_RECEIVED)) { if(intent.getExtras().getString("origin").equals("helpshift")) { Core.handlePush(context, intent); } } }
context | The received context. |
---|---|
intent | The received intent. |
Initialize the Core class with the Helpshift service that you want to use. Currently helpshift supports following three apiProviders : 1. Support 2. Campaigns 3. All
For example:Core.int(All.getInstance());
Installs the Helpshift Android SDK in your app.
Core.install(getApplication(), "<YOUR_API_KEY>", "<yourcompany>.helpshift.com", "<YOUR_APP_ID>");
application | Your application state. |
---|---|
apiKey | Your developer API Key. |
domain | Your domain name without any http:// or forward slashes. |
appId | The unique ID assigned to your app. |
Installs the Helpshift Android SDK in your app with Config.
HashMap config = new HashMap(); config.put("notificationIcon", R.drawable.megaphone); config.put("enableInAppNotification", true); config.put("notificationSound", R.raw.notification_sound); config.put("enableDialogUIForTablets", true); config.put("enableDefaultFallbackLanguage", false); Core.install(getApplication(), "<YOUR_API_KEY>", "<yourcompany>.helpshift.com", "<YOUR_APP_ID>", config);There are four values supported in this config -
application | Your application state. |
---|---|
apiKey | Your developer API Key. |
domain | Your domain name without any http:// or forward slashes. |
appId | The unique ID assigned to your app. |
config | The config to install call. |
Login a user with a given user identifier, name and email. This API introduces support for multiple login in Helpshift. The user identifier uniquely identifies the user. Name and email are optional. If any Support session is active, then any login attempt for support sdk is ignored.
userId | The unique identifier of the user. |
---|---|
name | (Optional) The name of the user. |
(Optional) The email of the user. |
Logout a currently logged in user. After logout, Helpshift falls back to the default login. If any Support session is active, then any logout attempt is ignored in support sdk.
If you are using GCM push or Urban Airship and if you want to enable Push Notification in the Helpshift Android SDK, set the Android Push ID (APID) using this method, inside your IntentReceiver for Handling of Push Events. For Example (GCM) :-
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if(action.equals("HS_ON_SEND")) { final String regId = GCMRegistrar.getRegistrationId(context); Core.registerDeviceToken(context, regId); } }For Example (Urban Airship) :-
@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(PushManager.ACTION_REGISTRATION_FINISHED)) { final String regId = PushManager.shared().getAPID(); Core.registerDeviceToken(context, regId); } }
context | The received context. |
---|---|
deviceToken | This is the Android Push ID (APID) |
(Optional) You can specify the name and email for your User.
For example:Core.setNameAndEmail("John", "john@example.com");
name | User name |
---|---|
User email |