// Use this for initialization void Start() { Pushwoosh.Instance.OnRegisteredForPushNotifications += onRegisteredForPushNotifications; Pushwoosh.Instance.OnFailedToRegisteredForPushNotifications += onFailedToRegisteredForPushNotifications; Pushwoosh.Instance.OnPushNotificationsReceived += onPushNotificationsReceived; Pushwoosh.Instance.OnInitialized += OnPushwooshInitialized; #if UNITY_ANDROID && !UNITY_EDITOR androidPushManager = Pushwoosh.Instance as PushNotificationsAndroid; #endif }
// Use this for initialization void Start() { Pushwoosh.Instance.OnRegisteredForPushNotifications += onRegisteredForPushNotifications; Pushwoosh.Instance.OnFailedToRegisteredForPushNotifications += onFailedToRegisteredForPushNotifications; Pushwoosh.Instance.OnPushNotificationsReceived += onPushNotificationsReceived; Pushwoosh.Instance.OnInitialized += OnPushwooshInitialized; #if UNITY_ANDROID && !UNITY_EDITOR androidPushManager = Pushwoosh.Instance as PushNotificationsAndroid; #endif }
/// <summary> /// Use this to set this user's name as tag for push notifications. Call when the name changed. /// </summary> /// <param name="userName">Unique user ID. In best case verified with Custom Authentication.</param> public void SetNameTagForPushNotifications(string userName, string appId) { #if UNITY_EDITOR || !UNITY_ANDROID Debug.LogWarning("Not able to set a push-message-tag because the system doesn't support it. Skipping that."); #else // without this, the client won't register for push notifications // we modified the Assets/Plugins/Android/AndroidManifest.xml with our pushwoosh app values PushNotificationsAndroid pn = this.gameObject.AddComponent <PushNotificationsAndroid>(); if (pn != null) { pn.setStringTag(TagForUserId, userName); if (appId != null) { pn.setStringTag(TagForAppId, appId); } } else { Debug.LogError("PushNotificationsAndroid component is missing?!"); } #endif }