locked
App with activation interface

    Question

  • Good day

    I developed a WP8 app that requires the user to use an activation PIN before accessing the app authenticating the PIN through http request. whenever the user input the right PIN they will have access to the app and it works fine

    But the issue am facing is whenever the user closes the app and wants to reuse the app it asks for the PIN, i want the user to activate the app once with a correct PIN. The app not having to asks for the PIN when next they want to use the app unless they uninstall the app

    Regards and reply soon

    Jayjay john

    Wednesday, October 08, 2014 5:32 PM

Answers

  • If you require the PIN for authentication against the Web Service you're using you will have to store it in the App's IsolatedStorage. If it's just for a one time authenticity check you could simply store that information (IsAuthorized) in IsolatedStorage, check that and automatically navigate to the main page of your App.

    What exactlly are you struggling with?

    Wednesday, October 08, 2014 6:04 PM
  • Hi John,

    I agree with what Oliver has said. Use local settings to save the status when success in logging into your app. When system navigate your app to MainPage, add override NavigateTo method, check if local settings has the IsAuthorized value. If has, it mean the user has authorized. If not, app need to navigate the user to LoginPage. See sample code below.

    In MainPage.cs

    protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                var appsettings = IsolatedStorageSettings.ApplicationSettings;
                if (!appsettings.Contains("IsAuthorized"))
                {
                    Uri uri = new Uri("/LoginPage.xaml", UriKind.RelativeOrAbsolute);
                    NavigationService.Navigate(uri);
                }
                base.OnNavigatedTo(e);
            }
    

    In LoginPage.cs

      private void Button_Click(object sender, RoutedEventArgs e)
            {
                //login code here
    
                //write to local steeing
                var appsettings = IsolatedStorageSettings.ApplicationSettings;
                if (!appsettings.Contains("IsAuthorized"))
                {
                    appsettings.Remove("IsAuthorized");
                }
                else {
                    appsettings.Add("IsAuthorized", "");
                }
            }
    

    Note that it’s no need to save the pin code into local settings.

    If I misunderstand you, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 16, 2014 5:48 AM
    Moderator

All replies

  • If you require the PIN for authentication against the Web Service you're using you will have to store it in the App's IsolatedStorage. If it's just for a one time authenticity check you could simply store that information (IsAuthorized) in IsolatedStorage, check that and automatically navigate to the main page of your App.

    What exactlly are you struggling with?

    Wednesday, October 08, 2014 6:04 PM
  • Hi

    What i want is for the app to ask (authenticate) the PIN once, after that the user can access the app without asking for PIN.

    Unless the user uninstall and re-install the app before it can ask for the PIN again

    Regards


    Jayjay john

    Wednesday, October 08, 2014 10:34 PM
  • Hi John,

    I agree with what Oliver has said. Use local settings to save the status when success in logging into your app. When system navigate your app to MainPage, add override NavigateTo method, check if local settings has the IsAuthorized value. If has, it mean the user has authorized. If not, app need to navigate the user to LoginPage. See sample code below.

    In MainPage.cs

    protected override void OnNavigatedTo(NavigationEventArgs e)
            {
                var appsettings = IsolatedStorageSettings.ApplicationSettings;
                if (!appsettings.Contains("IsAuthorized"))
                {
                    Uri uri = new Uri("/LoginPage.xaml", UriKind.RelativeOrAbsolute);
                    NavigationService.Navigate(uri);
                }
                base.OnNavigatedTo(e);
            }
    

    In LoginPage.cs

      private void Button_Click(object sender, RoutedEventArgs e)
            {
                //login code here
    
                //write to local steeing
                var appsettings = IsolatedStorageSettings.ApplicationSettings;
                if (!appsettings.Contains("IsAuthorized"))
                {
                    appsettings.Remove("IsAuthorized");
                }
                else {
                    appsettings.Add("IsAuthorized", "");
                }
            }
    

    Note that it’s no need to save the pin code into local settings.

    If I misunderstand you, please feel free to let me know.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, October 16, 2014 5:48 AM
    Moderator