コード例 #1
0
        public void Init()
        {
            bool autoPrompt = false, inAppLaunchURL = false;

            if (_builder.IOSSettings != null)
            {
                if (_builder.IOSSettings.ContainsKey(kOSSettingsKeyAutoPrompt))
                {
                    autoPrompt = _builder.IOSSettings[kOSSettingsKeyAutoPrompt];
                }
                if (_builder.IOSSettings.ContainsKey(kOSSettingsKeyInAppLaunchURL))
                {
                    inAppLaunchURL = _builder.IOSSettings[kOSSettingsKeyInAppLaunchURL];
                }
            }

            var convertedLogLevel    = (OneSLogLevel)((ulong)((int)_logLevel));
            var convertedVisualLevel = (OneSLogLevel)((ulong)((int)_visualLogLevel));

            OneSignal.SetLogLevel(convertedLogLevel, convertedVisualLevel);

            var dict = new Foundation.NSDictionary("kOSSettingsKeyInAppLaunchURL"
                                                   , new Foundation.NSNumber(inAppLaunchURL)
                                                   , "kOSSettingsKeyAutoPrompt"
                                                   , new Foundation.NSNumber(autoPrompt)
                                                   , "kOSSettingsKeyInFocusDisplayOption"
                                                   , new Foundation.NSNumber((int)_builder.DisplayOption));

            OneSignal.InitWithLaunchOptions(new Foundation.NSDictionary()
                                            , _builder.AppID
                                            , NotificationReceivedHandler
                                            , NotificationOpenedHandler
                                            , dict);
        }