Created
April 1, 2019 17:46
-
-
Save troy-lamerton/12e958b9b6e82118382df1cd9119bae4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class OneSignalClient : MonoBehaviour { | |
void Start() { | |
InitOneSignal(); | |
} | |
public void InitOneSignal() { | |
OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE); | |
OneSignal.StartInit(ClientConfig.oneSignalAppId) | |
.HandleNotificationOpened(HandleNotificationOpened) | |
.EndInit(); | |
OneSignal.SetLocationShared(false); | |
OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification; | |
} | |
public static void HandleNotificationOpened(OSNotificationOpenedResult result) { | |
string extraData = JsonConvert.SerializeObject(result.notification.payload.additionalData); | |
Debug.Log($"Handled notification. Extra data: {extraData}\naction id: {result.action.actionID}"); | |
Debug.Log( | |
$"Images used: largeIcon:{result.notification.payload.largeIcon}\nbigPicture:{result.notification.payload.bigPicture}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment