Example #1
0
	public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived) {
		var dict = Json.Deserialize(jsonString) as Dictionary<string, object>;
		Dictionary<string, object> additionalData = null;
		if (dict.ContainsKey("custom"))
			additionalData = dict["custom"] as Dictionary<string, object>;

		notificationReceived((string)(dict["alert"]), additionalData, (bool)dict["isActive"]);
	}
Example #2
0
 public OneSignalAndroid(string gameObjectName, string googleProjectNumber, string appId, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
     mOneSignal = new AndroidJavaObject("com.onesignal.OneSignalUnityProxy", gameObjectName, googleProjectNumber, appId, (int)logLevel, (int)visualLevel);
 }
Example #3
0
 public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
     mOneSignal.Call("setLogLevel", (int)logLevel, (int)logLevel);
 }
Example #4
0
    public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived)
    {
        var dict = Json.Deserialize(jsonString) as Dictionary<string, object>;

        string message = (string)(dict["alertMessage"]);
        dict.Remove("alertMessage");

        bool isActive = (bool)dict["isActive"];
        dict.Remove("isActive");

        notificationReceived(message, dict, isActive);
    }
Example #5
0
 public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
     _setLogLevel((int)logLevel, (int)visualLevel);
 }
Example #6
0
 public OneSignalIOS(string gameObjectName, string appId, bool autoRegister, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
     _init(gameObjectName, appId, autoRegister, (int)logLevel, (int)visualLevel);
 }
 public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
 }
 // Doesn't apply to Windows Phone: The Callback is setup in the constructor so this is never called.
 public void FireNotificationReceivedEvent(string jsonString, OneSignal.NotificationReceived notificationReceived)
 {
 }
      public OneSignalIOS(string appId, bool autoPrompt, bool inAppLaunchURLs, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
      {
         var convertedLogLevel = (iOS.OneSLogLevel)((int)logLevel);
         var convertedVisualLevel = (iOS.OneSLogLevel)((int)visualLevel);

         iOS.OneSignal.SetLogLevel(convertedLogLevel, convertedVisualLevel);
         var dict = new Foundation.NSDictionary("kOSSettingsKeyInAppLaunchURL", new Foundation.NSNumber(inAppLaunchURLs), 
                                                "kOSSettingsKeyAutoPrompt", new Foundation.NSNumber(autoPrompt),
                                                "kOSSettingsKeyInFocusDisplayOption", new Foundation.NSNumber((int)displayOption)
                                               );
         iOS.OneSignal.InitWithLaunchOptions(new Foundation.NSDictionary(), appId, NotificationReceivedHandler, NotificationOpenedHandler, dict);

      }
 public void SetLogLevel (OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
    var convertedLogLevel = (iOS.OneSLogLevel)((ulong)((int)logLevel));
    var convertedVisualLevel = (iOS.OneSLogLevel)((ulong)((int)visualLevel));
    iOS.OneSignal.SetLogLevel (convertedLogLevel, convertedVisualLevel);
 }
		public void SetInFocusDisplaying(OneSignal.OSInFocusDisplayOption display)
		{
      		Android.OneSignal.SetInFocusDisplaying((int)display);
   	}
      public OneSignalAndroid(string appid, string googleProjectNumber, OneSignal.OSInFocusDisplayOption displayOption, OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
      {  
			SetLogLevel (logLevel, visualLevel);

         //Convert OneSignal.OSInFocusDisplayOptions to Android.OneSignal.OSInFocusDisplayOption
         Android.OneSignal.OSInFocusDisplayOption option = Android.OneSignal.OSInFocusDisplayOption.InAppAlert;
         switch (displayOption)
         {
            case OneSignal.OSInFocusDisplayOption.None: option = Android.OneSignal.OSInFocusDisplayOption.None; break;
            case OneSignal.OSInFocusDisplayOption.Notification: option = Android.OneSignal.OSInFocusDisplayOption.Notification; break;
            case OneSignal.OSInFocusDisplayOption.InAppAlert: option = Android.OneSignal.OSInFocusDisplayOption.InAppAlert; break;
         }

         Android.OneSignal.Init(Application.Context, googleProjectNumber, appid, new NotificationOpenedHandler(), new NotificationReceivedHandler());
         Android.OneSignal.SetInFocusDisplaying(option);
		}
Example #13
0
    public void RegisterForPushNotifications() { } // Doesn't apply to Windows Phone: The Native SDK always registers.

    public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel) {} // The Native SDK does not implement this.