Enable / Disable Push Notification
You can set whether users receive push notifications.
// Enable Push Notification
TalkPlusApi.EnablePushNotification(() => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
// Disable Push Notification
TalkPlusApi.DisablePushNotification(() => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
You can set whether you want to receive push notifications from specific channels.
// Enable Push Notification from the channel
TalkPlusApi.EnableChannelPushNotification(channel, (TPChannel channel) => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
// Disable Push Notification from the channel
TalkPlusApi.DisableChannelPushNotification(channel, (TPChannel channel) => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
Push Notification
Push Notification is handled by FCM.
First, integrate FCM on TalkPlus dashboard. Then, when a user logs in, call registerFCMToken
function to register FCM token from that device.
The following code demonstrates how you can obtain and register an FCM token.
TalkPlusApi.RegisterFCMToken(fcmToken, () => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
After that, call ProcessFirebaseCloudMessagingData
in OnMessageReceived
to handle Push Notification.
public static void OnMessageReceived(object sender, MessageReceivedEventArgs e)
{
if (e.Message.Data.ContainsKey("talkplus"))
{
TalkPlusApi.ProcessFirebaseCloudMessagingData(e.Message.Data);
}
}
Last updated