コード例 #1
0
    public void TestPushStuff()
    {
        Notifications.CreatePushNotificationChannelForApplication((response) =>
        {
            if (response.Status == CallbackStatus.Failure)
            {
                Debug.LogError("Push notification channel creation failed: " + response.Exception.Message);
                return;
            }

            Debug.Log("Push channel URL: " + response.Result.Uri.ToString());
        });

        Notifications.RegisterForNotifications((response) =>
        {
            if (response.Status == CallbackStatus.Failure)
            {
                Debug.LogError("Push notification channel creation failed: " + response.Exception.Message);
                return;
            }

            Debug.Log("Notification content: " + response.Result.ToString());
            Debug.Log("Push notifications tested");
            text.text = "Push notification test successful";
        }, true);
    }