Push Notification
사용자가 Push Notification을 받을 지 여부를 설정할 수 있습니다.
// Enable push notification
TalkPlusApi.EnablePushNotification(() => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
// Disable push notification
TalkPlusApi.DisablePushNotification(() => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
TalkPlus의 Push Notification은 FCM을 통하여 이루어지게 됩니다. 기본적인 FCM을 연동하신 후, User를 로그인한 후
RegisterFCMToken
함수를 호출하여 FCM 토큰을 User 세션에 연동하여야 합니다.TalkPlusApi.RegisterFCMToken(fcmToken, () => {
// SUCCESS
}, (int statusCode, Exception e) => {
// FAILURE
});
이후 아래와 같이
OnMessageReceived
에 TalkPlus에서 제공하는 ProcessFirebaseCloudMessagingData
함수를 호출하는 코드를 삽입하여 Push Notification을 처리할 수 있습니다.public static void OnMessageReceived(object sender, MessageReceivedEventArgs e)
{
if (e.Message.Data.ContainsKey("talkplus"))
{
TalkPlusApi.ProcessFirebaseCloudMessagingData(e.Message.Data);
}
}
Last modified 12d ago