1234567891011121314151617181920212223242526272829303132333435 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class PushNotificator : MonoBehaviour {
- // use for initialization
- void Start()
- {
- Pushwoosh.ApplicationCode = "5C944-4CEA2";
- Pushwoosh.GcmProjectNumber = "859354393071";
- Pushwoosh.Instance.OnRegisteredForPushNotifications += OnRegisteredForPushNotifications;
- Pushwoosh.Instance.OnFailedToRegisteredForPushNotifications += OnFailedToRegisteredForPushNotifications;
- Pushwoosh.Instance.OnPushNotificationsReceived += OnPushNotificationsReceived;
- Pushwoosh.Instance.RegisterForPushNotifications();
- }
- void OnRegisteredForPushNotifications(string token)
- {
- // handle here
- Debug.Log("Received token: \n" + token);
- }
- void OnFailedToRegisteredForPushNotifications(string error)
- {
- // handle here
- Debug.Log("Error ocurred while registering to push notifications: \n" + error);
- }
- void OnPushNotificationsReceived(string payload)
- {
- // handle here
- Debug.Log("Received push notificaiton: \n" + payload);
- }
- }
|