https://onesignal.com/ 에 접속하여 Add App
Goole Android 선택
Firebase에서 Server Key와 Sender ID를 복사하여 붙여넣음
Unity 선택
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | using System.Collections; using System.Collections.Generic; using UnityEngine; public class OneSignalPushTest : MonoBehaviour { void Start() { // Enable line below to enable logging if you are having issues setting up OneSignal. (logLevel, visualLogLevel) OneSignal.SetLogLevel( OneSignal.LOG_LEVEL.INFO, OneSignal.LOG_LEVEL.INFO ); OneSignal.StartInit( "App-ID 입력" ) .HandleNotificationOpened( HandleNotificationOpened ) .EndInit(); OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification; } public static void HandleNotificationOpened( OSNotificationOpenedResult result ) { Debug.Log( "[HandleNotificationOpened] " + result.notification.ToString() ); } } | cs |
Unity SDK import 하고 코드 추가, App-ID 입력
https://documentation.onesignal.com/docs/unity-sdk-setup
apk 빌드하고 실행하면 Device가 등록되었다고 뜸
Check Subscribed Users 누르면 성공했다고 뜨고 Done 을 클릭하면 메세지 보낼 준비 완료
https://onesignal.com/apps/6047f21b-c7d5-4818-b6be-119c61904395/campaigns
Project Dash board로 들어가 Messages -> New Push로 메세지 전송