コード例 #1
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        UnityEngine.Debug.Log("Received a new message");
        var notification = e.Message.Notification;

        if (notification != null)
        {
            UnityEngine.Debug.Log("title: " + notification.Title);
            UnityEngine.Debug.Log("body: " + notification.Body);
        }
        if (e.Message.From.Length > 0)
        {
            UnityEngine.Debug.Log("from: " + e.Message.From);
        }
        if (e.Message.Data.Count > 0)
        {
            UnityEngine.Debug.Log("data:");
            foreach (System.Collections.Generic.KeyValuePair <string, string> iter in
                     e.Message.Data)
            {
                UnityEngine.Debug.Log("  " + iter.Key + ": " + iter.Value);
            }
        }
        UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
        //gameOverText.text = "asddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd";
    }
コード例 #2
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        if (PlayerData.Instance.GetAlarmSetting() == false)
        {
            return;
        }

        Debug.LogFormat("Received a new message from: " + e.Message.From);

        var notification = e.Message.Notification;

        if (notification != null)
        {
            Debug.Log("!!!!! title: " + notification.Title);
            Debug.Log("!!!!! body: " + notification.Body);
        }
        if (e.Message.From.Length > 0)
        {
            Debug.Log("!!!!! from: " + e.Message.From);
        }
        if (e.Message.Data.Count > 0)
        {
            Debug.Log("!!!!! data:");
            foreach (System.Collections.Generic.KeyValuePair <string, string> iter in e.Message.Data)
            {
                Debug.Log("!!!!!   " + iter.Key + ": " + iter.Value);
            }
        }
    }
コード例 #3
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        string gift_num  = "";
        string value_num = "";

        int gift  = -1;
        int value = -1;

        if (e.Message.Data.TryGetValue("Gift", out gift_num))
        {
            gift = int.Parse(gift_num);
        }

        if (e.Message.Data.TryGetValue("value", out value_num))
        {
            value = int.Parse(value_num);
        }

        if (gift != -1 && value != -1)
        {
            GameObject obj = UnityEngine.Object.Instantiate <GameObject>(Resources.Load("Prefabs/reward") as GameObject);
            obj.GetComponent <RewardPopup>().set_gift(gift, value);
            DialogManager.GetInstance().show(obj);
        }
    }
コード例 #4
0
    public virtual void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debug.Log(HELPSHIFT_PREFIX + " Received a new message");

        IDictionary <string, string> pushData = e.Message.Data;

        /// Check if the notification origin is Helpshift
        if (pushData.ContainsKey("origin") && pushData ["origin"].Equals("helpshift"))
        {
            Dictionary <string, object> hsPushData = new Dictionary <string, object> ();
            Debug.Log(HELPSHIFT_PREFIX + " Received a new message for Helpshift");
            foreach (string key in pushData.Keys)
            {
                hsPushData.Add(key, pushData [key]);
            }

            // Handle the notification with Helpshift SDK.
            _support.handlePushNotification(hsPushData);
            return;
        }

        ///
        /// Handle notification from other sources
        ///
    }
コード例 #5
0
    public virtual void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debug.LogWarning("Received a new message");
        var notification = e.Message.Notification;

        if (notification != null)
        {
            Debug.LogWarning("title: " + notification.Title);
            Debug.LogWarning("body: " + notification.Body);
        }
        if (e.Message.From.Length > 0)
        {
            Debug.LogWarning("from: " + e.Message.From);
        }
        if (e.Message.Link != null)
        {
            Debug.LogWarning("link: " + e.Message.Link.ToString());
        }
        if (e.Message.Data.Count > 0)
        {
            Debug.LogWarning("data:");
            foreach (System.Collections.Generic.KeyValuePair <string, string> iter in
                     e.Message.Data)
            {
                Debug.LogWarning("  " + iter.Key + ": " + iter.Value);
            }
        }
    }
コード例 #6
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        string gift_num  = "";
        string value_num = "";

        int gift  = -1;
        int value = -1;

        if (e.Message.Data.TryGetValue("Gift", out gift_num))
        {
            gift = int.Parse(gift_num);
        }

        if (e.Message.Data.TryGetValue("value", out value_num))
        {
            value = int.Parse(value_num);
        }

        if (gift != -1 && value != -1)
        {
            UIManager.Instance.PushgiftItem.Clear();

            List <int> star_item = new List <int>();
            star_item.Add(gift);
            star_item.Add(value);
            UIManager.Instance.PushgiftItem.Add(star_item);
            UIManager.Instance.Push_Gift();
            // ToastManager.instance.ShowToast(string.Format("gift = {0}.  val = {1}", gift, value));
        }
    }
コード例 #7
0
    public void onMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debug.Log("DUYNGUYEN: onMessageReceived");

        NotificationData newData = new NotificationData();

        newData.From = e.Message.From;
        newData.Link = e.Message.Link;
        newData.To   = e.Message.To;
        if (e.Message.From.Contains("topic"))
        {
            newData.Type = NotificationType.Topic;
        }
        else
        {
            newData.Type = NotificationType.Broadcast;
        }

        newData.Title   = e.Message.Data ["title"];
        newData.Message = e.Message.Data ["message"];

        newData.ShowLog();
        if (OnNotificationReceived != null)
        {
            OnNotificationReceived(newData);
        }
    }
コード例 #8
0
 private void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     if (e.Message.Data != null)
     {
         Debug.Log("PlayFab: Received a message with data");
     }
     if (e.Message.Notification != null)
     {
         Debug.Log("PlayFab: Received a notification");
     }
 }
コード例 #9
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e) {
   DebugLog("Received a new message");
   if (e.Message.From.Length > 0)
     DebugLog("from: " + e.Message.From);
   if (e.Message.Data.Count > 0) {
     DebugLog("data:");
     foreach (System.Collections.Generic.KeyValuePair<string, string> iter in
              e.Message.Data) {
       DebugLog("  " + iter.Key + ": " + iter.Value);
     }
   }
 }
コード例 #10
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debug.Log("Received a new message from: " + e.Message.From);
        var firebaseMessage = e.Message;

        Debug.Log("Title:" + firebaseMessage.Notification.Title);
        Debug.Log("Body: " + firebaseMessage.Notification.Body);
        Debug.Log("Raw data: " + firebaseMessage.RawData);
        Debug.Log("Data count: " + firebaseMessage.Data.Count);
        Debug.Log("Error: " + firebaseMessage.ErrorDescription);
        Debug.Log("Boolean was:" + firebaseMessage.Data.ContainsKey("image"));
        NotificationManager.SendWithAppIcon(new TimeSpan(0, 0, 20), firebaseMessage.Notification.Title, firebaseMessage.Notification.Body, Color.white);
    }
コード例 #11
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
     Notification.text = "notification received " + e.Message.Data.Count;
     if (e.Message.Data.Count > 0)
     {
         Notification.text = "notification handling";
         Instantiate(popup);
         foreach (System.Collections.Generic.KeyValuePair <string, string> iter in e.Message.Data)
         {
             Notification.text = "notification received" + " " + iter.Key + ": " + iter.Value;
         }
     }
 }
コード例 #12
0
ファイル: UnityFirebase.cs プロジェクト: zhydian/ChimeraTV
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        string msgData = "";

        if (e.Message.Data.ContainsKey("command"))
        {
            Debug.Log("found Command Key");
            DisplayManager.displayManager.addtodebug("Command Received:" + e.Message.Data["command"]);
            DisplayManager.displayManager.addtodebug("Command Received:" + e.Message.Data["command"]);
            switch (e.Message.Data["command"])
            {
            case "getSettings":
                DisplayManager.displayManager.getSettings();
                DisplayManager.displayManager.addtodebug("Getting Settings because FCM Said so");
                break;

            case "stopCharon":
                scripttest.UnityKioskMode.StopCharon();
                break;

            case "RestartApp":
                DisplayManager.displayManager.restartApp();
                break;

            case "LaunchApp":
                scripttest.UnityKioskMode.LaunchApp(e.Message.Data["packageName"]);
                break;

            case "Quit":
                Application.Quit();
                break;

            case "AttemptReconnectFirebase":
                DisplayManager.displayManager.markAsConnected();
                break;
            }
        }
        else
        {
            Debug.Log("Couldn't find key");
        }

        if (e.Message.Data.ContainsKey("packageName"))
        {
            DisplayManager.displayManager.addtodebug("Package Received:" + e.Message.Data["packageName"]);
        }

        //UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
    }
コード例 #13
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        if (e.Message == null)
        {
            Debug.Log("Null message received");
            return;
        }
        Debug.Log("Received a new message from: " + e.Message.From);
        //e.Message.data; ->dict
        //e.Message.Notification.Title;
        //e.Message.Notification.Body;

        if (e.Message.Notification == null)
        {
            Debug.Log("Got message with data only? ");
        }


        eventDesc newEvent = tryLoadingEventDesc(e.Message.Data);

        if (newEvent == null)
        {
            Debug.Log("Malformed data in message");
            return;
        }
        if (e.Message.Notification != null)
        {
            NotificationUI.spawnNotification(e.Message.Notification.Title, e.Message.Notification.Body, newEvent);
            if (EventRestAPI.Instance != null)
            {
                EventRestAPI.Instance.processNewNotification(newEvent, false);
            }
            else
            { //we are asleep?
                EventRestAPI.notificationsWoken.Add(newEvent);
            }
        }
        else
        {
            //probably means that you got message from clicking on notification outside
            //do not spawn notification, just process data...
            EventRestAPI.notificationsWoken.Add(newEvent); //no guarantee this will fire first...
            if (EventRestAPI.Instance != null && EventRestAPI.Instance.lifecycleReady)
            {
                EventRestAPI.Instance.reloadNotified();
            }
        }
    }
コード例 #14
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debugging.instance.Loglate("OnMessageReceived_Debugging new message");
        var notification = e.Message.Notification;

        if (notification != null)
        {
            Debugging.instance.Loglate($"Received Title: {notification.Title}");
            Debugging.instance.Loglate($"Received Body: {notification.Body}");

            if (notification.Android != null)
            {
                Debugging.instance.Loglate($"Received ChannelId: {notification.Android?.ChannelId}");
            }
        }
        else
        {
            Debugging.instance.Loglate($"notification is null reciveMessage : {e.Message}");
        }

        try
        {
            if (e.Message.From.Length > 0)
            {
                Debugging.instance.Loglate("from: " + e.Message.From);
            }


            if (e.Message.Link != null)
            {
                Debugging.instance.Loglate("link: " + e.Message.Link.ToString());
            }

            if (e.Message.Data.Count > 0)
            {
                Debugging.instance.Loglate("data:");
                foreach (KeyValuePair <string, string> iter in e.Message.Data)
                {
                    Debugging.instance.Loglate("  " + iter.Key + ": " + iter.Value);
                }
            }
        }
        catch (Exception ex)
        {
            Debugging.instance.Loglate($"OnMessageReceived = {ex.Message}");
        }
    }
コード例 #15
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debug.Log("Received a new message from: " + e.Message.From);
        string popup_title   = "";
        string popup_content = "";
        var    notification  = e.Message.Notification;

        if (notification != null)
        {
            Debug.Log("title: " + notification.Title);
            Debug.Log("body: " + notification.Body);
            popup_title   = notification.Title;
            popup_content = notification.Body;
        }
        if (e.Message.From.Length > 0)
        {
            Debug.Log("from: " + e.Message.From);
        }
        if (e.Message.Data.Count > 0)
        {
            Debug.Log("data:");
            foreach (System.Collections.Generic.KeyValuePair <string, string> iter in e.Message.Data)
            {
                Debug.Log("  " + iter.Key + ": " + iter.Value);
                if (iter.Key.Equals("body"))
                {
                    popup_content = iter.Value;
                }
                else if (iter.Key.Equals("title"))
                {
                    popup_title = iter.Value;
                }
            }
        }
        //TitleText.text = popup_title;
        //ContentText.text = popup_content;
        Debug.Log("---Received notification content : " + popup_content + "------");

        ShowNotification();
        if (popup_content.Contains("http"))
        {
            GameObject.Find("WebViewManager").GetComponent <WebViewManager>().LoadLink(popup_content);
        }
        //else
        //NotificationPopup.SetActive(true);
    }
コード例 #16
0
    // Setup message event handlers.
    //void InitializeFirebase() {
    //    //Firebase.Messaging.FirebaseMessaging.Subscribe(topic);
    //    Debug.Log("Firebase Messaging Initialized\n");
    //}

    public virtual void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        Debug.Log("Received a new message");
        var notification = e.Message.Notification;

        if (notification != null)
        {
            Debug.Log("title: " + notification.Title);
            Debug.Log("body: " + notification.Body);
        }
        if (e.Message.From.Length > 0)
        {
            Debug.Log("from: " + e.Message.From);
        }
        if (e.Message.Link != null)
        {
            Debug.Log("link: " + e.Message.Link.ToString());
        }
        if (e.Message.Data.Count > 0)
        {
            Debug.Log("data:");
            foreach (System.Collections.Generic.KeyValuePair <string, string> iter in
                     e.Message.Data)
            {
                Debug.Log("  " + iter.Key + ": " + iter.Value);
            }
            if (e.Message.Data.ContainsKey("alert"))
            {
                //Message newMessage = new Message();
                //newMessage.videoName = e.Message.Data["videoName"];
                //newMessage.eventFrame = int.Parse(e.Message.Data["eventFrame"]);
                //newMessage.eventDetectedTime = e.Message.Data["eventTime"];

                //newMessage.messageReceivedTime = System.DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss");

                AudioManager.Instance.PlaySoundEffect("alert");

                //DataManager.Instance.AddMessage(newMessage);
                DataManager.Instance.SaveData();

                messageListPanelController.messageListRequestClient.SyncMessageList();
            }
        }
    }
コード例 #17
0
ファイル: MsgCatcher.cs プロジェクト: youdk/UnicornBattle
 private void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     Debug.Log("PlayFab: Received a new message from: " + e.Message.From);
     lastMsg = "";
     if (e.Message.Data != null)
     {
         lastMsg += "DATA: " + JsonWrapper.SerializeObject(e.Message.Data) + "\n";
         Debug.Log("PlayFab: Received a message with data:");
         foreach (var pair in e.Message.Data)
         {
             Debug.Log("PlayFab data element: " + pair.Key + "," + pair.Value);
         }
     }
     if (e.Message.Notification != null)
     {
         Debug.Log("PlayFab: Received a notification:");
         lastMsg += "TITLE: " + e.Message.Notification.Title + "\n";
         lastMsg += "BODY: " + e.Message.Notification.Body + "\n";
     }
 }
コード例 #18
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        var notification = e.Message.Notification;

        if (notification != null)
        {
            Log("title: " + notification.Title);
            Log("body: " + notification.Body);
        }
        if (e.Message.From.Length > 0)
        {
            Log("from: " + e.Message.From);
        }

        if (e.Message.Data.Count > 0)
        {
            foreach (var iter in e.Message.Data)
            {
                Log("\t-" + iter.Key + ": " + iter.Value);
            }
        }
    }
コード例 #19
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        UnityEngine.Debug.Log("XXX: MESSAGE RECEIVED");
        UnityEngine.Debug.Log("XXX: Received a new message from: " + e.Message.From);
        var notification = e.Message.Notification;

        copyText = GetComponent <UnityEngine.UI.Text>();

        if (notification != null)
        {
            UnityEngine.Debug.Log("XXX: title: " + notification.Title);
            UnityEngine.Debug.Log("XXX: body: " + notification.Body);
            copyText.text  = "title: " + notification.Title;
            copyText.text += "\nbody: " + notification.Body;
        }

        if (e.Message.From.Length > 0)
        {
            UnityEngine.Debug.Log("XXX: from: " + e.Message.From);
        }

        if (e.Message.Link != null)
        {
            UnityEngine.Debug.Log("XXX: link: " + e.Message.Link.ToString());
        }

        if (e.Message.Data.Count > 0)
        {
            UnityEngine.Debug.Log("XXX: data:");
            foreach (System.Collections.Generic.KeyValuePair <string, string> iter in
                     e.Message.Data)
            {
                UnityEngine.Debug.Log("  XXX: " + iter.Key + ": " + iter.Value);
                copyText.text += "\n  XXX: " + iter.Key + ": " + iter.Value;
            }
        }
    }
コード例 #20
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     Debug.Log("Received a new message from: " + e.Message.From);
     notificationTokenTxt.text = "Mesaj: " + e.Message.Data;
 }
コード例 #21
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
 }
コード例 #22
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
     Analytics.LogEvent("Received a new message from: " + e.Message.From);
 }
コード例 #23
0
    public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
    {
        UnityEngine.Debug.Log("Received a new message from: " + e.Message.RawData);

        //UI.I.ShowMsgBox(e.Message.Notification.Body);
    }
コード例 #24
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     UnityEngine.Debug.Log("From: " + e.Message.From);
     UnityEngine.Debug.Log("Message ID: " + e.Message.MessageId);
 }
コード例 #25
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     print("message rec");
     Debug.Log("Received a new message from: " + e.Message.From);
     Debug.Log("Message ID: " + e.Message.MessageId);
 }
コード例 #26
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
     //Assets.SimpleAndroidNotifications.NotificationManager.SendWithAppIcon(TimeSpan.FromSeconds(0), e.Message.Notification.Title, e.Message.Notification.Body, new Color(0, 0.6f, 1), Assets.SimpleAndroidNotifications.NotificationIcon.Event);
 }
コード例 #27
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     Debug.Log("Received Registration Token: " + e.Message.From);
 }
コード例 #28
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     UnityEngine.Debug.Log("*** Received a new message from: " + e.Message.From);
     UnityEngine.Debug.Log("*** message data: " + e.Message.Data);
     UnityEngine.Debug.Log("*** message raw: " + e.Message.RawData);
 }
コード例 #29
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     Debug.Log("Received a new messagem from: " + e.Message.From);
 }
コード例 #30
0
 public void OnMessageReceived(object sender, Firebase.Messaging.MessageReceivedEventArgs e)
 {
     UnityEngine.Debug.Log("Received a new message from: " + e.Message.From);
     //test.text = "Received a new message form : " + e.Message.From;
 }