Something like Android-SharedPreferences on Windows Store Apps?

android, c#, windows-8.1, windows-store-apps, xaml

Solution

http://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.storage.applicationdata.localsettings?cs-save-lang=1&cs-lang=csharp#code-snippet-2

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;

// Create a simple setting

localSettings.Values["exampleSetting"] = "Hello Windows";

// Read data from a simple setting

Object value = localSettings.Values["exampleSetting"];

if (value == null)
{
    // No data
}
else
{
    // Access data in value
}

// Delete a simple setting

localSettings.Values.Remove("exampleSetting");

Problem

I'm developing an App where the users must login to use it. I want the user login just the first time and session keeps active the next time the user open the app. The session must be closed explicitly by the user. I have this on Android using Shared Preferences, I have a isLoggedIn boolean value that changes to true when the user login the app, and a validation in all screens. I also save the Username and the userId (to use it on the querys). When the user logsout, all data is cleaned. I need something like this on Windows Store, I need to keep sesion active even when the user closes the app. Could any give me an idea? Thanks in advance.

Original source