Blueshift Configuration

Configuration is an important class where you set all the values required by the SDK to work properly. You will need to pass a valid instance of this class to initialise the Blueshift Android SDK.

There are two mandatory values you need to set inside configuration object before initialisation. They are app icon and api key. Rest of the methods are optional. However you can make use of them to customise the SDK based on your requirements.

App Icon

Setting an app icon is required to display the notifications.

config.setAppIcon(R.mipmap.ic_launcher);

API Key

API key is required for accessing blueshift end point to send your events.

config.setApiKey("YOUR_BLUESHIFT_API_KEY");

Deep-Link

Blueshift Android SDK supports category based deep-link. SDK will look for specific categories in the payload and will land the user to the activities corresponding to the actions.

Ex: If user clicks on Buy button in a notification they will be taken to the Cart page. This cart page must be specified in the configuration when initialising the SDK to get this working.

config.setProductPage(ProductActivity.class);
config.setCartPage(CartActivity.class);
config.setOfferDisplayPage(OfferDisplayActivity.class);

Please note that if the deep_link_url is present in the payload, it will have higher priority. Hence the deep-link using category will not work. SDK will always open the MAIN/LAUNCHER activity and pass the deep_link_url inside bundle.

Notification

Following optional methods will let you style the notification.

Icons

Set the custom icons for notification. You can specify both small and big icons using resource ids.

config.setLargeIconResId(R.drawable.notification_big_icon);
config.setSmallIconResId(R.drawable.notification_small_icon);

Color

From API level 21, Android supports setting color for notification. Following method will let the developer configure the color of notification rendered by Blueshift Android SDK

config.setNotificationColor(colorInt);

Channel

 From Android Oreo, the notification framework requires a channel to be defined when you create a notification. If channel is not present, Oreo will skip the notification.

// Optional: if not set and not found in payload,
// SDK will assign a default id (bsft_channel_General).
config.setDefaultNotificationChannelId("app_channel_id");

// Optional: if not set and not found in payload,
// SDK will assign a default name (General).
config.setDefaultNotificationChannelName("app_channel_name");

// optional: only set if present in payload or config object
config.setDefaultNotificationChannelDescription("app_channel_description");

Batch Interval

SDK sends the events to a bulk event API if marked as batch events. The batched events are sent in a default interval of 30min. You can override the same as given below.

// == Batched Events (Optional) ==
/*
* This is the time interval used for batching events which are then
* sent to Blueshift using the bulk events api call. It defaults to
* 30 min if not set.
*
* It is recommended to use one of the following for API < 19 devices.
* AlarmManager.INTERVAL_FIFTEEN_MINUTES
* AlarmManager.INTERVAL_HALF_HOUR
* AlarmManager.INTERVAL_HOUR
* AlarmManager.INTERVAL_HALF_DAY
* AlarmManager.INTERVAL_DAY
*/
config.setBatchInterval(timeInMilliSeconds);
  

 

In-App Message Interval

You can configure the time interval between two in-app messages. By default, the value is 1 min. To change that, call the following method while initializing the SDK. 

configuration.setInAppInterval(timeInSeconds);

If multiple ini-app messages are queued for the user, the next in-app message will be displayed after 1 min (or the time you set) from the moment the user dismisses the current in-app message.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request