I'm working on Xamarin Android and I need to show a images carousel when application start.
I have seen some implementations with Java Shared Preferences, but I don't know how to do this with Xamarin. Could you help me?
Thanks a lot!
I'm working on Xamarin Android and I need to show a images carousel when application start.
I have seen some implementations with Java Shared Preferences, but I don't know how to do this with Xamarin. Could you help me?
Thanks a lot!
To access shared prefs on Xamarin:
ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences (this);
Then to check for a "firstRun" using shared preferences:
if (prefs.GetBoolean ("firstRun", true)) {
LaunchImagesCarousel ();
prefs.Edit ().PutBoolean ("firstRun", false).Commit ();
} else {
// something else
}
I use the same approach to display a tutorial of carousel images if its user's first time opening the app.
If this is deemed redundant, unnecessary and/or likely answered elsewhere, please do remove it.
With Xamarin Forms you can do VersionTracking.IsFirstLaunchEver
https://learn.microsoft.com/en-us/xamarin/essentials/version-tracking