Creating the Xamarin Forms project

A free video tutorial from Houssem Dellai
Engineer at Microsoft
Rating: 4.5 out of 5Instructor rating
10 courses
151,152 students
Creating the Xamarin Forms project

Learn more from the full course

I want to connect my Xamarin Forms app to REST API

In less than 3hours, learn how to create a REST API with ASP.NET Core and call it from Xamarin Forms app (iOS & Android)

02:18:15 of on-demand video • Updated December 2020

Develop mobile app prototype
Understand how REST web services works with mobile apps
Implement CRUD operations' calls with user interface
English [Auto]
Let's add in new forms application that will act as a client for this hosted web API project for that you're going to add in your folder which will be specific for my android or for my smartphone application projects. So I call this move by UPS because many forms application will include four projects or one to put them inside one same folder instead of having all of them under my solution. Now I'm going to click my folder then from here and choose add new project and from here under visual C-Sharp I choose crossplatform. So if you don't have Zamani in forms Ereli and styled and Visual Studio make sure you check the summary forms when you started Visual Studio. So if you don't have it that it actually can go to your tools and select extensions and updates or get tools and features then from there you can check Zamani and forms and visuals to do. We'll try to download all the bits and many forms. Once you have done that when you do add in your project you'll find that here you have this menu right here under bridges which is cross platform which is specific for as am I. You will also have Android If you want to build applications using C-Sharp that it's only Android. It means it won't work for us it only works for Android but with cross-platform here the application that we'll be building using it works for Android iOS and also you W.P.. So it was cross-platform and then we choose here the first template because the second one is for creating UI testers so we choose the first one for creating and use many forms of English. I call this one to do up from here. I choose which platform I want to target. So here I take the three platforms Android and Windows. And here I want to use Amorim forms instead of using the native library which here will help us to share not only the application logic code the business logic but we'll be able also to share the UI or the user interface of our application. So we don't have to implement user interface for Android and reimplemented for us and for Windows for the code sharing strategy here would be using the standard which is now getting more support from Microsoft for the template. We start by a blank slate so that we can understand how these things works together to create as many forms applications so we start from a blank app. OK. Now the creation of project is started. Once the project is created we see that here Zamani forms is actually for projects instead of one. So here we have the first one which is the next under project called to do up and right from here will be writing shared code for the business logic and also for the user interface. So here where we put our interfaces and our mothers we do also have a second project for Android which is targeting the Android platform which contains the almost the same application architecture as a native Android application that is written using Java or Codlin. So here we have the main activity and the main activity here contains the properties that we already use in native Android obligation. So here it sets the icon the application name and also the theme on the uncreate mittened. Here it is calling the out which lives inside Israel Project or the next under perfect the PCL actually is the old model. Now we are using the standard. So if you look at the web if you are looking for rules then make sure you select the next standard instead of you see it. So here are some of XML This is like the entry of our So many forms application which will launch the main page and the main page is the first page that will appear in our summary forms of location. Here it just contains a simple method saying we can't to Zamani forms so the main activity here will launch that page for the Android project that we do have a folder for resources where we put the application icon for different areas dilutions also have the sets and so on. The same or most for us though we do have the U.S. obligation we do have a name that says and so do the delegate which will allow forums user interface by calling the app and the saying We do have the resources which contains the different icons for the application. So if you need to change the icon for our application then we need to do that around by changing those icons you are inside their resources folder and the same thing for your WP application. We do have the that summer years which we launched and picked up from the firm they next under Birzeit So here each one of those projects have a reference for to do for that here if I expand the references you see the reference to do the same for us if we expand the references and then here to have the returns to do up so that it can be up. Zalman SEUS cool so now we have our Zamani forms of location targeting Android Iowas and WB. So if you want to run the WP application now all you need to do is to select the a platform All right from here. Then you click look at the machine or you click a five button from your keyboard and if you want to run the Android project that you change to Android. And here with Android you can either select can either select the new mutator that you need to answer that or you can select a real Android device as I do here would say that my Samsung device by doing that I can run the application directly to my device here how it did this. So my device is now connected via US me to my laptop and I have installed the ADP driver to my laptop so that it can recognize my device from visual studio. So to answer the Adeeb you just need to look and or to search to Google it. So if you just tried the name of your device if you were using Samsung then you write some song a DV then it will give you the driver and you install it in your laptop. And here we can see the application displaying the message. We'll come to Zamani informs running on Android device. So here I am sharing my Android device screen through a software called Viser. And if you you might want to use this software if you are doing a presentation or so on so you can get that software from this web page right here. If you go to vizor dot you then from here you can download this free version of vizor. Now if you want to test this application on us device so we can test it. I use a simulator or you can also do with a device. Let's start by the simulator. So here I am I'm running a Mac. So I have a Windows virtual machine on the inside. So I need the mike in order to compile and build my application from within Visual Studio. I can't connect to a remote with a simulator so I just need to figure the US and from here and get this I can. All right you're telling me that now already connected to a new machine. So if you click on that you can hear it displays to me all the Mac that they have on my network. And here I'm connected to this one. You can add on by looking at the server and then you put the IP address or the server name of your mike. Or you can get that IP address from Mike. So from within my Here you can you can go to System Preferences and within System Preferences you have your sharing. I can see if you click on that then you will get to your IP address or your mike. Copy that then you use it right from here you click ADD and then the route will be added. All righty. Once we have done that from here now we can say we want to deploy our application to a night phone through the mike or directly to the iPhone simulator and the Mac. So I select here iPhone simulator and now I can get all the iPhone simulators available on my Mac machine with different versions of I use here. I choose the latest iPhone Ekis I choose it then I run and this will launch the iPhone X simulator and my my machine the application login and it shows the same message. Welcome to Zamani and forums. This way we did launch the obligation on the simulator but you can also launch the application on an aerial iPhone device if you choose right to your iPhone and then you select your iPhone. That should be connected to your mike machine using us to beat us with the cable. Another might be for ending this video is that here I'm using Visual Studio in Windows environment but with with Mike you can use visuals to do for Mike and from there you can create Zamani forms obligation and you can also run your application on Android emulator on Mike or U.S. simulator also and Mac but you cannot run your WP projects.