 Welcome back everyone to .NET Conf 2018. I'm James Montemagno, and today I'm bringing the energy because Tim Hewer told me to, and I'm talking about complete mobile.NET awesomeness. Everything in the world of.NET for iOS, Android, Windows, Mac, anything that you can possibly imagine, because .NET is absolutely incredible, especially when you want to target platforms that everyone's using. So whether you want to develop for iOS, Android, we have something for you, and you're able to not only create beautiful native user interfaces, but share code between all of them as well. Now, before I get started, I want to tell you about what I do here at Microsoft, and the one thing that I'm focused on, I'm focused on many things, but it's to ensure that you have an amazing time building mobile applications with Xamarin and .NET. I love all of you. I love all of you that have been in the community for a long time contributing to open source, creating amazing NuGet library packages, and anyone that's new coming for the first time looking to build your very first mobile application. I'm here for you. My entire job is to ensure that you are productive of building awesome mobile applications. You have my direct email line, mods.microsoft.com. I am here for you for anything that you possibly need. You're running into a getting started issue, you have a question about best practices, you just want to chat. Email me, it's directly here for you at any time, and I want to chat with you. I want to know what's going on, how I can help you and the team here. Make sure that we build the best tools possible so you're super productive building mobile applications. So I'm here for you, just want to let you know, and no matter anything that you need, Twitter, email, or just hit me up on my website. So today what I'm going to focus on is the world of .NET. What I love about .NET is truly a platform that you can build for anything. Whether you want to build desktop, web, mobile, gaming, IoT, AI, you're going to see it all here on .NET.com. Now I'm going to be focusing on that mobile part for iOS and Android development. It's what I've been doing now for over seven years. I moved to Seattle over seven years ago, become a mobile developer building applications with Xamarin. I fell in love with the technology that I joined the company, and then I came along to Microsoft to ensure that we have the best tools for all of our developers that look to build iOS and Android and Mac applications. So with Xamarin, Miguel talked about it this morning. We're all about ensuring that you have the tools to not only build beautiful native cross-platform applications, get access to 100 percent of the APIs on iOS and Android, and get beautiful native performance. We've said it since day one that anything that you can do in Objective-C Swift or Java, you can do it in C-Sharp with Visual Studio and share code across all of your platforms. So if you're a .NET developer coming in, you already know all that business logic, and I'm going to build an application and show you that what I'm building here, you can do it yourself at home. If you're coming from a XAML or even a native iOS or Android, you know all those APIs too, and coming in and building user interfaces is super simple. Now, the beautiful part about .NET for mobile is that it shares the entire logic of .NET itself, building a beautiful shared C-Sharp business logic layer, all your models, view models, restful service calls, Azure integrations, things are the same across each application. It doesn't matter that it's running on iOS or on Android, it's just .NET code, that we're going to be running. But the best part here is you get access to all those great iOS, Android, and Windows APIs or anything else that you're developing for. So if there's something that you want to do on iOS, you can. You have access to Core Location, Core Bluetooth, same thing with Android. Google Play Services, Android Support Libraries, we give you access to everything that's in there, and everything compiles on into native application. Do you deploy internally at your company, or out to Google Play or the Apple App Store or the Microsoft Store, wherever you want to take your application. Now what I love here about .NET is it's truly a platform that can go anywhere. Whether you want to deploy to that native device, or up into the Cloud, or running on your desktop or server, you have the ability to. Now the best part here is that we fall in line with the ability to share code across all of the platforms with .NET standard libraries. It's a single library that you create, that you can share all of your business logic, and if you're developing application with Xamarin, even some of your user interface, and get access to those native APIs too. I'm going to show you all of this today. So let's get into it. Let's talk about Android. It's my favorite platform because I love it. I've been a fan for a long, long time. Android P just came out, so Android Pi and we just shipped support for it with Xamarin. We had a long dev preview and the same thing for iOS long dev preview of the latest iOS and Android bits and pieces. Now, not only did we release the brand new Android SDK, but if you're coming in just want to build an Android application, we have some brand new tooling that's really, really awesome to help you be more productive. So I figured what I would do is actually take you on a little demo tour of going around our new production tooling for Android development inside of Visual Studio 2017 and Visual Studio for Mac. So let's head over to my desktop here, and I'm going to pull up my demo application. Now, when you come in and say File New Project, what this will do is load up all of the projects. So you have Android, there's Android or XAML based application, Apple TV, Apple Watch, iPad, iPhone applications, and even iOS extensions. You have everything here. So what I did is I created an Android application with the native Android XML user interface. So if I zoom in over to my right-hand side, I have all my references, so I have some Android support libraries, Mono Android, and some system libraries here. As an Android application, you can see here and I have an activity file and some resources. So Android resources or where any of your icons or string translations live. Inside of here, I have some colors, I have background color string translations, and then I have my main layout. So these are a representation of my user interface. So the first thing that we'll see here is that I have my main UI. I have a text view that says awesome login, an edit text, and a button. What we're leveraging here is a brand new designer split view. So I can come in and I can expand the pane right here, I can swap it over, I can go horizontal if I want to, or go back down. Use the same exact designer that you may interface in split view that you may be used to from WPF or UWP. What's great is that it's actually on by default, but you can always come into tools options, and under Xamarin, you have Android UI design. So you can ensure what view that you may want, you can turn off 100 percent if you want to, or you can say horizontal or default, and you can also ensure that you can enable accelerated rendering. Now we've also really sped up the UI here. When seeing your preview of your user interface. So if I come in and start typing inside of here, we should be able to see our user interface, ideally update over here. Let's go ahead and reopen that one. So what happens when you let it sit around for a while, there we go. So reload it, you see how fast it reloaded, which is great. Then I can start typing. So I can say login, I can add exclamation point, boom, good to go. Now, let me focus a little bit on some of the other things that we're doing over inside of our XAML or Android XML editor. So the first thing that we're going to see is that I have some colors here. Now if I hover over the color, I see all information. This is an Android attribute of color coming in. I can have my own colors or I can use Android system ones that are coming in here. Now what's also great here is that I can see Android text login, but I could also say string slash, and I could get all of the intelligence of all of the Android built-in strings or the ones that are in my resources. So if I say login, now notice that I even typoed it there, but it kept the intelligence there. I can see that I have login hint and login button, and I don't even need to go to the resource because it shows me the login there. So there we go. Now also point out here that we did this for all sorts of goodies. So if I just say background here, type that in and say color slash gray, it shows me the hex value here, and I can go and add it and automatically updates right over in the designer view, which is really nice. Again, then I can just come in, hover over, boom, good to go. Now notice that I'm using that system resource of login. So it actually shows login over on the left-hand side. Now once I click on the actual design surface, a few other things happen. I get a full document outline, I get my toolbox where I can drag and drop items, but most importantly is I can come over and get full properties coming in. So a brand new property grid giving you access to every single thing right here. So I want to come in and say background, I can filter it down, I can actually type on here, I can do a local resource, a custom expression. So I can come in and add a resource here and see everything built in. I can also just tap on the background color, and it'll show me my material palette that I can select from here and I can say, I want that color and then it updates right inside my property grid and on the design surface. We'll go a little bit further over here. So normally what happens here is I might have a login view but I might have a list of data. So I have a few more pages in here of Android XML and what we're going to see first is that my list view comes up, but it's actually a recycler view. So this is a optimized Android recycler view. Now I'll point out here that our IntelliSense also brings in all of the custom controls, Android support layout. So things that you may have a hard time finding before are built right in. So now if I come in, we have this special thing called tools. So I'm going to drop this down a little bit here. We see Android XML and tools. So these are special flags that are kind of design time attributes. So we're able to add our own or optimize our design review to show things that are built into this tools namespace. So the first thing we're going to see is item count. So I can actually come in and say, well show me like 10 items and the design view will show me zero through nine. It's not super pretty because it has no idea about the items inside of it. So I actually have an item template inside of here. If I open that up, I'll go ahead and minimize some of these down. The first thing that we're going to see is that I'm also using tools but there's some data here. The data is coming in via tools because we added sample data support. So normally you wouldn't have anything in your image view or texture, you'd have to hard code something or update it in the code behind. But see here I have tools, sample avatars for the source. Additionally, down here, I have full names in cities that are showing up. These are generated by us that can come in via the tools. We have a great blog post on our Xamarin blog about what's new in the designer. We show you we have cities, names, street names, surnames, full names, and avatars that the designer can pull in. Now what's great here is that I can now see my user interface without having to set background colors or do anything fancy-schmancy. But the best part here is that now I can see things, but I can leverage this now inside of my recycler view. So I'm going to type in tools, and I'm going to say item list item, and here I'm going to say layout slash sample. Now I'm actually going to select the sample item which is the layout that I just showed you. What this will do is now generate off that sample data, which is a whole bunch of different data coming in and show me everything inside my list view here. I only want to see one, I just set one. I want to say five, it updates and it'll show me five. They'll all be randomly generated that I can see inside of the Android designer. There's a bunch of other great things such as theming support, grid overlay support, material palettes and action bar menus and be able to rotate things left and right, device sizes, everything that you would expect here from the Android designer zooming in and zooming out or all at your disposal. Optionally available, of course, because if you just want to not have any of you, and you want to minimize that down and set that as your default, go to town. Because the best part is that we've optimized all of those great IntelliSense features inside of the Android XML surface. It's brand new that comes in Visual Studio 2017, 15.8. That's some of the new stuff coming in for Android development. Now, I also want to talk about pain points when it comes to mobile development. For me, there's a lot of things that I do over and over and over again. Miguel talked this morning about build times. There's other little tidbits of things like when I want to put it on my device, on my app, on my iOS device, I want to publish it to the store, or I just want to get it working and see it on an emulator. So what we've done is listen to the development community and see what the pain points are. So the first thing I'll talk about is Android. Now, first up is that Android emulators, they've always been a hot mess, let's be honest. So we've done two things, first and foremost. First is that we updated our Android emulators to use Quick Boot, which enables a snapshot view of your Android emulator. In the latest version of Visual Studio, we have preview support for our Hyper-V extension. So this isn't something custom, this is actually the extension of running Android Google emulators on type of Hyper-V. So let's play this video of file launch of a pre-built application and just deploying and getting the emulator running. It boots, snapshots in, and I'm ready to deploy my application. It's optimized and running on top of Hyper-V against both Intel and AMD processors. So this is the first time that really you get that hardware acceleration on both Intel and AMD, powered by Hyper-V and Quick Boot, running the Google Android emulators. So I'll play that back one more time in case you didn't believe it, but boom, there it is running on the Android emulators. Additionally that we have a brand new SDK manager, emulator manager built right in, and we've also been working on simplifying Android SDK management. Now this is a problem because Android has a whole bunch of different SDKs that you can target, compile against, and whenever you open a project, let's say from GitHub, you may not have the specific Android SDK installed. So we rolled out automatic SDK installing. It will automatically notify you that, hey, you've opened a project where you don't have the SDK, and we'll just download only the pieces that you need. So this means that now you don't have to worry about fiddling around in the Android SDK manager, we just do it for you. Now on the iOS side, there's a whole bunch of different things that you need to worry about when you want to actually get your application on a simulator or on a device, or just want to see a design surface or even compile it. Especially if you're running on Visual Studio on a PC, because everything has to be done over on your Mac, your remote compilation, remote debugging. So the first thing that I'll talk about is automatic provisioning. So previously, you had to figure out where your iOS Mac build agent was, what to install, install Visual Studio for Mac, but now we just do it all for you. Over SSH connection, we'll automatically detect your Mac OS machine. We'll see if any of the Xamarin iOS pieces are installed, including Mono and Xamarin iOS. If it's already there, cool. It'll just connect automatically. Else, it will download, install all the pieces that you need. On top of that, we also handle automatic provisioning when you want to put it onto your actual device. So for instance here, I want to go ahead and log in with my Apple account. This will automatically communicate to the backend servers. It'll grab my machine. It'll grab all of my certificates and provisioning profiles. Now on every single iOS application, you can turn on automatic provisioning. So what's great here is as I go in and go into the properties of this, I can toggle on automatic provisioning for my debug mode. Now what this does is it will not only allow me to select a team but it'll enable me to automatically provision my Mac machine, provision my device and register the application ID and anything else I need to get it onto my device and boom. Good to go. So there's just some of the awesome tooling that's available right now today inside of Visual Studio. But let's talk about cross-platform. Talks a little bit about iOS and a little bit about Android. These are things that you'll just be using no matter what type of Xamarin development that you might be doing, but often developers like, hey, I want to go cross-platform. I want to take my application, I want to run it over here, I want to run it over there, I want to run it everywhere. So when we talk about cross-platform, I've talked about.NET standard. The ability to share all of our business logic across iOS, Android, desktop, ASP.NET Core, anything that you can think about. But when it comes to the actual user interface, we have a story for that. Later on today, David will be coming on, deep diving into Xamarin Forms, our cross-platform user interface for iOS, Android, Mac, and Windows. What's great is that this sits on top of Xamarin, enabling you to share a bulk of your business logic and somewhere you use the interface. Now, you can go all in or use bits or pieces of Xamarin Forms no matter how you like. But what's great here is that it's the native user interface. So I'll be creating all of my user interface in XAML that's shared and rendered natively across iOS, Android, and Windows. So I figured the best way to show this in accessing some of these native APIs and tooling inside of Visual Studio that we've been rolling out is to just build an application. So let's do it. I'm going to go ahead and close this project. Go ahead and save that off, because now it's the perfect application. I'm going to go ahead and bring up a brand new project that I've been working on called Monkey Finder 6000. It's very important that we know where all the monkeys are all over the world, and that we can detect anywhere in the world the closest monkey to us. It's very important, these are real issues that developers have to be concerned with. So this application is a Xamarin Forms application, and we have a Android, iOS, and UWP head project. And that's where you would write any platform-specific code that you may need. But we're going to spend all of our time inside of our shared code where we have a model, view model, and XAML user interface. Now I created this project by going in, saying File New Project. And previously I showed you Android, Apple Watch, iOS, but under cross-platform you'll find mobile application Xamarin Forms. And that will create your project. You can choose what head projects you want with your .NET standard library. Now I've brought in a few little helper libraries here. So I have some new gets, we can see I'm using the latest and greatest. I have Xamarin Forms. I have JSON.NET because we're going to deserialize some JSON. I have a little MVVM Helpers library that I created, called MVVM Helpers, that gives some additional little helpers when raising property change notifications, and some custom controls. So just a little few things, and I'll talk about Xamarin Essentials in a little bit. So the first thing that we want to do is open up our main page XAML. And this is going to be where we create our monkey page. Now I haven't done too much inside this project, but the first thing that I'll show you is that I have a content page here. I have a class of main page and a title of monkey finder. I'm also using a grid, so I can lay out rows and columns inside of here. And the first thing that I will point out over on the left-hand side is our new toolbox for discovery of controls. So these are all of the built-in Xamarin Forms controls that you can use. So what we're going to do is we're going to go in and let's go ahead and lay down a list view right here. And we're just going to go ahead and do a few new lines here. There we go. There we go. We have a data template and my list view. There we go. Now underneath my list view, I'm also going to put down a button and we will find one that says find monkeys. And let's add another button that I'll put over here and I'm going to say closest monkeys. There we go. Now what we're going to do inside of here is first point off some of our kind of IntelliSense features inside of here. So the first thing that I'm going to show you is that if I come in, if I rename this to let's say a stack layout, notice that I see the stack layout underneath. I change that there. It's no longer row spacing, column spacing, row definitions immediately light up inside of Visual Studio to tell me that hey, that's not valid. So let's change that back to grid. But I also want to point out that we have great fuzzy matching here. So what I'm going to do is if I just put in ST stack, stack layout, let's say stack layout. I'll get slider and stack layout because we've got some camel casing there. We can also put stack, stack, scroll view. It'll automatically show you everything here. Let's go back to grid. Additionally, we can help you with any of your namespaces that are coming in. So here it's showing you that you're not using local right now. It's actually unnecessary. But I can come in, I can add additional ones and I'll show you as we go on and create more of this here. But I want to start actually with this list view that needs an item source and I have a button here and I need to bind these up. I want to tap on something, I want to do something like that. Now what I want to do is have some code behind for this. So what I'm going to do is have this view model. My view model is just going to have some things that I can bind to in my user interface. So I have three things that I'll bind to. One is a observable range collection of object currently of monkeys. I also have two eye commands and an eye command says, hey, when someone does an action, invoke this command. So I have a get monkeys command and a get closest command. Here I have two methods that I need to fill in, get monkeys async and get closest async, and we'll fill those in as we go. So the first thing that we can do in our main page is I can come in and actually bind this up. So I can say, hey, content page my binding context is that view model. So I'm going to say content page dot binding context. You know what? I don't know really what namespace it lives in or anything like that, but I do know that it's called monkey view model there. Notice that a light bulb pops up. This is brand new. It says, hey, we can't find that. But do you want us to automatically add the namespace for you? Boom. It automatically adds the namespace because it's in monkey finder 6000 dot view model, which is pretty cool. So now when I come in and if I focus on this list view and button, I can come in and say binding and immediately, let me go and zoom in, I not only get any converters, footers, anything else that I can bind to, but I also get binding IntelliSense. So here I'm going to say monkeys. Here for these two commands, I'll say command binding get monkeys command, command binding get closest command. We also need to give it a data template. So I'll create a view cell here. There we go. What we'll do is we'll just go ahead and lay down what we want these monkeys to look like. So I'm going to put a stack layout inside of here, and we're going to say orientation horizontal. So stack things horizontally, and we'll say image, and then we'll have another stack layout, and let's do a few things here. Let's go in and say, this image is going to be horizontal options. Sorry, let's do height request, let's say 66 and width request 66. Then we'll do another stack layout here, and here I'm going to say, let's create a little padding of five, just so everything's a little bit off of it. We'll also put a little padding here of five. Then what I can do is say, well I'm going to have a label where I display some monkey information in another label. Now I don't know what that information is yet because we haven't filled in that information. So I need to go find those bindings. So let's head over into the browser, and like every single developer out there, on their personal website, they have a file called monkeys.json. When I go to montemignor.com-monkeys.json, I have all this monkey data that's here. That's looking pretty cool. So we could take this JSON and deserialize it. So the first thing I'm going to do is come into my view model when I click on this button, I want to do something. So let's go into this get monkeys. Let's just say try and we'll just go ahead and catch that exception and we'll say ex. Notice I'm just in my.net standard library. I haven't really touched anything iOS or Android. I'm just going to say new client, new HTTP client. There we go. We'll just bring in system.net HTTP. I'll save our JSON equals the wait, client.getStringAsync, paste in the URL that we have there. Now I need to deserialize and get that monkey. Now notice I have a monkey model but I have nothing in it. It's blank. Just created a file over here. So what I can do is grab all this JSON, and I'm going to go to a website called quicktype.io. It's actually by some amazing developers here at Microsoft and Xamarin before that. It takes any JSON and enables you to paste it into the browser and convert it to any language. So app.quicktype.io. What I can do over here is let's just go ahead and make this a little bit bigger. I come over here, paste in my JSON. Now here it's going to show me all the languages that I can go ahead and put it in, and of course I want it in C-sharp. There it is. It's in C-sharp. It also brings in all the namespaces, everything that I need, and I can go ahead and copy the code, come back into Visual Studio, paste the code, and there's everything including these nice JSON properties for name, location, image, which is a URI coming in. I think it's actually a string, make sure it's a string, and some lat long population coming in. It's really nice. On top of that, we can go ahead and not make it welcome. Let's go ahead and rename that to Monkey. Under here, we can see that we have some nice helper classes. So we actually have some monkey from JSON, which automatically deserialize things with a converter. So I'll come back over here and what I can do is I can say var monkeys equals monkey dot, and we'll now bring in the namespace that I was in, which is quick type from JSON and from JSON. There we go. Now I have a monkey array coming back, and all I have to do is come up here, and instead of this generic object, let's say it's a monkey. In here, I'll also say it's a monkey. Now, all I need to do is say monkeys dot replace range and pass it in the monkeys. So update the list automatically for me. Now, if something goes wrong, we'll go ahead and pop up a dialog box. So we'll say app.current.mainpage.display alert. I'll say something went wrong, and let's do ex.toString or message maybe, and just so we have it as we debug this application. So now it's looking pretty good. I have some information, but we need to put it in here. So I'm going to say source, and I'll do a binding here to image, brings that in, which is really nice, because it knows about the monkeys. I'll come in here and I'll say text, and I'll say binding to name, and text binding equal to location. Now with that in place, we may need to fill in a few other things for my row information. So here on my button, we can go ahead and drop this down, make it a little bit prettier, but we'll say grid.row1 and grid.column. We'll set it to zero just because why not? Here I will go ahead and copy and paste that over, and I will say column one over there. Perfect. Now that's looking pretty good. Now at this point, I'm ready to get it onto my device. If I go into the project setup, we can see that I have an app XAML, and inside that app XAML may be any of my resources, but also here I'm setting a new navigation page, creating a new main page here, and I get some life cycle events for on-start, on-sleep, on-resume. But more importantly, I don't only have to do too much inside my other head projects. If I go into Android, notice that just like the other Android app I showed you, I still have resources where I can put icons and additional layouts. I have resources here for my JSON.NET, MVVM Helpers, and Xamarin Forms. Additionally, I have this main activity. So this is a Xamarin Forms activity, which will enable me to come in and set up and create my application. Now there's a bunch of other cool things inside of here that David's going to talk to you about later, including fast renderers and some additional information here. But now I'm just ready to debug this onto my device. So I actually have my Samsung device right here, and I'm going to deploy it on my device currently. I could put on an emulator, but I'm going to use some platform-specific features to do geolocation in a little bit. So I still have a little bit of time. Now this will go ahead and at this point, now I compile my code to put it onto my device, but it's going to go ahead and compile up a full Android APK and put it in Debug mode. So while this is compiling and deploying, I'll answer a few questions here. The first one came in from Christian says, great info, glad you're liking what you're seeing so far. Can I find Monkey Finder? Absolutely. Everything that I do is on my GitHub. You can go to github.com slash James Montemagno. Let's bring that up on the screen. You can go to Repositories right here. See everything that I work on, and under here just type in Monkey, and you'll find all of my Monkey apps, and there's a lot of them. But Monkey Finder 6000 is right here, and I'm going to be updating with the latest and greatest here in a bit. So that's where you can find it. The next thing as this deploys, Mike was asking, is Intellisense to view models only with Xamarin? That's a good question. I'm not sure exactly what you mean, Mike. I guess for the Windows part, there's Xbind and a few other things that you could do there. So I'm not positive, but maybe you can follow up Mike with a few additional questions. So let's see, this should be deploying onto my device, starting in Debug mode. There we go. Perfect. Now we should see my screen here, and I should be able now to say, find Monkeys and something went wrong because it put me on the guest network again, which is great. Let's go ahead and connect to my MacBook. Now ideally, this should go off and pull in all of my Monkeys right there, and we can see that I don't have the best formatting just yet. So we can go ahead and clean this up a little bit inside of here. But I get my Monkeys back right here, and in fact, if I come in and actually go into that view model and say, let's add a breakpoint here and say, find Monkeys. This will go off, make that request. I can see all of my Monkeys, my JSON, everything inside of here that I would expect inside my local. It's just normal debugging, and there's my JSON coming in right there, which is pretty cool. So let's go ahead and clean this up a little bit. The first thing I'm going to do is I'm going to come in, and I'm going to say, all right, well that list view is not looking so good. So let's go ahead and say has on even rows and set that to true so that way rows can expand. Additionally, what we can do on this image is we can say aspect and I'll say aspect fill, so it fills the entirety of it. But we can take it a step further because we actually have a custom control that I brought in. If I come in and pull into this library, notice I have this image circle, custom control. Now what's cool about the circle image is if I open up this DLL is that it has a reliance on Xamarin Forms. But it also, let's go ahead and I don't know if I can just open it there. But I also have image circles built in. So what I can do is say circle image, and notice here that it doesn't know what to bring in. Well it's okay because I could come in and I could say XAMLNS and I could say circle, and I could say circle image, it finds it right here in the abstractions or better yet, why even type anything because this squiggly will do it for me automatically. There we go, and it pulls in everything that I need, right there, which is super great. So now I get the image circle, I get my label, my name, everything that I want, and I can redeploy this application with these uneven rows. So I should see more monkeys inside the list. But Visual Studio has gone off and actually gone ahead and handled all of this for me. So we'll give it a few seconds to redeploy onto my device. We did have another question as this compiled up from Sadrani who asks about Microsoft authentication library in Xamarin Forms. So if you're doing authentication inside your application today, maybe you're using Azure AD, maybe you're using Microsoft authentication, so you just want to log in with your application. You can use MSAL, which enables you to not only do Azure AD, but also Azure AD B2C that enables you to do login across iOS, Android, Windows, and of course Xamarin Forms. They have some optimization there to easily bring in a page, which is really nice. So let's see as this deploys here, I rebuilt it up so this should be packaging it up and restarting it in debug mode over on my Android device. Now as long as it connected to the same Internet, perfect. Should be able to find Monkeys. This will go off, find the Monkeys, I've hit the break point again, and now I have Monkeys in this list, and they're very small so we'll fix this next, but we get some nice circle images. I have not expanded it to multiple columns, but I'm doing this live so that's okay. So let's go a little bit further here and fix that up, and then talk about how I can access cross-platform native APIs. So the first thing here is we'll say grid.columnspan, to now our list view will expand fully. So I built an application, littered from scratch, hitting a restful endpoint, pulling in data, displaying it, custom images, Visual Studio is handling IntelliSense, it's doing all sorts of awesome stuff for me, because Visual Studio is great, and.NET is sharing all this code with.NET standard libraries. But we want to access those native APIs, that's why I built stuff with Xamarin, right? Because I have access to every single API in iOS and Android. When you think about this application today, well, we have a shared back-end, that's our user interface, it's also our models and our view models. I could tie this up into MSAL, I could add in Azure integrations into the back-end with Cosmos DB, but I also want to get access to other things like Geolocation, Compass, Keystore. Now you have access to all of those in C-Sharp with Xamarin. You can access every single one of those. Now the problem here, of course, that there's different APIs for each of them too. So I want to access Geolocation, I have to go learn a little bit of iOS, a little bit of Android, a little bit about Windows. We said, what if you didn't have to do all this stuff? Because what developers were doing for a long time, is going in, creating an interface, accessing platform-specific implementations. So let's say preferences, just like settings. You would say get, set, and you write your abstraction, and then implement NS user defaults, shared preferences, application data. That's great because you have access to the APIs, but now you got to go maintain all that code. So we handle it all for you now. We have a brand new library that I am the PM of called Xamarin Essentials, which I absolutely love. What it does is it takes all of the most common and popular platform-specific APIs, and abstracts them into a single, fully optimized library that you can use in your iOS, Android, and UWP applications. So now you immediately from a single API, have access to Geolocation, device information, sharesheets, battery, compass, text-to-speech, SMS. It's completely open source on GitHub, and we have amazing contributions from the community adding more APIs. On top of that, it's a single DLL. It's a single library, but it's linker safe. So that means if you use one API, everything else is removed when you compile your application because it's fully optimized. So I figure what we would do here is now take our monkey application, use the Geolocation of our iOS and Android devices, and actually find the closest monkey to us. So let's do that. So notice that inside of this JSON that was coming back is our monkeys have not only an image, but a latitude and longitude. So automatically based on where each of these monkeys are, maybe the mandrill, maybe our friends Henry and Sebastian, one that lives in Seattle and one in Phoenix, they each have their own geolocation here and population sizes. So it'd be great if we could get the device geolocation, but also automatically find the closest one to us. So when I come over to docs.microsoft.com and tap on Xamarin, you'll find documentation for everything that I've shown you today. But also whether you're developing with Xamarin Forms iOS or Android, you'll find Xamarin Essentials right here. When you tap on that, you'll see information, not only how to get started, but about every single feature in API inside of Xamarin Essentials. So if you want to tie in Compass into your application, open up the Compass API. It gives you a sample right here that you can use and how to use the API. That's still under the hood, accesses the native APIs of each platform. But you have one thing to start or stop the Compass. Find information about platform-specific things or additions onto each platform and also jump directly into the source code right into GitHub. So if you want to go ahead and contribute, look at the source code, here's the Compass source code. Here I can see exactly how we implemented the Compass for iOS, Android, and Windows. Code you no longer need to write. So let's actually learn about geolocation here. The first thing that this is going to tell us is for iOS and Android and Windows is there's a little bit of setup code for permissions. So on Android, I have some assembly information here that we can go and copy in. Nice little copy button. If I come over into my Android assembly info, I've actually gone ahead and done that ahead of time. So here's that information to access it. Additionally, there's a little bit of setup information that I did over inside of my main activity to handle permissions automatically for me. Now what we need to do is come in and see how we can use geolocation. Well, this is pretty fancy. There's a way to get the last known location. Additionally, there's a way to get the current location. So it looks pretty good. So let's go ahead and copy that here. Let's go back over into our ViewModel, and where I have getClosestMonkey. So here, I can go ahead and bring in Xamarin Essentials. That's our one namespace for everything. So I've actually come in and just start typing Xamarin.Essentials. Notice, we're going to move this magnifier out of the way. So that I have access to every single thing here, every single one, every single thing inside of here. I've access to everything immediately. So let's do a few things here. The first thing that we'll do is I'm going to go ahead and say, var location equals a weight geolocation.getLastNoneLocation. So let me just get that first because that'll be the absolute fastest. If location is null, let's go ahead and then get the current location. Create a new request and automatically pull it back. Now, what's great is that I have accuracy, so I can come in and say that I want high, low, lowest. I'm going to do low right now because I'm inside of a building. I send out that request and I have it. Now, additionally, we can start bringing in some namespaces here for that. I can see if the device doesn't support the feature or if I don't have the permission, we will bubble up exceptions for you. But maybe we need to see what the closest monkey is. So if I scroll down a little bit, I find information but note here that guess what? Xamarin Essentials will also tell you the distance between two locations, which is super cool. So we can use the extension methods here to calculate the distance from one or the other. So let's go ahead and do that. Once I have the actual location of said monkey, I can come in and say var closest and I'll say monkeys. I can say, let's go ahead and say monkeys. Where? Let me see what I need to write here. I forget. Sometimes I forget my link, but let's go and bring in link really quick. Where's my link up here? Quick actions, bring in link. So let's go ahead and order these actually, sorry, order by. We're just going to head and order by each monkey and we're going to say, for each monkey from my location, let's go ahead and calculate the distance here. We're going to say new location and we need to pass in the monkeys latitude and the monkeys longitude. There we go. So we're going to order by all those and then we're going to say, first, oh, sorry, one more thing, pass in the distance units dot miles or kilometers, and then do first or default. There we go. Then what we can do now that we have our closest monkey, which is a monkey, we can say await, display alert, and I can come in, oops. I can say app.current.mainpage.display alert, and we can find closest and we'll say closest. We'll just make sure it's not null and we'll say name plus closest dot location and okay. There we go. Perfect. So now we're using geolocation, getting everything that I need and now all we need to do, simply compile up the application again and get it deployed on my Android device. So while that's compiling up, I think we had a few questions here. Does Xamarin Essentials automatically add respective accept challenges for native features use an app? Like how to get access to geolocation feature? Yes. I think you're just asking about permissions. So there's a few of the APIs that require permissions such as geolocation and will automatically handle location raise notifications for you, and it'll send you a permission exception inside of your source code if the user has declined that option there. So that's a nice feature built right in to Xamarin Essentials to handle that for you, and you can query the device as well to make sure to see if they have permissions ahead of time. So this is compiling up, making sure we have the latest changes, five minutes left which is the perfect amount of time here. So let's let it finish here and let's see. Let's see if we can scroll down on the questions to see if there's another one that we have. It says, does Xamarin Forms have any, we're waiting for it to scroll, in a world where the scroll view will work? Taylor asks in a world of suspense where Taylor asks his question. I do like that. That's my favorite, we're waiting. But while we wait, there we go, there it goes. There we go. Does Xamarin Forms have any disadvantages over Xamarin Android or iOS? Well, when you're building with Xamarin Forms, it's an abstraction over common controls across each platform. So what that means is that you have access to an abstraction of APIs. Now what's cool is that you always have access to the native platform so you can create custom controls, custom renderers, anything that you need to do. That's there. We actually have some different metrics that you can look at online, that's there. The website that you used to convert your C-sharp, is that any better than paste as classes? It's a good question. So I like QuickType because it's made by some friends of mine, but additionally, it allows you to go in, select different languages, you can detect maps, enums, UUIDs, date times, integers, strings, additionally, if you log in here, you can select arrays, completed, and it's optimized here for JSON.NET. So you can write all those properties automatically and it handles stuff for you. All right. I'm going to see what is happening in my build. See if we cannot see what's going on here and redeploy, as it builds up. The next question here was, how would auth work with something like Identity Server rather than Azure AD? I'm not an Identity Server expert to be honest with you, but most likely if you go to Google and type Identity Server Xamarin, I bet the answer will be there. If not, send me an email because I will help out further. Xamarin Essentials is ready to use in production applications, Damian asks. Good question. It's in preview today. We've had several previews already. It's in preview 10. We're on a three-week release cycle. We really want you to check it out. I use it in all my applications, but that's going to depend on your enterprise there. A lot of the code is battle-tested and comes from our developers here. So give it a try and we will love your feedback on it. Okay. So I have it up and running. That's good. We have monkeys that are here in our screen. I should be able to now find the closest monkey. Here it's going to prompt and allow permissions on the screen that we can see which is really nice. I'll say allow. This will go off and find my location and actually found my cache location here in Redmond. Here I can go ahead and continue on. We can see the closest monkey to me is my monkey at home Sebastian over in Seattle, which is great. Now, what's cool here is not only am I using everything that I know and love about XAML.NET standard sharing code, building native user interfaces, but additionally I'm using geolocation and these helper methods. It's very simple to get up and running. Now on top of that, what I can do is of course come and set the iOS or Android application as my startup project. Now what's really cool is we added some new features right individual studio. I'm connected here to my Mac which is in my other room. So it's connected up, paired over my IP address over secure SSH. I can see a list of all of my simulators that are there and I can launch it on a remote iOS simulator directly on my Windows machine or toggle this over to iPhone. Notice here that I have an iPhone that's sitting on this desk and can communicate over the network via Wi-Fi so I can deploy it and see it on my actual iPhone device. So now what will happen is if I hit debug, this is going to go off, compile my iOS application over on my Mac machine. It will then over Wi-Fi, go ahead and debug it and deploy it onto my actual iOS device. Now what's cool here is that now you just see an iOS device. But in a few seconds here, what we should see is that it will compile up everything and deploy it over to my device. So we'll give it a few seconds here as it does do a deploy over the local Wi-Fi. So we'll see this could take anywhere from five seconds to 30 seconds. We'll see if it works. Should have had one already cached on it already. We'll see and ideally, we'll see if it goes and compiles up. This is the point in time where I never know if how fast my little MacBook Adorable is doing over there. The poor thing has a mobile processor. All right, cool. Here we go. So it's build succeeded. Now what we should see over here in our output is that it's copying the file over local Wi-Fi. We can note in the output here that we get percentage updates right here. Now it is copying via Matt who is on the gimbal via no wires over by Beth over there somewhere in Channel 9 that's transmitting all of this data. So while it is a little bit slow on this network that I've built myself, we can see that it's copying the application over in real time and then I'll start a debug session on this device. So let's finish up as it deploys over to 100 percent validates the application, launches it. Very excited that this is all happening. Here we go. We've actually launched the application in startup mode. I can say find monkeys which should go off, find all my monkeys that are here, start downloading the images. I can find my closest monkey, which apparently I may not have set that up. That's why it's live demos. I can say find monkeys here, finds all my monkeys, and now I have my application running on both iOS and Android. Let's get in close and see my monkeys are right there. All over, no wires. Perfect. All right. Let me wrap it up here and show you where exactly to get started. Thank you for the amazing questions. If I didn't get to it, feel free to email me directly or ping me on Twitter. Truly, .NET and Xamarin is truly everything that you need for mobile development. You can get started today by installing Visual Studio and selecting the Xamarin workload, mobile.NET workload for Xamarin. Go to visualstudio.com slash Xamarin. To learn more about Xamarin Essentials, aka.ms slash Xamarin Essentials, and with that, thank you so much and have an amazing .NETConf.