Managing Notifications
Detailed in this page is how you can set up push notifications as well as manage in-app notifications for new in-app chat messages.
Push Notifications
You can enable Instabug to send your users push notifications each time you send them a new message.
Push Notification Key
Follow the steps below to upload your push certificate to your Instabug dashboard.
- Go to the Push Notifications page on your Instabug dashboard and add you
API_KEY
. - Make sure to select whether the
API_KEY
you're adding is for development or production.
Setting Your App to Handle Instabug Notifications
Pass the push notification registration token you get to Instabug.
Replies.setPushNotificationRegistrationToken("PUSH_NOTIFICATION_TOKEN");
Replies.setPushNotificationRegistrationToken("PUSH_NOTIFICATION_TOKEN")
When you receive a notification, check if it's an Instabug notification, then pass it to Instabug if necessary.
if(Replies.isInstabugNotification(data)){
//Shown notification related to Instabug
Replies.showNotification(data);
}
if(Replies.isInstabugNotification(data)){
//Shown notification related to Instabug
Replies.showNotification(data)
}
Notification Channel ID
You can use channels to group the incoming Instabug notifications into a manageable group. To do this, you simply need to pass the channel ID to the below API.
Replies.setPushNotificationChannelId(String pushNotificationChannelId);
Replies.setPushNotificationChannelId(String pushNotificationChannelId)
Notification Icon
The icon that is shown with each push notification can be changed to match your application's icon. The API below can be used to change this icon.
Replies.setNotificationIcon(@DrawableRes int notificationIcon);
Replies.setNotificationIcon(@DrawableRes int notificationIcon)
Disabling Push Notifications
Push notifications are enabled by default if you upload a push certificate to your Instabug dashboard. To disable them, modify your builder method as in the following example.
Replies.setPushNotificationState(Feature.State.DISABLED);
Replies.setPushNotificationState(Feature.State.DISABLED)
In-App Notifications
By default, a notification will be shown on top of your app's UI when a new message is received.
Email Notifications
If your user doesn't view the new message within 10 minutes, they will be sent an email notification as well.
Disabling In-App Notifications
Use the following method to disable notifications that appear in-app.
Replies.setReplyNotificationEnabled(false);
Replies.setReplyNotificationEnabled(false)
In-App Notification Sound
When your app users receive an in-app notification through Instabug, sound is enabled by default. However, you can disable it by using the following method.
Replies.setInAppNotificationEnabled(false);
Replies.setInAppNotificationEnabled(false)
System Notification Sound
System notification sound is disabled by default. You can enable it by adding the following method to Instabug builder.
Replies.setSystemReplyNotificationSoundEnabled(true);
Replies.setSystemReplyNotificationSoundEnabled(true)
Conversation Sound
When your app users receive a new in-app chat in a conversation with you, sound is also enabled by default. You can disable it by adding the following method to Instabug builder.
Replies.setShouldPlayConversationSounds(false);
Replies.setShouldPlayConversationSounds(false)
Get Unread Messages Count
You can use the following method to get the number of messages the user has yet to read.
Replies.getUnreadRepliesCount();
Replies.getUnreadRepliesCount()
Updated about 4 years ago
Learn to identify your users so that push notifications always go to the correct user. Also check out how to communicate with your users by chatting with them through different pages.