I create a new XF project using 4.0.4.4 XF. Nowhere can I find App.AppName. I'm trying to follow the tutorial at https://developer.xamarin.com/guides/xamarin-forms/web-services/authentication/oauth/ where it is definitely referenced in docs.
If I create a public property in PCL / App.cs with AppName it appears to work fine. Is this the right way?
Usage in the tutorial The following code example shows how an Account object is securely saved on the iOS platform:
AccountStore.Create ().Save (e.Account, App.AppName);
The following code example shows how an Account object is securely saved on the Android platform:
AccountStore.Create (Context).Save (e.Account, App.AppName);
Deep linking allows applications to respond to a search result that contains application data, typically by navigating to a page referenced from a deep link. This sample demonstrates how to use application indexing and deep linking to make Xamarin. Forms application content searchable on iOS and Android devices.
Application delegate The AppDelegate class manages the application Window. The Window is a single instance of the UIWindow class that serves as a container for the user interface.
"App" in those examples is the subclass of Application
:
public class App : Application
So whatever you named your solution/project the you created it will be the name of the Application
subclass:
public class YourAppNameHere : Application
Then AppName
that they are referring to is is a class-level variable defined in that class:
public static string AppName { get { return "TodoListApp"; } }
Checkout out the sample source @ https://github.com/xamarin/xamarin-forms-samples/blob/master/WebServices/TodoAWSAuth/TodoAWS/TodoAWS-SimpleDB.cs
AppName is just a string that AccountStore uses to identity your app. It may be that at one time the default Forms template included an AppName property and doesn't anymore, and the documentation is outdated. In any case, simply using a hardcoded value, or creating your own AppName property, should be fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With