「Unity/Firebase/CloudMessaging」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==DL&Import== FirebaseMessaging.unitypackage」) |
(→DL&Import) |
||
行1: | 行1: | ||
==DL&Import== | ==DL&Import== | ||
FirebaseMessaging.unitypackage | FirebaseMessaging.unitypackage | ||
+ | |||
+ | ==サンプル== | ||
+ | <pre> | ||
+ | public void Start() { | ||
+ | Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived; | ||
+ | Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived; | ||
+ | } | ||
+ | |||
+ | public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) { | ||
+ | UnityEngine.Debug.Log("Received Registration Token: " + token.Token); | ||
+ | } | ||
+ | |||
+ | public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) { | ||
+ | UnityEngine.Debug.Log("Received a new message from: " + e.Message.From); | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | ==参考== | ||
+ | 公式fcm | ||
+ | https://firebase.google.com/docs/cloud-messaging/unity/client?hl=ja |
2019年6月1日 (土) 22:01時点における版
DL&Import
FirebaseMessaging.unitypackage
サンプル
public void Start() { Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived; Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived; } public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token) { UnityEngine.Debug.Log("Received Registration Token: " + token.Token); } public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) { UnityEngine.Debug.Log("Received a new message from: " + e.Message.From); }
参考
公式fcm https://firebase.google.com/docs/cloud-messaging/unity/client?hl=ja