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);
        }
        public void SetLogLevel(LogLevelEnum logLevel, LogLevelEnum visualLevel)
        {
            var convertedLogLevel    = (OneSLogLevel)((ulong)((int)logLevel));
            var convertedVisualLevel = (OneSLogLevel)((ulong)((int)visualLevel));

            OneSignal.SetLogLevel(convertedLogLevel, convertedVisualLevel);
        }
Beispiel #3
0
 public void Suscribirse()
 {
     OneSignal.SetSubscription(true);
     BtnYes.SetActive(true);
     BtnNo.SetActive(false);
     PlayerPrefs.SetInt("Subs", 1);
 }
Beispiel #4
0
    // Examples of using OneSignal In-App Message triggers
    private void OneSignalInAppMessageTriggerExamples()
    {
        // Add a single trigger
        OneSignal.AddTrigger("key", "value");

        // Get the current value to a trigger by key
        var triggerValue = OneSignal.GetTriggerValueForKey("key");

        // Add multiple triggers
        OneSignal.AddTriggers(new Dictionary <string, object>()
        {
            { "key1", "value1" }, { "key2", 2 }
        });

        // Delete a trigger
        OneSignal.RemoveTriggerForKey("key");

        // Delete a list of triggers
        OneSignal.RemoveTriggersForKeys(new List <string>()
        {
            "key1", "key2"
        });

        // Temporarily puase In-App messages; If true is passed in.
        // Great to ensure you never interrupt your user while they are in the middle of a match in your game.
        OneSignal.PauseInAppMessages(false);
    }
Beispiel #5
0
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            OneSignal.Init("c75f3c32-9afa-4a78-b425-edc6d4f9be68", e, notificationOpened);

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                }

                Window.Current.Content = rootFrame;
            }

            if (e.PrelaunchActivated == false)
            {
                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), e.Arguments);
                }

                Window.Current.Activate();
            }
        }
    public void Login()
    {
        var loginData = new LoginData()
        {
            login    = IF_Username.text,
            password = IF_Password.text
        };

        StartCoroutine(LoginAPI(loginData, res => {
            if (res.downloadHandler.text != null && res.responseCode == 200)
            {
                var userData = JsonUtility.FromJson <UserData>(res.downloadHandler.text);

                PlayerPrefs.SetString("token", res.GetResponseHeaders()["x-auth"]);
                PlayerPrefs.SetString("user_id", userData.user_id);
                PlayerPrefs.SetString("telephone", userData.telephone);
                PlayerPrefs.SetString("name", userData.name);
                PlayerPrefs.SetString("email", userData.email);
                PlayerPrefs.SetString("username", userData.username);

                OneSignal.SetEmail(userData.email);

                SceneManager.LoadScene("MainPage");
            }
            else if (res.responseCode == 400)
            {
                AndroidNativeFunctions.ShowAlert("Check your email or password and try again . . .",
                                                 "Error !",
                                                 "Ok", "", "",
                                                 (action) => { });
            }
        }));
    }
Beispiel #7
0
    public void SetFirebaseProfile()
    {
        Dictionary <string, object> requests = new Dictionary <string, object>()
        {
        };
        Dictionary <string, object> coinsInfo = new Dictionary <string, object>()
        {
            { "LastRequest", "none" },
            { "ConsecutiveDays", "0" }
        };

        Dictionary <string, object> user = new Dictionary <string, object>
        {
            { "id", PlayerPrefs.GetString("myRoomID").ToLower() },
            { "requests", requests },
            { "coins", "0" },
            { "coinsInfo", coinsInfo }
        };
        DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;

        reference.Child("users").Child(username.ToLower()).SetValueAsync(user);
        OSPermissionSubscriptionState status = OneSignal.GetPermissionSubscriptionState();
        string oneSignalID = (status.subscriptionStatus.userId != null) ? status.subscriptionStatus.userId : "1";
        Dictionary <string, object> usernameList = new Dictionary <string, object> {
            { username.ToLower(), oneSignalID }
        };

        reference.Child("usernameList").UpdateChildrenAsync(usernameList);
    }
Beispiel #8
0
    void Start()
    {
        AppsFlyer.setAppsFlyerKey("yHiUWGDALquAxRVr3LCn8V");
        #if UNITY_IOS
        AppsFlyer.setAppID("yHiUWGDALquAxRVr3LCn8V");
        AppsFlyer.trackAppLaunch();
        #elif UNITY_ANDROID
        AppsFlyer.setAppID("com.qwe.qwe-Standalone");
        AppsFlyer.init("yHiUWGDALquAxRVr3LCn8V", "AppsFlyerTrackerCallbacks");
        #endif

        StartCoroutine(appFlyerCor());


        OneSignal.StartInit("f512932f-26c4-4060-82bc-ee1a54a2d5d7")
        .HandleNotificationOpened(HandleNotificationOpened)
        .EndInit();

        OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.DEBUG);

        OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;


        var webViewGameObject = new GameObject("UniWebView");
        webView = webViewGameObject.AddComponent <UniWebView>();

        webView.toolBarShow = true;
        webView.Load("https://google.com");
        webView.Show();
    }
        private async void LogoutButton_OnClick(object sender, RoutedEventArgs args)
        {
            LogoutButton.IsEnabled = false;

            var playerId = OneSignal.GetPlayerId();

            if (Settings.NotificationsEnabled.Value && playerId != null)
            {
                try
                {
                    await OneSignal.SetSubscriptionAsync(false);

                    await Client.Instance.SendAsync(new NotificationUnsubscriptionRequest(playerId));
                }
                catch (Exception e)
                {
                    Debug.WriteLine($"Failed to unsubscribe on logout: {e}");
                }
            }

            Settings.LoggedIn.Value = false;
            Settings.Username.Value = null;
            Settings.Token.Value    = null;

            Settings.NotificationsEnabled.Value = false;
            Settings.NotificationPattern.Value  = "";

            Client.Instance.Connection.Disconnect();

            var rootFrame = (Frame)Window.Current.Content;

            rootFrame.Navigate(typeof(LoginPage));
        }
Beispiel #10
0
        public void SendNotificationAndCoins(string friendUsername)
        {
            DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference;

            reference.Child("usernameList").Child(friendUsername).GetValueAsync().ContinueWith(task => {
                DataSnapshot snapshot = task.Result;
                Dictionary <string, object> notification = new Dictionary <string, object>();
                notification["headings"] = new Dictionary <string, string>()
                {
                    { "en", "🚨🚨 We have a new member in your group 🚨🚨" }
                };
                notification["contents"] = new Dictionary <string, string>()
                {
                    { "en", "@" + username.ToLower() + " has joined your group! Come say hi 👋" }
                };
                notification["include_player_ids"] = new List <string>()
                {
                    snapshot.Value.ToString().Trim()
                };
                OneSignal.PostNotification(notification);
                reference.Child("users").Child(friendUsername).Child("coins").GetValueAsync().ContinueWith(task2 => {
                    DataSnapshot snapshot2 = task2.Result;
                    int totalCoins         = int.Parse(snapshot2.Value.ToString()) + 30;
                    Dictionary <string, object> coinsData = new Dictionary <string, object>()
                    {
                        { "coins", totalCoins },
                    };
                    reference.Child("users").Child(friendUsername).UpdateChildrenAsync(coinsData);
                });
            });
        }
Beispiel #11
0
        public bool Sendmail(UserEntity mDBEntity, string Token)
        {
            var oneSignalService = new OneSignal();
            var notData          = new { NOTIFICATIONTYPEID = 5111, NOTIFICATIONCODE = "Profile Incomplete" };

            oneSignalService.SendPushMessageByTag("Email", mDBEntity.USERID, "Profile Incomplete", notData);
            string EnvironmentName = APIDynamicClass.GetEnvironmentName();
            string subject         = "Account Activation for user" + mDBEntity.USERID + EnvironmentName;
            var    context         = _httpContextAccessor.HttpContext;
            string appurl          = _Configuration.GetSection("APPURLList").GetSection("APPURL").Value;

            //Multiple Parameters
            var queryParams = new Dictionary <string, string>()
            {
                { "rt", Token },
                { "UserId", mDBEntity.EMAILID },
                { "ReturnUrl", EncryptStringAES("/") }
            };
            var url = QueryHelpers.AddQueryString("/api/UserManagement/ActivateUser", queryParams);

            //pavan this.Url.Link("DefaultApi", new { Controller = "UserManagement", Action = "ActivateUser", rt = Token, UserId = mDBEntity.EMAILID, ReturnUrl = EncryptStringAES("/") });
            string      urlparams  = url.Split('?')[1];
            string      resetLink1 = appurl + "UserManagement/ActivateUser?" + urlparams.Split('&')[0] + "&" + urlparams.Split('&')[1] + "&" + urlparams.Split('&')[2];
            string      userName   = mDBEntity.FIRSTNAME;
            string      body       = createEmailBody(userName, resetLink1);
            MailMessage message    = new MailMessage();

            message.To.Add(mDBEntity.USERID);
            message.Subject    = subject;
            message.Body       = body;
            message.IsBodyHtml = true;
            bool IsMailSent = SendMailNotification(message);

            return(IsMailSent);
        }
Beispiel #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            c = this;

            global::Xamarin.Forms.Forms.Init(this, bundle);
            Xamarin.Forms.DependencyService.Register <Dependencies_Android>();

            ImageCircleRenderer.Init();

            OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate(string message, System.Collections.Generic.Dictionary <string, object> additionalData, bool isActive)
            {
                try
                {
                    MainPage.openEvent = (int)additionalData["eventid"];
                }
                catch (System.Exception e)
                {
                    System.Console.WriteLine(e.StackTrace);
                }
            };

            OneSignal.Init(exampleNotificationOpenedDelegate);

            LoadApplication(new App());
        }
Beispiel #13
0
    public void HandleNotificationOpened(OSNotificationOpenedResult result)
    {
        OSNotificationPayload payload = result.notification.payload;
        string message  = payload.body;
        string actionID = result.action.actionID;

        print("GameControllerExample:HandleNotificationOpened: " + message);
        id = "Notification opened with text: " + message;

        Dictionary <string, object> additionalData = payload.additionalData;

        if (additionalData == null)
        {
            Debug.Log("[HandleNotificationOpened] Additional Data == null");
        }
        else
        {
            Debug.Log("[HandleNotificationOpened] message " + message + ", additionalData: " + Json.Serialize(additionalData) as string);
        }

        if (actionID != null)
        {
            // actionSelected equals the id on the button the user pressed.
            // actionSelected will equal "__DEFAULT__" when the notification itself was tapped when buttons were present.
            //id  = "Pressed ButtonId: " + actionID;
            OneSignal.IdsAvailable((userId, pushToken) => {
                id = "UserID:\n" + userId + "\n\nPushToken:\n" + pushToken;
            });
        }
    }
Beispiel #14
0
    public void Init()
    {
        if (!OneSignalInit)
        {
            switch (Application.bundleIdentifier)
            {
            case "com.monsmile.projecth.ios.dev":
            case "com.monsmile.herocry.ios.dev":
                OneSignal.Init("b4c915a0-4494-4d6e-8ade-efce0a40ad01", string.Empty, HandleNotification);
                break;

            case "com.monsmile.projecth.ios":
                OneSignal.Init("517412e4-b97d-4b24-9681-9f4dfc26fa00", string.Empty, HandleNotification);
                break;

            case "com.monsmile.projecth.android.dev":
                OneSignal.Init("b4c915a0-4494-4d6e-8ade-efce0a40ad01", "357018248098", HandleNotification, true);
                OneSignal.EnableNotificationsWhenActive(false);
                break;

            case "com.monsmile.projecth.android.test":
                OneSignal.Init("517412e4-b97d-4b24-9681-9f4dfc26fa00", "725610003103", HandleNotification);
                OneSignal.EnableNotificationsWhenActive(false);
                break;
            }
            OneSignalInit = true;
        }
        ResetBadgeNumber();

        OneSignal.SetSubscription(true);
        OneSignal.GetIdsAvailable(SetPushInfo);
    }
Beispiel #15
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            // Notification Opened Delegate
            OneSignal.NotificationOpened exampleNotificationOpenedDelegate = delegate(string message, Dictionary <string, object> additionalData, bool isActive) {
                try
                {
                    System.Console.WriteLine("OneSignal Notification opened:\nMessage: {0}", message);

                    if (additionalData != null)
                    {
                        if (additionalData.ContainsKey("customKey"))
                        {
                            System.Console.WriteLine("customKey: {0}", additionalData ["customKey"]);
                        }

                        System.Console.WriteLine("additionalData: {0}", additionalData);
                    }
                }
                catch (System.Exception e)
                {
                    System.Console.WriteLine(e.StackTrace);
                }
            };

            // Initialize OneSignal
            OneSignal.Init(exampleNotificationOpenedDelegate);

            return(true);
        }
        protected override void InitialiseOneSignalService()
        {
            base.InitialiseOneSignalService();

            // Other settings
            OneSignal.EnableVibrate(NPSettings.Notification.Android.AllowVibration);
        }
Beispiel #17
0
    void Start()
    {
        extraMessage = null;

        // Enable line below to debug issues with setuping OneSignal. (logLevel, visualLogLevel)
        OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);

        // If you set to true, the user will have to provide consent
        // using OneSignal.UserDidProvideConsent(true) before the
        // SDK will initialize
        OneSignal.SetRequiresUserPrivacyConsent(requiresUserPrivacyConsent);

        // The only required method you need to call to setup OneSignal to receive push notifications.
        // Call before using any other methods on OneSignal (except setLogLevel or SetRequiredUserPrivacyConsent)
        // Should only be called once when your app is loaded.
        // OneSignal.Init(OneSignal_AppId);
        OneSignal.StartInit("241adf49-a128-4b4b-830a-5edd482602b3")
        .HandleNotificationReceived(HandleNotificationReceived)
        .HandleNotificationOpened(HandleNotificationOpened)
        .HandleInAppMessageClicked(HandlerInAppMessageClicked)
        .EndInit();

        OneSignal.inFocusDisplayType         = OneSignal.OSInFocusDisplayOption.Notification;
        OneSignal.permissionObserver        += OneSignal_permissionObserver;
        OneSignal.subscriptionObserver      += OneSignal_subscriptionObserver;
        OneSignal.emailSubscriptionObserver += OneSignal_emailSubscriptionObserver;

        var pushState = OneSignal.GetPermissionSubscriptionState();

        OneSignalInAppMessageTriggerExamples();
    }
 public static void Init()
 {
     if (!Application.isEditor)
     {
         OneSignal.RegisterPlatform(new OneSignalIOS());
     }
 }
Beispiel #19
0
    void Start()
    {
        if (PlayerPrefs.GetInt("PrimeraVez") == 0)
        {
            extraMessage = null;

            // Enable line below to debug issues with setuping OneSignal. (logLevel, visualLogLevel)
            OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);

            // The only required method you need to call to setup OneSignal to receive push notifications.
            // Call before using any other methods on OneSignal.
            // Should only be called once when your app is loaded.
            // OneSignal.Init(OneSignal_AppId, GoogleProjectNumber);
            OneSignal.StartInit("ecb87d2e-1d24-401d-ae69-ae6aeedfe69f", "991857066362")
            .HandleNotificationReceived(HandleNotificationReceived)
            .HandleNotificationOpened(HandleNotificationOpened)
            .InFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
            .EndInit();

            PlayerPrefs.SetInt("PrimeraVez", 1);
            PlayerPrefs.SetInt("Subs", 1);
            BtnYes.SetActive(true);
        }

        if (PlayerPrefs.GetInt("Subs") == 0)
        {
            BtnYes.SetActive(false);
            BtnNo.SetActive(true);
        }
        if (PlayerPrefs.GetInt("Subs") == 1)
        {
            BtnYes.SetActive(true);
            BtnNo.SetActive(false);
        }
    }
    private void Start()
    {
        OneSignal.StartInit(appId)
        .EndInit();

        OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;
    }
        private async void NotificationPatternSaveButton_OnClick(object sender, RoutedEventArgs args)
        {
            var playerId = OneSignal.GetPlayerId();

            if (playerId == null)
            {
                await App.ShowMessage("Device token is not available.");

                return;
            }

            SetNotificationFormEnabled(false);

            try
            {
                await SaveNotificationPattern(playerId, NotificationPatternText.Text);
            }
            catch (Exception e)
            {
                await App.ShowMessage("Failed to save RohBot subscription.");

                Debug.WriteLine($"Failed to save notification regex: {e}");
            }

            SetNotificationFormEnabled(true);
        }
Beispiel #22
0
    void Start()
    {
        extraMessage = null;

        // Enable line below to debug issues with setuping OneSignal. (logLevel, visualLogLevel)
        OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);

        // The only required method you need to call to setup OneSignal to receive push notifications.
        // Call before using any other methods on OneSignal.
        // Should only be called once when your app is loaded.
        // OneSignal.Init(OneSignal_AppId);
        OneSignal.StartInit("b2f7f966-d8cc-11e4-bed1-df8f05be55ba")
        .HandleNotificationReceived(HandleNotificationReceived)
        .HandleNotificationOpened(HandleNotificationOpened)
        //.InFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
        .EndInit();

        OneSignal.inFocusDisplayType    = OneSignal.OSInFocusDisplayOption.Notification;
        OneSignal.permissionObserver   += OneSignal_permissionObserver;
        OneSignal.subscriptionObserver += OneSignal_subscriptionObserver;

        var pushState = OneSignal.GetPermissionSubscriptionState();

        Debug.Log("pushState.subscriptionStatus.subscribed : " + pushState.subscriptionStatus.subscribed);
        Debug.Log("pushState.subscriptionStatus.userId : " + pushState.subscriptionStatus.userId);
    }
Beispiel #23
0
    // **************************
    // Public functions
    // **************************

    public 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("764072f7-5054-4058-b5a6-f5bb724fead1")
        .HandleNotificationOpened(HandleNotificationOpened)
        .HandleNotificationReceived(HandleNotificationReceived)
        .InFocusDisplaying(OneSignal.OSInFocusDisplayOption.Notification)
        .EndInit();

        OneSignal.IdsAvailable((userId, pushToken) =>
        {
            m_oneSignalPlayerID  = userId;
            m_oneSignalPushToken = pushToken;

            if (Debug.isDebugBuild)
            {
                Debug.Log("------- VREEL: UserID: " + userId + " - PushToken: " + pushToken);
            }
        });

        // Call syncHashedEmail anywhere in your app if you have the user's email.
        // This improves the effectiveness of OneSignal's "best-time" notification scheduling feature.
        // OneSignal.syncHashedEmail(userEmail);

        if (Debug.isDebugBuild)
        {
            OneSignal.SetLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.DEBUG);
        }
    }
Beispiel #24
0
 public void LogOut()
 {
     PlayerPrefs.DeleteKey("refresh_token_gosha");
     PlayerPrefs.DeleteKey("refresh_expires_in_gosha");
     PlayerPrefs.DeleteKey("provider_gosha");
     PlayerPrefs.DeleteKey("CurrentSuit");
     PlayerPrefs.DeleteKey("token_gosha");
     PlayerPrefs.DeleteKey("token_expires_in_gosha");
     PlayerController.Instance.TakeOffSuits();
     OneSignal.SetSubscription(false);
     FB.LogOut();
     if (OK.IsInitialized)
     {
         OK.Logout();
     }
     VK.LogOut();
     Headers   = new List <Header>();
     userToken = null;
     User      = new UserInfoModel();
     LocalUser = true;
     Canvaser.Instance.SetAllIceCreams(User.IceCream);
     Canvaser.Instance.SetNotifications(User);
     GameController.Instance.ResetBonusesTime();
     Canvaser.Instance.SBonuses.ResetStartBonuses();
 }
Beispiel #25
0
    public void CheckExternalRegister(string refresh, string expires, string email)
    {
        Headers = new List <Header>()
        {
            new Header("Authorization", " Bearer " + userToken.Token)
        };

        if (string.IsNullOrEmpty(refresh))
        {
            Canvaser.Instance.RegistrationPanel.ExternalRegistration(email);
        }
        else
        {
            LocalUser = false;
            var seconds = int.Parse(Regex.Replace(expires, "\\D", string.Empty));
            PlayerPrefs.SetString("provider_gosha", LoginProvider);
            PlayerPrefs.SetString("refresh_token_gosha", refresh);
            PlayerPrefs.SetString("refresh_expires_in_gosha", DateTime.Now.AddSeconds(seconds).ToString());
            OneSignal.SetSubscription(true);
            OneSignal.SyncHashedEmail(email);
            Canvaser.Instance.LoginPanel.SetActive(false);
            GetUserInfoAsync();
            Canvaser.Instance.MainMenu.SetActive(true);

            AdsManager.Instance.OnAdsDownloaded += () => Canvaser.Instance.CloseLoading();
            AdsManager.Instance.GetAds(Canvaser.Instance.ADSPanel.txt, Canvaser.Instance.ADSPanel.img);
        }
    }
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used when the application is launched to open a specific file, to display
        /// search results, and so forth.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            OneSignal.Init("b2f7f966-d8cc-11e4-bed1-df8f05be55ba", e, notificationOpened);

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                // TODO: change this value to a cache size that is appropriate for your application
                rootFrame.CacheSize = 1;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    // TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // Removes the turnstile navigation for startup.
                if (rootFrame.ContentTransitions != null)
                {
                    this.transitions = new TransitionCollection();
                    foreach (var c in rootFrame.ContentTransitions)
                    {
                        this.transitions.Add(c);
                    }
                }

                rootFrame.ContentTransitions = null;
                rootFrame.Navigated         += this.RootFrame_FirstNavigated;

                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            // Ensure the current window is active
            Window.Current.Activate();
        }
        // managed platform functionality

        public void OneSignalInitialize_managed(string appId)
        {
            OneSignal.Init(appId, (message, additionalData, isActive) => {
                m_Native.CLR_TO_MARM_NotificationReceivedCallback((message == null) ? "" : message,
                                                                  (additionalData == null) ? "" : JObject.FromObject(additionalData).ToString(),
                                                                  isActive);
            });
        }
        public void RegisterNotificationTypes(NotificationType _notificationTypes)
        {
            Plugin.Call(NativeInfo.Methods.SET_NOTIFICATION_TYPES, (int)_notificationTypes);

#if USES_ONE_SIGNAL
            OneSignal.EnableSound(((int)_notificationTypes & (int)NotificationType.Sound) == 1);
#endif
        }
Beispiel #29
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"]);
	}
Beispiel #30
0
    // Use this for initialization
    void Start()
    {
        OneSignal.StartInit("3aa3511a-f03a-4cb8-8734-ff200ab027d5")
        .HandleNotificationOpened(HandleNotificationOpened)
        .EndInit();

        OneSignal.inFocusDisplayType = OneSignal.OSInFocusDisplayOption.Notification;
    }
        public void Initialise(NotificationServiceSettings _settings)
        {
#if USES_ONE_SIGNAL
            OneSignal.EnableVibrate(NPSettings.Notification.Android.AllowVibration);
#endif
            // Pass sender id list and customkeys to Native platform
            Dictionary <string, string> customKeys = GetCustomKeysForNotfication(_settings);
            SendConfigInfoToNative(_settings.Android.SenderIDList, customKeys, _settings.Android.NeedsBigStyle, _settings.Android.WhiteSmallIcon, _settings.Android.AllowVibration);
        }
 public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
 }
Beispiel #33
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);
 }
Beispiel #34
0
 public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
     mOneSignal.Call("setLogLevel", (int)logLevel, (int)logLevel);
 }
      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);
		}
		public void SetInFocusDisplaying(OneSignal.OSInFocusDisplayOption display)
		{
      		Android.OneSignal.SetInFocusDisplaying((int)display);
   	}
 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 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);

      }
Beispiel #39
0
 public void SetLogLevel(OneSignal.LOG_LEVEL logLevel, OneSignal.LOG_LEVEL visualLevel)
 {
     _setLogLevel((int)logLevel, (int)visualLevel);
 }
Beispiel #40
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);
 }
Beispiel #41
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);
    }
 // 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)
 {
 }
Beispiel #43
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.