Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent Storage using Application.Current.Properties not working

I'm trying to achieve a persistent storage in Xamarin.Forms. After researching in Xamarin.Forms, I decided to use Application.Current.Properties property.

It looks like it is working just only if the app still remains alive. If I close the app and start it again the Application.Current.Properties is empty.

Does anyone know if I'm doing something wrong? Can I achieve this feature in another way?

As usual, thanks guys.

like image 959
Elias MP Avatar asked Sep 13 '16 12:09

Elias MP


People also ask

What is the use of application properties property in xamarin forms?

Developers can use this property to store persistent application state across all application code. This values in the dictionary are preserved on the device when the application is paused or shut down.

What is xamarin essentials?

Xamarin. Essentials provides a single cross-platform API that works with any iOS, Android, or UWP application that can be accessed from shared code no matter how the user interface is created. See the platform & feature support guide for more information on supported operating systems.


1 Answers

you can use Xamarin essentials "Preferences" instead:

Preferences.Set("Key", "Value");
Preferences.Get("Key", "Default");
like image 186
امیررضا شمس ناتری Avatar answered Nov 26 '22 11:11

امیررضا شمس ناتری