Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App.AppName in xamarin forms

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);
like image 674
Joe Healy Avatar asked Jun 02 '16 19:06

Joe Healy


People also ask

What is deep linking in Xamarin?

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.

What is AppDelegate in Xamarin forms?

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.


2 Answers

"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

like image 111
SushiHangover Avatar answered Oct 18 '22 18:10

SushiHangover


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.

like image 28
Jason Avatar answered Oct 18 '22 17:10

Jason