我正在尝试从Firebase调用通知,并且设法在关闭应用程序或在后台运行时获取通知,但是问题是我在应用程序内部时从未收到通知,我该如何配置Firebase以便我还可以在应用运行时发出通知?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FireBaseNotificationController : MonoBehaviour {
public string valueTokeniD;
// Use this for initialization
void Start()
{
Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;
Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;
}
public void OnTokenReceived(object sender, Firebase.Messaging.TokenReceivedEventArgs token)
{
valueTokeniD = token.Token;
Debug.Log("onToken ID:" + token.Token);
UnityEngine.Debug.Log("Received Registration Token: " + token.Token);
}
public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
{
UnityEngine.Debug.Log("From: " + e.Message.From);
UnityEngine.Debug.Log("Message ID: " + e.Message.MessageId);
}
}