|
|
|
@ -13,18 +13,31 @@ public class OSNInitializer : MonoBehaviour
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void InitializeOSN()
|
|
|
|
|
{
|
|
|
|
|
RequestPermissionToAllowNotifications();
|
|
|
|
|
string ons_id = "";
|
|
|
|
|
#if UNITY_ANDROID
|
|
|
|
|
ons_id = GameConstants.OSN_Android;
|
|
|
|
|
#elif UNITY_IOS
|
|
|
|
|
ons_id = GameConstants.OSN_iOS;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
Debug.Log($"Initializing with appId <b>{ons_id}</b>");
|
|
|
|
|
OneSignal.Debug.LogLevel = LogLevel.Debug;
|
|
|
|
|
OneSignal.Initialize(ons_id);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// This function is used to Request permission to Allow Notifications for the app
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void RequestPermissionToAllowNotifications()
|
|
|
|
|
{
|
|
|
|
|
Debug.Log("Requesting permission to allow notifications");
|
|
|
|
|
OneSignal.Notifications.RequestPermissionAsync(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|