user3905621
user3905621

Reputation: 51

Windows Phone 8 ApplicationSettings - Get settings in Universal app

I'm upgrading windows phone 8 application. I created Universal app (Windows.Phone 8.1).

The settings in old WP8.0 application are saved in following way:

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

Question: How can i get this settings when app is upgraded to WP8.1 (Universal app).

I try 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" are found. (isContains1, isContains2 == false):\

Many Thanks for help

Upvotes: 3

Views: 1905

Answers (3)

Andrew Leader
Andrew Leader

Reputation: 985

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

Upvotes: 1

Romasz
Romasz

Reputation: 29792

LocalSettings in WP8.1 works differently than those in WP8.0 - where settings were saved in a file (after serialization). The file is __ApplicationSettings - take a look at it (via IS explorer tool) and you will see its structure - part of it is a serialized dictionary. I've made some research once, which showed that all the old files are preserved during the update - which means that the settings are still there.

Once you update your WP8.0 app to WP8.1 and you want to read your old settings, you can retrive the values from the file.

Upvotes: 1

Amit Bhatiya
Amit Bhatiya

Reputation: 2621

You can use ApplicationData.LocalSettings It would Get you the application settings container in the local app data store. here is a Dev center link in which its Described how to use it.

Upvotes: 0

Related Questions