Windows Phone 8 ApplicationSettings - Get Settings in a Universal App

I am updating a Windows Phone 8 app. I created a generic app (Windows.Phone 8.1).

The settings of the old WP8.0 app are saved as follows:

IsolatedStorageSettings.ApplicationSettings.Add("MY_SETTINGS", value);

      

Question: How can I get these settings when the app is updated to WP8.1 (universal app).

I am trying the following:

var localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
var isContains1 = localSettings.Values.ContainsKey("MY_SETTINGS");
var roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
var isContains2 = roamingSettings.Values.ContainsKey("MY_SETTINGS");

      

But no "MY_SETTINGS" were found. (isContains1, isContains2 == false): \

Many thanks for the help

+3


source to share


3 answers


LocalSettings in WP8.1 works differently than WP8.0 - where the parameters are saved in a file (after serialization), file __ ApplicationSettings - take a look at it (through IS Explorer tool), and you will see its structure - part of them is serialized vocabulary. I did some research on one occasion, which showed that all old files are retained during the upgrade, which means the settings are still there.



After upgrading your WP8.0 app to WP8.1 and you want to read the old settings, you can extract the values ​​from the file.

+1


source


This blog post contains your exact answer, including the code required to deserialize the migrated settings file!



+1


source


You can use ApplicationData.LocalSettings

It will provide you with an application settings container in the local application data store. here is the Dev center link which describes how to use it.

0


source







All Articles