Reputation:
How save session in xamarin ios, i must use Xamarin.Auth?
I also need to be able to check if a session already exists when the app starts that way I skip the login page if they are already signed in
public class SettingsManager : ISettingsManager
{
public string PersonalFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
// Write Information to a Local File
public void WriteLocalFile(string FileName, string Data)
{
string filePath = Path.Combine(PersonalFolderPath, FileName);
File.WriteAllText(filePath, Data);
}
}
i found this thread https://forums.xamarin.com/discussion/117141/save-and-grab-session-id-and-other-data
Upvotes: 0
Views: 55
Reputation: 5768
To save session data, you can use Xamarin.Essentials
To save a value for a given key in preferences:
Preferences.Set("my_key", "my_value");
To retrieve a value from preferences or a default if not set:
var myValue = Preferences.Get("my_key", "default_value");
Upvotes: 1