Introduction
The State Persistence between app restarts and when suspending/resuming: The values in the properties dictionary are only stored when the app goes to Start(OnStart), sleep(OnSleep), resume(OnResume) method. I have tried; when the application crashes out with exception properties it’s not saved.
Xamarin.Forms plugin uses the native settings management. Refer to the below image for different platform state persistences.
This can be accessed from anywhere in your Xamarin.Forms code using Application.Current.Properties .The syntax looks like below.
- Application.Current.Properties [ <StringKey> ] = <Assign Object Type Value >;
Refer to the below code for different Xamarin Form application property actions like assign, read, delete, Clear value.
Set value
Key value always should be string and Value should be object (any type)
Application.Current.Properties["Email"] = "[email protected]";
Get Value
While getting the value, check if it's available or not and always convert object type into your specific variable type.
- if (Application.Current.Properties.ContainsKey("Email"))
- {
- var emailId = Convert.ToString(Application.Current.Properties["Email"]);
- }
- Application.Current.Properties["Email"] = "[email protected]";
List<int> can fail silently
Remove Value
If you want to remove application key and value, try the below code.
- if (Application.Current.Properties.ContainsKey("Email"))
- {
- Application.Current.Properties.Remove("Email");
- }
You can clear all the application property value s:
- Application.Current.Properties.Clear();

Rajesh KumarPosted Mar 15, 2022, 5:33 AM
Very helpful video sir
Gurjit SinghPosted Feb 2, 2021, 2:01 PM
Better to use SQlite db to persist values
Sandeep GuduriPosted Jun 7, 2018, 3:41 AM
If I kill the application and start again, Whether this key will exist or not.