Xamarin & Azure Mobile App Services | Eduardo Rosas | Skillshare

Xamarin & Azure Mobile App Services

Eduardo Rosas, Software Developer. Finance YouTuber.

Xamarin & Azure Mobile App Services

Eduardo Rosas, Software Developer. Finance YouTuber.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
12 Lessons (1h 55m)
    • 1. Intro to Microsoft Azure

      5:19
    • 2. Portable Class Libraries

      5:44
    • 3. The iOS Layout

      3:45
    • 4. The Android Layout

      17:41
    • 5. The Password Model

      5:53
    • 6. Creating the Azure App Service

      7:31
    • 7. Creating the Facebook App

      8:56
    • 8. Creating a Table in the Database

      6:46
    • 9. Authenticating Users

      20:04
    • 10. Inserting into a SQL Table

      9:33
    • 11. Reading from the SQL Table

      12:33
    • 12. Navigation to a Detail Page

      10:53
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

70

Students

--

Projects

About This Class

You will learn to use Microsoft Azure App Services inside a Xamarin application, implementing:

  • SQL databases in the cloud
  • Making requests through a service
  • Facebook Authentication for users

We will start by creating the Services on Azure with a new subscription (which by the way will get 200 USD of free credit).

Then you'll create a Facebook app and connect it to the Azure App Service to handle user authentication.

Finally, you will create a Xamarin application for both Android and iOS that lets users log in with their Facebook accounts, as well as writing and reading from the SQL database hosted in the cloud.

Meet Your Teacher

Teacher Profile Image

Eduardo Rosas

Software Developer. Finance YouTuber.

Teacher

I am a Software Engineer and Xamarin-Certified Mobile Developer.

I have been developing mobile apps for 7 years now, I started when iOS 5 had just been released!

During this years I have created apps for clients, both for private use and for public use. I have created some apps that I wanted to release to the app stores, and have created a lot of apps just for fun. The main platform I use is Xamarin, so I can code Android, Windows, iOS and macOS apps using my favorite language: C#.

I have helped literally thousands of students to learn how to code, both online and in-person, and it has become my passion.

I also love to design apps, whenever I get a little bit (or a lot) stressed when coding, I design apps, either out-of-the-blue concepts, or the next app... See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Intro to Microsoft Azure: during this section, we're going to take a look at Asher at Microsoft Asher, Microsoft's cloud Service. And the reason why we're going to take a look at this is because we want to implement some functionality into applications that allows users to have the same data. No Marine with device. They are using the application. So, for example, you, sir, could be using your application on their phones. And certainly they want to go to their talents and have this information. Or if they switch phone for some recent, they have to have this information. This is basic, and every application should do this now during the section. Then we're going to learn exactly how you can do it by implementing Microsoft Azure services. So here I am at Asher dot Microsoft that come where the first thing that we have to do is create our free account. And as you can see, Michael really wants you to create your free account because it gives you two big bottoms available right away for you to get started for free. So click either one. Either they start free Bolton in the main section or the free account bo turning the top right corner and as Mike, So we'll tell you immediately. Not only will you be getting a month of month trial to use Microsoft Asher, you will also get $200 of credit along that month. Now, these number right here is in Mexican passers, and you may say it on your local currency. But this is about $200 or so. In fact, in the U. S, you will see 200 doors of credit that you will be able to use through our toaster. Today's off your trial. So not only will you be able to use Microsoft Asher for free, you will also be able to use some bait services with those $200 of credit that you will have. So let's get started for free. We, of course, have to sign up to use Microsoft Asher, and you can do it with one of your Microsoft accounts. Or if you don't have any, you can just create a new one. I am going to signing with mine, and I will have to feel about forum. So I signed up for using Microsoft Asher. So the first step is probably to fill out some information that I have already field or that make sure data has already retrieved from my account. But the second step is going to verify your information or your identity by phone, so you will have to grind down your phone number. You will receive either a text or a coal, and you will have to grind down the code that you will received. Next. You will have to verify your identity by adding a credit card. So here you will have to assume credit card information. No, don't worry. Nothing will be charged to your credit card unless you start using eight services from Microsoft. Usher and you have ran out of credit or time after those two days, but during these cars were not going to be using any more than jewels free services. So we're not even going to be using those $200 of credit. So just as your credit card information and you will be good to go with days of mind that neither Microsoft Asher is going to charge you something that you don't know about, neither were going to be using bait services during these kers. And if you don't use Microsoft Azure. If you don't add any paid services to your make sure that your account nothing will be charged and with ace of mine as well that if you start using like short dasher Bates Services, you will be directly charged to your credit card. So your services do not certainly be unavailable because there is no more credit in case you run out of credit off those $200. Asher, we'll just charge your great card. And once you can feel this information you're going to see in the agreement section a couple of boxes that you have to check on, you'll be good to go. Once you have signed up, you will be redirected to your micro Tasha portal, which will look very similar to this. And it's in here where we will spend much of our time creating and modifying the services that we will be using. So in case you have taken a look at the lectures, the past lectures where we used the classic port so you'll sit area looks very different. That's why we are updating this reflectors we are now going to be using in these new portal . You will see that while there are many differences in the U. I, the way we create the services is very similar, and the service that we're going to be creating while also has a different name that the service that we use before East, Walter very similarly is going to have pretty much the same functionality with the addition of Gore's off new features that were available before. But mainly we will be creating the same that before, just with different names. And we have dated features as well as in the new dashboard in the new portal instead of from the classic portal. So now, in the coming lectures were going to build our application, we're going to get our application ready and was We have it's interface and its main functionality and navigation will come back here to the magazine Natasha Portal and creates the service that we're going to be later be connecting to our mobile application 2. Portable Class Libraries: never we have our Asher's prescription ready. Let's get our application ready as well. So we can later greed that Asher service that we're going to be using and link it to this obligation. So I'm here in visual studio for Mac, and you can do this in visual studio on Windows with we shall see iTunes 17 as well followed the stairs that I'm going to be following right now to create your new project. Now, in case you're using a previous version of Visual Studio, for example, the official of Studio 2015 or maybe even souring the Studio Mac, the steps are going to be a little bit different. Just make sure that you end up with the same thing. So, for example, right here I am going to create a new project and Visual Studio 2017. What I can do is go to the multiplied from Section Select AB and select in the native section blank native app that is going to be for IRAs and Andrew, in the case of Visual Studio 2015 when you can do is do what we've been doing so far, except hold Justin rebates when creating a shared project because we're no longer going to be creating a shirt project. If you're in 2017 you can click a next and were requested right down the APP name, which in this case is just going to be passwords and make sure that you sound like these time the use portable class library. Now, so far we've been using is shared the library's. But now we're going to be taking a look at PC else or portable class libraries Well, to make sure that you are selecting to use native you I technology instead of sarin forms. In the case of Visual Studio 2017 and Windows that he said later, selection on Mac. We have already taken care of that selection in the previous menu and click on Next Finally review. What is going to be created? You can change the location of where is this going to be created? Whether or not you want to use Russian control. I'm just going to leave everything as default on. I am going to click on Create. Now let me talk just a little bit about PC else and why we are now moving to using portable class libraries instead of the shared libraries that we've been using so far. So the main difference is that assure delivery is basically going to be copy it or CO. That is going to be copied into each project. Eventually, the code exists on all projects. When it comes to PCL, what happens is that we get a file that is generated when that project builds that, then he's going to be referenced to the other projects. So we do get, like, unexcusable if you can say that way, because it's no, really inexcusable. So with BC else you get a file after building the project, I should. Larry doesn't create any files. It is just the same as having that same code on all of the project. In the case of A PCL, we get a file in this case at the L File. That is later reference to both the Android and IOS projects free to be used similar to what we would see with order elements within the references that maybe inside of those projects, also, A PCL is going to allow us to use or the references to other references directly to this project, something that with a share project. We definitely cannot do so on this piece year. We're going to be able to, for example, at a reference to a package that will allow us to use Asher. And you see that cross platforms after these PCL is billed to created the Yellow file. In the case of a show project, we just wouldn't be able to do something like that. Now, I just want to take a quick look at what has been created and the solution Explorer. You will be able to see three projects the Android and the RUS project just that we've had before. But now you also have that PCL. I noticed that as you expanded, it has many more things than a share project. Does he have Starting with those references, we have references at it, and we can ask me references. We can add packages to this project so it looks like a much more robots project looks a little bit more like the IRS and Andrew projects with these references and packages folders that we don't have in that shirt library and from which we will be able to add more functionality directly to the PCL. That will be later. Of course, a steel be entirely shared to Iris and Andrew Ward. So this is the new kind of project that we will be using to share code across IOS and Android and in fact, is the one that I recommend to you in most of scenarios. Onley in this nars off a simple application where you don't really need external packages or third party packages. Do I recommend the share library in all other scenarios where you need external packages and services from third parties or functionality already created on a different deal? L I do recommend PCL or a portable class library. So there you have it. We have created this project and we have taking a look at BCL. Now, in the next lecture, I'm going to show you what the application is going to look like so you can build it with what you have learned viewing these girls so far 3. The iOS Layout: Let's now take a look at the application that we're going to build. So during this lecture, you're going to be creating a challenge. You're going to be completing a challenge in which you're going to have these user interface for your iris application. And of course, this is going to be the exact same thing for your android application. I'm just going to show you what these you I has to look like what elements this has to integrate. And you will have to create this You i for these elements to be on the U I for both Android and IOS. So, first, of course, we will need, in the case of the US, at least the navigation controller which is going to lead directly to its root view controller, which is going to be assigning the controller where all we're going to have its assigning with Facebook. Porton, this eventually will redirect to these new table view controller What? We're going to least passwords, Justin them over the passwords. In these you I will have thes at ICANN or blows Heiken, which will never gave the user to these new password view controller where they can add a new password, so they will need the name of the password and the password itself. Of course, you will have to keep in mind that these pass worth text field or any text in the case of Andra Ord has to be for passwords. So you will have to be a secure entry. So I have said that in the properties for these element in particular. And finally you will need a safe Aiken. Just a quick dipping here in the version of visual studio that I have currently. And this happens in visual studio 2017 the windows as well. When you are these Barberton item, even though it looks, it appears to be added to the right, you have to select it to the left. For some reason it's just weird, but notice how I cannot select over here but I can select will left and notice that it does have the identifier And as I change its value, it changes. What appear so it is a great selection just for some recently appears to the left. And finally we will have a details re controller where we will have these label where we will eventually this play the password itself. Now, in the case of IOS, we will need to hide the back Porton in the case of the password stable Wii controller to which we are navigating from the signing view controller. That's why, in his view, Controller, I have overridden interviewed load measures and I am calling the said Hangs Back Bolton method from the navigation item sitting in these to be hidden with through volume and no animation with these fools value. Also backing the View controller, I have gotten read off the default code that was headed there was counting how many presents abortion created board. It's now cleaned up so we don't have anything. You just give these four things in mind. So go ahead and create the U. I for both your and rode on Dyer's application with this in mind. And once you kept on that in the next sector, we're going to add something that we haven't added on Android before. And that is something very similar to what we have as a parable to item on IOS, which is going to be a toolbar item. We will be working in the next lecture, then with menus and tool bars on our android applications, so we have a similar layout on both platforms 4. The Android Layout: So we have taking a look at how the IRS application should work, how it should look rather and what is going to be the navigation like and that was pretty straightforward because we have done that before. But when it comes to on draught, there are a couple of things that we have to keep in mind now, especially wind comes to themes and toolbar because those two things are going to be very important for us to achieve a functionality and user interface much more similar to the IRS interface that we have recently created and that you should by now already have. By the way. Now, during this lecture, I'm going to briefly mention to you how these Andrew application is going to look like So you complete the challenge. But I'm also going to teach you how a toolbar has to be added in order for you to add bottom to the title barred, which is something that we haven't don't so far in. And Lord So first, let me give you us more Pick at what these you I should look like starting with the main that XML file which Waas created by default. They have just changed The Bolton that has created that has been created by default. And I get into the theme because you can see that it looks brother different right now. I'll get into that in just a second. All you have to make sure right now is that you have a boardroom like this. I have changed the text, the background color as well as the foreground color all day color for the text, which is dawn by going to this tile section or simply finding the text cooler property. In this case, I just said this to White in the case off the passwords layout, which is the one that is going to be displaying all of the passwords. What I did was that at least view now the reason why I simply don't have a list activity is because I will also need a toolbar. We'll get very deep into using. These two are in just a minute. Just keep in mind a you'll to have to use a tool bar, and that is just another element that you can find instead of a toolbar. So here we will have a toolbar that eventually will have on add Borchin as well. I sat least view throwed off this, of course, in the main activity. I have already received that signing bottom and in the passwords activity. I have already received a toolbar and the least view from the fine job. You've IittIe methods as well as created uneven hander for one of the items. Instead of the Lease view East Breast, we will have the new password layout, which also needs a tuber, as well as the two elements that to edit texts that we need for the name of the password and the password itself. Of course, in the activity I have received the toolbar and both of the edit text. And finally we need the password details label for which I have changed the text. Of course on, I have also said the gravity from the source be center so I can see the text in the middle instead of to the left. And I, of course, have these text view inside of the activity, so it's pretty straightforward. Currently, we haven't done anything out of the ordinary. We have just added elements. We have added new elements in the form of two bars, but it is made, basically, just drive him from the toolbox So far. Now, let's get internationally implementing the tool bars or the buttons are going to appear instead of these two bars now forced to be able to add these tubers, by the way, we had to change the theme and the theme if it's going to be applied to all the views, can be said directly from the manifest, which is in the case. In these application I have opened, the manifests have navigated to the source tap in the bottom corner, and I have said the theme to be a material light with no action bar. It is important to select a theme that has no action bar because we're going to be adding the action by ourselves in the form of a toolbar. Now what am I getting this theme you say? Well, you can actually navigate to any eggs smell file and noticed that there is a theme list and you can select more themes and search for a very long list of themes, one of which ease the material like no action, more theme. So what you can do is experiment with all of these themes and find the one that suits you the best again. Try to use one that says that it has no action bar and what you have just used its name to set it back in the manifest. So in my case, I am setting the theme that material that light don't know Action bar. And that is precisely the value that I'm passing to the applications theme. As you can see, all I do is great at Android Golan style forward slash and then ride the name of the theme automatically. It will be applied to all of the XML fouls that you start to open. So by the fold that theme would be selected. That's always you can change it, but I do recommend that you select one that says No action bar. No, we have thes theme established. Let's now move forward into the next thing that we need for us to have that action bar working, which is the matter of these lecture. The first thing now I will have to do, of course, is navigate toe one off those activities where we have a toolbar and have the tool already because this tool or is the one that we're going to be using again to set the action bar, since our theme now has no action bar in those activities where we do have a toolbar, we have to say the action bar. So with a message that it's actually very similar to the set, constant view we're going to be setting that actual bar we have to do is cool to save action bar method. And as you can see, it requires the toolbar, and we happen to have a tour already. It's that simple. We have said the action or now this is not the entire story. But we're making progress now, the last one that we need ease in the new password activity, where we also have that toolbar and where we are also going to need to call the set action bar method and in this case, powers a corresponding to our. So now we're ready to start this playing those items instead of the tool bars. Now let me just close all of those files that don't currently have any new toolbar. We cheese everyone except of the CHR files and the A X email files for the passwords layout and for the new positively out. It's in these where we're going to be working still not in the other ones. And now the next thing that we need is a menu. It turns out that two bars were with menus and all of the items off the bulletins are going to be added to. These tool bars are going to go home for many years, and they're called menus because they are menus. It turns out that on Android, you can calf can like a tree dotted Barton or, more important, review familiar with it that will display different actions. And these same menu, when there isn't up space, can be displayed not instead of a menu, but instead of the toolbar itself. So the items that would define the instead of the men you can either be this plate instead of a menu or jewels displayed as the least instead of a toolbar. So let's define that too many is that we will need one that will display a safe Borten in the new passwords layout and one that will display a new bottom instead of the passwords layout. For these, we will have to create a new folder instead of the resource is folder, just like we have. The layout folder will carve our own folder that is Gold Menu and the tea things out of these folder. We were going to be defining those two menus. So I am going to odd a new file the type of father we want to our East an XML file so we can navigate to XML and select MT. XML file. These in particular is going to be the atthe menu. So I am going to call these at Menu, and the XML file is going to be created. Now. Have your own visual studio 2017. You actually have a menu template in that template, least, which is going to are a couple of default items instead of a menu that already exists. Board in the case of those of you seeing Visual Studio Mac, unfortunately, we don't have a template yet, but you have a template working. All you have to do is grind something like this, which is simply a menu that is going to define an android named Space XML. Name space to http colon double flashes scheme as that Andrew dot com flash a big Gay slash , rest slash android, and now, instead of these many, we can define any number of items that we need to display. In our case, what we need is one. So I will define an item that starting will need from that 100 name space to the fine and I D and we're going to define and I d just like we've been doing so far, which is blows at the forward slash. And in these canes we're going to be sitting into our item. In addition to the I. D. Will also have to define a title, which in this case is just going to say, Add, which is going to be the value that is going to be displayed inside of the menu inside of the toolbar. Eventually and finally we'll have to say it. A show US action value and the shoe a section what it is going through stylish. Whether these items should appear inside the menu or outside the menu when it is displaying outside of a menu eighties. Say that's an action. No, that's Ah, a night in Instead of the menu what you want, usually sitting here east, the value off if room This means that if there is enough space in the toolbar for an action to be displayed, then decide him will be displayed as national as a Portman instead of the toolbar and not one item instead of the menu. In case you do wonders to be set inside of the menu are all times you can set it to never or if you wanted to always be displayed us night, a meson action instead of instead of a menu. You'll said this to always, but right now we need is to say this to Eve Room. So we have this out of the way. We have to really these item, and in these menu we only need this one. So that's it. That's everything that we have to do now. I'm going to Could be the definition off these many, along with the definition of its Itim, and I am going to create a brand new menu. So I am going to a new file to our many folder, which is also going to be an MT. XML file, and that is going to be called safe menu and all we have to do. He's based where we have just created. All we have to do is change the I d, which is going to be safe item on the title, which is also going to be different in this case safe. So once I have said these men us well, what we have to do now he's assigned those new research Is those new XML files to the activities or rather to the toolbar? So these are now said, as the menus are going to be populating these two bars on both the passports, activity and the new password activity. These is going to be performed through one over reading method. But this is not the only method that we have to override. We will also have to override a method that allows us to do something after one of these items from the menu he selected. So it's a start by overriding the first method that is going to be the young create options menu. You hear we'll need to inflate the menu, so we're going to be using a method that those something very similar to what the set content view or they said action bar methods do, but what we're going to do is sitting a menu us or rather, our resource as the item or the sores for a menu. This is going to be instead of the menu inflator class, and we're going to be needing to call the inflate method, notice that these is going to require first an integer, which is a resource which is going to be actually very similar to what we care for. For example, the toolbar or the past words least view inside of the I. D class. And that seems we now have a menu ful door instead of the research says we Connexus through resource dot menu noticed that we do have that many class Daut and notice that we have both the safe menu and the menu. In the case of the passwords activity, we want the atthe many, and then we need to pass to what many? You are we going to be assigning that XML source in this case, the own creator Evidence menu is already receiving that menu. So we passed that value and finally we are going to be overriding another method which is going to be the on options item selected these again is going to be executed every time one of the items he selected. And what is that? Indeed, we are receiving an item that we can use to evaluate Which item has been pressed. Now, Currently, we only have one item for many, um, so we would be easy to assume which one was pressed and simply navigate. But that is not the best practice. Because eventually you may want to off new items to a menu. So we should always evaluate even menu that wa selected is the one that we wanted to be selected. So let's start a hue with the admin. You where the i d? East after item. So what we can do East evaluate the i d off the item that is being received in these options items selector. So item he's going to have an item i d, which we can evaluate if it is equal to the i d that we have said as at item and what is that? It even appears in here so we can use that resource. And if it ease, we're going to be performing a navigation in these gays to the new possible activity so we can add in thes line and we're actually going to be doing something very similar in in the new battery activity. So I'm going to Kobe in these two overridden methods, and I will have to close this. We can get rid of this. We're only going to be focusing on the new part where activity now and I am going to be pasting those new overridden methods. Of course, we have to change the research that we're going to be using us the XML, which is going to be safe menu in these gays and the I D that we're going to be evaluating . Now he's safe item instead of art item, which should also exist instead of the I. D class. And we're not going to be navigating, really, we're going to be doing something else. But that is something that we will ask later, which is going to be to save a night him to the cloud. Don't forget to, of course, also at the navigation in the main activity on the click of designing Bolton to the passwords activity, although we do need to odd some other evaluations later. But right now let's just get a navigation straight then from that passwords activity we will need do not only navigate to the new password activity when that item in the menu you selected bought to the past world details activity when one of the items inside of the least is clicked, we also need to add something else in here. But we again. We will do that later. And finally we have these layout, these navigation entirely. Radio Angeles. Well, so in the next lecture, we can get started into implementing the functionality that we're going to Earth with the help of Microsoft Asher more specific with the help of the Asher Mobile APP service. 5. The Password Model: so another. We have our layouts ready, both riots and for Android. Let's get started by implementing the functionality. Now, during this lecture or we're going to do is create a class and the members for that class there are going to be used for both Android and IOS, and there are going to eventually hold all off the functionality but currently won't really have any implementation. These will have to be inside of the PCL instead of our passwords project and where we actually already have one class that we're not going to be using. So I am going to get rid of these my class dot CS file and I will want to off my own glass so I can right click the Passwords project and add a new file. The father I want to our is going to be an empty class C sharp class, and this one is going to be called password for this class will need for properties that will eventually allow us to know what a password is and inset it into the tables back in Microsoft Azure portal in the database that we will create eventually as well as read from that database and created specific items are going to be inserted. So I will start by defining a new property that is going to be of type strength and that is going to be I. D. It is very important that we have on I d. That is a string because these is how we are going toe identify the past words from each other, and it's going to be actually 100% necessary because if he doesn't have an I d just cannot be inserted because there would be no way of identifying one item from another inside of the table. We will also need another property that is going to be a string as well. And this one is going to be the password name. So here is where we're going to be saving what the user is going to be writing in the edit text or text field for the name of the password, for example, Facebook or bank account or something like that. We will also need another jet, another string property that is going to be the password itself. And finally I will call this property password value and finally ah, final string that is going to be the owner. So, of course, once we implement the Facebook authentication, which we are going to do in the next lecture or start to do in the next lecture, we will be able to know who has looked in. And we're going to get a night and the fire from those users and will be able to set out a specific password as the password from a specific owner. And these are all of the properties that we need. But we also need another couple of members. The next member that we need ease our method, a method that is going to be public and that is going to be bullion so it will return whether or not we were able to insert. So it is going to be things or method which is going to receive a pass worth that eventually will be inserted into the database every night. I'm just going to define a bully, and that is going to be successful and that at the beginning is going to be equal to force , and that will eventually be returned just so I don't have that error because thes, because this is bullion has to return a value. Eventually, we will have the functional 18 here. Another method that we need is also going to be a public method board is going to be a list of passwords. This is going to be the reef method. And it will be requesting, Ah, string with the owner I d and what we're going to be returning eventually east, at least with all of the passwords created by a certain owner. So we will have to filter or all of those passwords instead of the database instead of a certain table that were created by the owner or that have an owner equal to these owner Eddie. But that is for another lecture right now. Let's just get a using directive to system the collections the generic so we can use that least class. And I will define at least of passwords that is going to be passwords, and that is going to be initialized to a new list and that will eventually be returned like this. So these are the methods that we will be calling from Andrew down for my OS to insert new passwords and read your passwords. You can start to imagine where we're going to be calling these methods from, but we're going to be using them in the coming lectures right now. They are just ready for also start using them, calling them. But no jet Have the implementation necessary we're going to do before implementing that functionality is authenticate our users. We've Facebook in their case, so we can actually set a value for the owner when we insert the password and read from the table the next lecture, what we're going to do, ease create the mobile service to which we are going to link our application and a Facebook application. So eventually, Facebook comm billings to our application as well. 6. Creating the Azure App Service: So now we have these password class that is going to define what abouts were these and how this is going to eventually be inserted. That's what's read from a table inside of our Asher database. We have also defined the insert and the wreath methods. But what we really need right now is to connect our application to that mobile service on that is going to be actually very straightforward. The meat never gato browser right now and here I have my Michael daughter battle. You could navigate to it by going to pour. Told that Asher that come and looking with the user that you have created in the previous lectures in here, you will be able to click in the new Pazin to the left off the portal and search for the Web blows mobile option. In here you will find the mobile app. These he's a specific type of service that is going to be very useful and very well suited for mobile applications. The first thing that we need to do, of course, is to set a name the name it has to be unique because no one is that this is going to be actually, Yeah. You're out. This is going to be the name off your app. Don't ask your websites dot Net. In my case, I will just call this submarine passwords and apparently it is available. I see these green icon to the right, so it is available and then you have to select your subscription. I will select my subscription. In your case, you will be selecting yours and you will be using your $200 Fasher credit in case you do want a paid version of the APP service. And then we have two studies. The research group. You were going to leave everything as the fold greeting a new one. And by default, it's going to have the same name as the up name. And then comes the interesting part sitting the ab service plan and location here. I already have some glance created, but we, of course, have to create a new one or view. Of course, because you probably don't have any will have to create a new one. This is going to be my enemy submarine blonde and I will have to select allocation now. Usually you want to set a location that is closest to the majority of your users, in my case, because I am in Mexico and I have my only user, maybe South Central U. S. It's a good location. In your case, you have ah long leased to choose from. And remember, if you select a location that is closest to the majority of your users the time and that it takes for your application to connect to the service and for the service to respond to your application is going to be less. And finally, we have to select a pricing tier. Here is what you define, how much you want to spans or how much you need for your service. You can go as high as a premium package that is going to give you four course and 14 gigs of RAM and 250 weeks of storage twenties laws up to 20 instances and traffic manager. But this is, of course, more expensive right now. We could even choose ah, free or maybe even a shared package, which are really cheap. In the case of the friend, well, it is free. Of course. They, of course, don't offer us more chancellor packages. If you wanted to you could jump over to the basic one. Use your credit there. $200 of credit that you have that will get you more Suresh custom domains and up a tree instance says of manually scaling services and so on and so forth. Off course. At the beginning, I recommend you do start with a free package and start jumping to higher packages as your users demand right now, because this is going to be just a test. And just for me, free package is going to be enough. I'm going to select this. I'm going to click on OK, and I'm going to create this service. Once these creators, you will see a notification pop up and you will be able to go to that research that has just been created and that it just thes e CDs to create your research. Now, to connect it to your application, you'll have to find in the deployment section the quick start option here. It doesn't matter what options you select. All of them are going to give you pretty much the same thing, but let's select either someone unload or summary in IOS. Both of them are going to display three options. Three steps they're going to perform to connect the service to your mobile application. Let's jump over to the third step because it is the one that will actually connect to the application. The other two are something that we will do in the coming lectures. In that third step, select the connect and existing app and copy these first block of CO that appears that is, defining a mobile service client. These is going to be the mobile service client itself that we will need to connect to these service. Now that you've got this, it is a good practice to define it in a different class. So I'm going to create a brand new class is still inside of the PCL that is going to be called Asher Helper, and it's going to be at your helper because that is exactly what it's going to do. It's going to be a class that will help us connect to Microsoft Asher and the scene here where we will define the small service client now. Of course, currently, we don't know what a mobile service clients ease or these doesn't know what a mobile service client is, that is because we still need to add a global off back. Jess throughout this back is what I'm going to do. We strike leak in the bandages instead of these PCL and select add packages. You hear. Make sure that new, jaded Tory selected older you probably don't have any other option and search for Microsoft . Put Usher the Mobile. Look, clients. You will probably just find one option that actually says that name. There is one that also says Sick Alights Store. That's not the one that we want, and we will have to install this now. In here it is probable that you may be able to install the latest version, but just in case And because some templates use previous versions off the android and now us is the case, be safe and select the tree 0.1 points Syrah version. If you are using Visual Studio 2015 you may want to go all the way back to the tree Points Europe One Tree board for most of you, probably the trip on 1.0 will do. You'll have to, of course, except the licenses, and you will see that he wants successfully added, you'll have to repeat these with the two other projects as well inside of the packages holder always. And once you have done that, you'll be able to actually use these mobile service clients. Well, you have to do now. East are the using directive to Microsoft the window Sasha dot mobile service. So now that you're ready in the next lecture, we're going to be creating our Facebook application so we can connect it to our up service . 7. Creating the Facebook App: so we have no added a reference to Microsoft Asher Mobile Services to the three projects that we have on our parts were solution. So in the baggage is folder you will now find to Microsoft Asher and some BCL and Dot net and even some Jason references or packages that have been added to our project. So now we were able to add a using directive to Microsoft the window so sure that mobile services to be able to use these mobile service client glass, that is the finance mobile service. That is exactly the object that we're going to be using to make the requests to the Asher service Now, before moving forward and actually inserting and reading and doing everything that this application needs, we have to create a Facebook application and link it to our mobile service. So I am by here on my Astra portal and the first thing that I want to do ease navigate to my overview before anything and find the euro for the service, you will look something like the name of your service. Look at your website stuff in it and I want to copy these value now. I also want to navigate to developers to facebook dot com. Here is where we're going to be creating our Facebook application and link it with our Microsoft Azure service and, of course, later on the other way around. So first things first we have to create a new application. So in that my app stab that we have in the top right corner, we will be able to see an option that says a new app on all we have to do ese grade. The name the display name for these new up i d. In our case or in my case, it is going to be sovereign passwords. I'm going to create the up i d. Immediately, you will be navigated to your new application and in here we have to our one specific product. And that is, by the way, by default, we are in the ad product tab the Facebook log in product. So I will select set up. I will select Web. You may be confused because we are going to be using this for IOS and Android. Both keep in mind that days he's going to be handled by our APP service. Are Asher up service So we do have to say this as where and in here we are going to be setting the website the signed your l which I have Joe scope it directly from the panel in Microsoft. Asher, I am going to click in safe and I am going to clean can continue and that is pretty much what the next five steps. The next four steps are about implementing these in just create. We are not going to be doing that. All we needed to do is set up that Facebook looking that we can go to settings and keep on fighting the things that we actually need we do not need. That is a K for JavaScript. We do want to navigate to the setting step in that Facebook logging product. Here you will see an entry for us to establish a valued or out already wrecked your I. These is the your eye to which the service, the Facebook service he's going to resurrect after successfully authenticating the user. And it is going to be very important because it is after authenticating the user that we have to navigate back to a specific your I provided by Asher for the at your service to know that my user has been successfully identified Any here, I will want to paste the same your eye that I just copied back from the panel off the service. Except I will have to change this to be an http s your eye instead of just hdb and after dot net, I will have to add 1/4 slash built out forward slash looking forward flash facebook forward slash go back and these he's going to be there. Wild resurrect. You arrive for service again. Any service that you have with the your eye that you copy from the panel blows out Logan, Facebook and call back. And of course, make sure that you say the changes. Now we have to navigate to the dash, worth off the application where you will be able to find a nap. I d and an app secret values. So first, let's start with the Obaidi. I am just going to copy this and I am going to navigate to my Asher panel. He here I will find under settings and Authentication authorization section and by D fooled this is off. So let's turn it on. Once turned on, you will see the Facebook option that you have to select where you will see that you can set the I d on the app secret themselves. So I am going to say this to up i d and I just copy it back from Facebook and I am also going to be displaying the APP secret to get the APP secret. We have to enter our passwords because it is a very sensitive information that you do not want to share with everyone. So just enter your Facebook credentials, Kobe these up secret and based it into Microsoft. Asher, this is pretty much everything that you have to do you can ignore right now, all of this a scope and descriptions because we are no really going to be using them. But just in case you're wondering, setting some off these US enabled will allow you to get certain information from the user after they have looked in. So we can not just authentic AIDS are users. We can actually get information after they looked in, for example, their email or their public profile. Even their friends etcetera. Right now we do not need any of this so I will just click and okay. And we have now configured the Facebook application, and we have now assign it to the Facebook authentication off our APP service. Back on the manager's off. That's a portal. Now, at this point, if we get back to our Facebook application and navigate to roles, you will see all of the people that can access can authenticate themselves to Facebook and actually be authenticated with this application, the summary passwords application. And currently it is probably only you, because currently on Lee, administrators are able to again. Of course, you can have administrators and developers and testers and analytics users, but eventually you want this application to be available for everyone. So anyone with a Facebook account can authenticate themselves. For thes, the application has to be sent for review so you can never get to the AB review tab. And so, like that you want to make the sovereign passwords public, you will have to choose a category, for example, for these one, we could said something like Productivity, select, confirm and then select starts of mission. You'll have to select all of the items that you will want to do after looking in right now , we don't really need anything in any information or actions from the user, but we can select, for example, to use or about me. And here you could select any other item that you want to add. Click on Add item and you will have to complete this list, for example. For this, about me will have to get some details for the average vacation will have to also view some details and you'll have to art and up I can. That is 10 24 by 10 24. Now keep in mind that these steps are optional. Onley In case you do want to make this available for everyone with a Facebook account. Meanwhile, while you test, you can just use this. Remember to sign in with the administrators Yusor Really, by just having configured the Facebook authorization and authentication with the APP I D and the up secret back on the usher up service, you are good to go. So now in the next lecture, we're going to be creating a table here on the up service that will only be available for those users that have been authenticated and we'll talk about what relationship this table is going to hold with the class that we have already created back in visual studio. 8. Creating a Table in the Database: So we have linked a new Facebook application to our APP service, our mobile APP service. It is time for us to start using these up service. And for these we will need a database because we currently haven't set a database into these up service. And it's going to be one of the key features that we're going to be using from the sub service. So to do this, the first is weight on the easiest way probably eased to navigate to the quick start menu in here. Again, you can select either someone on road someone IOS or really any other option and follow the first step, which is to get that database and what you have to do, then East select these warning and you will have to select and because currently, as you can see, we have no data connections. So when Weekly can add who will be opening a new blade, which is going to allow us to create a new database here, then all we have to do is select the type that we're going to be using in this case sequel . Davies. We're going to set some settings for these new data bases such as the name, which, in my case, is going to be seven passwords on the score, baby, I will select a target server, which is going to be a brand new server. You probably don't see any other servers available, so let's create a new one. You'll have to provide some credentials so you can again into this service. And finally, you will have to choose the location off where the server and the database are going to be located now off, or is the best selection that you can. Making here is to use the exact same one that you said when you created the service itself , because so there was again being located in different places in the planet. He's going to make the services much less efficient. It's going to take more time for day to connect with each other, so just choose the same location as your service, Quicken select, And then you can also select a pricing tier. Here again, we have to said, How much are we going to be using or requesting from the server? In this case, I will go for the free package, which is going to provide only five DT you in just a basic level of database which share stories. Of course, you can always change this and go up as requested by your users. Right now. I would just hit, apply, hit select. I will just leave the relation to be the default and I will also click and select, and we will be setting the connection string to the default as well. So we don't have to change this and finally just click on OK, the new data connection is going to be created and after a couple of seconds you will have a designation assigned to your AB service. Was that he said we can close this blade and navigate to the second step, which is to create a table a p I here. All we have to do is select no Js as the back in language select that we acknowledge that this is going to have ride Alcide contents and create that table. What this is going to do is as the bottom searches create a new table instead of that database that we have just created and the table, we are not going to be using it. But it's also going to be sitting the back and languish for our tables A p i mainly what we need by performing the second step east to initialize the app back in service which is going to be using no Js In our case, we're not really going to be coding any JavaScript any no Js code. But eventually Eve, you wanted to This is the language that would you want to be using. You could also select C sharp, but that is going to make things a little bit different down what we're about to see. But ive you plan on adding new functionality with the back end and you feel more comfortable doing so would see sharp. But you can do that now, As you can see after a couple of minutes or seconds, these is ready at well so we can close this blade and now we can navigate over to the mobile section, select easy tables and you will see how their east now a new to do item table that is the one that has just being created by performing dies that second step now. Like I said, we don't really need this, so I'm just going to delete this table. I will confirm that I want to delayed it. But I do want to create my own. Now these table has to be called the exact same way as the password class. He has to have the same name because eventually it is by creating instances or objects of this class that we're going to be inserting into the stable. So the way that we know to which table we're going to be inserting to ease by setting the name for the class to the exact same thing as the name off a table so they will know that this class or the subject off this class is going to be referring to this particular table . So I am going to grind the exact same name, which is password now, what we have to do, he said. Some permissions for insertion updates, the lead read and on the lead permissions currently said to allow anonymous access bores, we are now going to be authenticating and users through Facebook. So since we're going to be authenticating our users, it is probably a good idea to change this permissions, For example, instead of allowing anonymous sex, says we should need authenticated access on Lee for insertion, for updating, for deleting, for reading and for mobility. So now these table in particular is only going to be accessible in all of its permissions by authenticated users. I'm going to click on OK, I'm very quickly. This is going to be created. So now we have the stable toe which we're going to insert and from which we are going to read boards. Now that we are requesting authentication, the next step is to actually a syndicator users. During the next lecture, we're going to learn exactly how to do that. How to authenticate users through Facebook with the help of the service that is now connected to that Facebook application for both our U. S and Android summering projects. 9. Authenticating Users: So we have now created a new table instead of for new data days for the app Sary's that we haven't Asher that is Onley going toe work for authenticated users. That means only authenticated users will be able to read Insert the lead update on the lead at Sera from thes stable. Because we have said so for these, we have also created a Facebook application that is already connected to our up service and that is going to help us authenticate our users through Facebook. So now during this lecture, it's time to do exactly that. We're going to be authenticating their users. This will require a couple of things. One we need to set a couple of things directly from the APP service. And second, we have to implement the functionality inside of her IOS and Android project. There are going to be a scintillating our users. Well, it's a start by sitting the necessary things here on the up service and you only a real thing that we need now is to navigate to again the authentication and authorization top in the setting section, and this time, said an allowed external redirect your l what this is going to do. He's creates a Ural or perform an navigation toe. A certain resurrect Eurail wants. The authentication has happened. So imagine it this way. We want to authenticate with Facebook, and we make give navigated away from the application over its to the Facebook application or to a browser to authenticate with our Facebook credentials. After that, we get navigated back to the application, right? Well, actually, the Facebook application, remember, is going to be redirected to rul the your L. A. We said back in that configuration, so we would be redirected to another u R L after authenticating with Facebook what we have to do ease by setting an external rhetoric. You're railing here. He's said, the Usher Service to open the application to actually read erect back to the application. So the flow would be application to Facebook, Facebook to the up service and service back to the application through these red irregular around. So it's in here. Well, we have to set it now. This is going to have to have a very specific format similar to hatred to be we're going to have in my case, for example, passwords. And then we will have colon, double flash, and then we have to go right e c south dot Colback And this is going to be our rather regular al. So make sure to couple days because we would have to tell both our android and IOS applications that when these your alleys gold from the device, those applications are the ones that are supposed to be opened. So let me save these changes. And once these are saved, I now have to navigate Dr Visual Studio here. We already have the main activity, and if you control classes from where we are going to be vacating our users. But first, let me tell both e and road and iris applications that we are going to be reopening the application wants these redirect Terrell, he scold. So in the case of Andrew, what we have to do is open the manifest that is inside the Properties folder, and we have to navigate to the source instead of the application tack. We have to off these code basically what we're doing here, defining an entreaty taft to a type that comes directly from the mobile services, and we're going to be sitting ah, launch both to single top and in no history to true. So whenever we get navigated back to the application, there is no navigation history. So if we press back, we're not going to be navigated Two different activities, but the main histories instead of the interned filter. And we do have an action that is going to have to be view a category that is going to be default and another one that is going to be Brossel. But the main information in here is in the day attack where we're going to be setting the scheme and the host, if you remember. We have just said back in Microsoft, Asher that we're going to have a passwords call on double slash easy South daughter Colback . So this is just the exact same thing Joseph relating to this scheme that is just going to be passwords and the host that is going to be what he's after visa scheme. So this is now going to be telling the 100 application to be opened. When and thes scheme and host are being called, which is going to happen from the top service from a your l'd corresponding to that APP service once the user has been authenticated from Facebook to do the same thing in the U. S. Will have to navigate the Evo Dog policed file and open it here and to the bottom. You will see three taps on. We have to navigate to the advanced tab where you will see Ah, you're al types section. Here is where we want to add a new your l type. So in here we will have to stay the night into fire, which it doesn't matter what it is right now. We'll just go late, ALF. But the U. R L schemes has to be the exact same one that we have just a non drawers and most importantly, back in the actual service. And that's it. That's pretty much everything that we need to do to make thes two applications ready to be opened once we have being successfully authenticated. Now, the next step would be to actually sign in to perform the operation that will authenticate our users, and that is actually very straightforward. The first thing that I want to do is open the actual helper class and I will want to copy these mobile service client that we have to find. Now I'm going to be the finding the same one inside of the main activity and inside of the view controller, both classes from which we are going to be performing the navigation and the authentication . Now, this doesn't mean that I won't be using the one that is the finding inside of the Azure help later. That is exactly the one that I will want to use when I insert and read from the database from the past worth class. Right now, I will use days to perform some platform specific operations through the mobile service client that wouldn't be available if we were to use it directly from the actual helper. So of course, I will also need to add the using directive to Microsoft that window sash er, the mobile services. And this is going to happen on both the main activity for Android and of you controller for IOS. What we have added this. Now we can perform the operation and it's a simple method. Call for the mobile services logging a sing method And what is that? In the case of Andrew, there are six overloads, the one that we're looking for he's one overload that starts with a context then requires mobile service with Indication provider. And finally your eyes came. So first we pass it context, which is going to be this us most of the times landlord. Then we will need to pass a mobile service authentication provider which has a Facebook value. That is the one that we're going to be using right now, since it's the one that we have Josette. And finally we're going to pass a string with the your eye scheme which, remember we have Joe said as well. On the manifest, which is passwords now is an ace in methods. So we will have to await this. And that is why I have said these signing Bolton underscore Click method to be facing us well, and when I want to do is try the execution. You've no exceptionally strong the passwords. Activity is going to be started. Well, why? It will be catching an exception and we will simply do nothing. You can, of course, at the toes display toes, display a message, anything in here right now this is the simple way off looking the user in and the same thing has to happen. I'm not us. But here I will need another thing. We'll also need Bullen that is going to be called, has locked in and that by default is going to be equal to force. And I will get into why we need this in just second. Right now, there is another thing that we have to do and that is to create and even hinder for the click of the signing bottom. Of course, the event is not called clicky schooled. Touch up inside. But I create event Jota. We've been doing so far, which is by creating a new method. It is from these method from where we want to do the exact same thing. We want to access the mobile service and cool the logging facing method. This time noticed that we have 14 overloads, the one that we want. He's also the 3rd 1 which requires first of you controller scenes. We are inside of you, Controller. We can pass this. Also requests are mobile service authentication provider. We are also going to be passing Facebook and it is also going to be requesting on your eye scheme which is still going to be passwords again. We have to await the school, and so I will be making these method amazing method. I will also want to art try cats block so the program doesn't abruptly. And if we find an exception and what I want to do ease, perform a sag after we have executed this. So what is going to happen right now? Ease that if we open the storyboard file, the storyboard file is setting a navigation by default after selecting or pressing the load in Bolton. So because we added a sec from the log in Bolton, a navigation with narrow, we're going to be automatically navigated board. We are also going to be executing this method what we want to do. He's prevent that the default on the navigation on on Lee navigate after we know we have successfully logged in. So in here what I want to do, he said, has looked in to be equal to true. In case we catch some exception, I will say this to false and after sitting days, I want to perform at the SEC again. Now you notice that we will need a night in the fire, which I haven't said So I'm just going to define an empty string for just a second, and I'm going to define these as a center. Now let's get back to the storyboard and said that Identify here. So if I select the SEC, these arrow noticed that we have on identify your option or a property that we can set that I have, Joe said to our say, I'm going to copy, Decide on the fire that is going to identify these particular say, and it's the one that I want to pass to the perform sex. So in these view, controller, we have access to that sex because it is the origin of this head. And in case we have more than one sec, it is very important for us to have this happen to fires, because that way we know which sector perform now, even if we only have one said, we do need to pass it to this method board what we also need to do. He's override the shoe old perform SEC method. These also requests on Second in the Fire, gets a second in the fire and will return a Boolean off whether or not we should perform the set. So I believe you know where this is going. We can evaluate if the SEC I think the fire is equal to that outset. And if it ease but we want to do is return the cast. Look, Dane volume. So just picture this scenario where we have more than one sack coming from the view controller, we are only going to be returning the house looked in value ive The sec that is going to be performed is the outset, and the other SEC is just going to have the basic default functionality coming from the base glass board. If this is the outset when we want to do is return has looked in which by default is going to be full. So if you think about it the first time, the default first time this is going to be fools. And only after calling the performance a after has looking has been set to true. Is this going to be set to true and ease the say actually going to be performed on were actually going to be navigating to the next view controller and that's it. This will actually get you off in the KT deny us as well board. What is going to happen here is that when we called the Logan a sing method and you we know he's going to appear something that we don't even have to code or anything. He just comes with the mobile service and we're going to be navigated to the outpatient Facebook so we can looking with our Facebook credentials, we can authenticate and everything and we will be redirected to the ready regular ride that we said and that he's our mobile service and then that is going to redirect to the core back that we said bought on the IOS application. We are not going to know when this happens, not with the code that we have at least so far. Well, we have to do. He's open the AB delegate and likeable of things. First, we will need to in the Finnish launching method that I call to. They need method off the current platform. Now the Quran platform class comes from Microsoft, the Windows Asher than mobile services as well and calling days. He's going to make sure that your application is entirely ready to start making requests to the mobile service The next thing that we have to do is defined a function that is going to receive our your URL and that is going to return a boolean. I am going to call this resume with your l and we will need to are the using directive to the system name space. This is going to be useful in just a second because we will need to override it. Another method. Notice that these class casts our Lord of overriding a method that actually don't really have an implementation bore. We do want to override get another method with cheese in the open you r l method and notice that the returns Bullen we want to doing here ease return Another thing not just the base returned the vase functionality bought whether or not they're assume with your al is different. The no and what value returns after calling it with the Eurail days being received right from the parameters off the open your own method. So basically, these method the open your l is going to be executed every time we open the application again or the application is opened again from a Ural, which is going to be the case after signing in with Facebook and we're going to be calling . There is a mural with this u R L and we're going to be noticing with the bull and variable that is going to be returned by this method, whether or not the navigation was successful. But we're also going to be evaluating something else that we have to set right before performing in the separation. They're looking a sing. So what I'm going to do he's access from the AP, delicate that resume with your AL function and that is going to be equal to an evaluation off. Are you a rail off? Whether or not the Urals scheme, he's equal to this chemo for application, which is passwords and something that is going to come from the mobile service that it happens to be called Resume with you or Al and that is going to receive these euro. So if we are successfully being navigated back, resuming with this Eurail with the help of the mobile service and the scheme is passwords, which is the one that we've been using, these is going to be set to true because we're evaluating if this is true and if this is true, otherwise is just going to be set to false on. DSO are open. Your own method is going to return falls, so that's pretty much it. Now, after actually logging in with Facebook, we are going to be read erected here and we will be able to see Eve. After looking in, we see the Yusor. So now when we run this application and this would happen in Andhra as well Genk leaking designing with Facebook bottom. And these will open that view that I was talking about, that we didn't even have to our which is a weapon, and that is that he'd eased a rating, goes to facebook dot com after briefly navigating to our service What we can do here. He's looking. We are Facebook credentials, and once we have done that and notice how we automatically get navigated back now I hear I said a break point before actually performing the navigation to the next view controller because what I want to show you, he's what is inside of the mobile service. So if I cover over the mobile service and I expanded notice that we have a cure in user property and the Korean user property is going to have I use her. I d these user i d is the one that we will want to use. Let me just hit continuing here when back in the past Worth class Remember that we have these owner property. These owner property is going to get its value from that user i d. So we let her own can identify which you, sir He's inserting, reading, etcetera And that s actually going to be very see because he will now be instead of the mobile service itself. Finally, you can see how we indeed were navigated to these table view controller. And we have this plus icon and everything we have successfully then executed Dial performed sack to the correct view controller Now that we have these, then in the next lecture we're going to learn how to insert new items into our table so we can later on read them and filter them by user 10. Inserting into a SQL Table: So we're now successfully navigating with on already authenticated user to the passwords stable view controller. And from there we can already easily navigate to the new password the controller. So the functionality of these new part will be controller is the one that we're going to be implementing in this lecture. We already have the passwords name, text field and the password text field as well as the Save Barberton item. So all there is left Rose to do release just haven't even 100 for when these button is pressed greed, a password object and inset it. So let's do that. And if you control the itself where I want to create even Candler Easy. The overreaching view did load method in here. I will get that safe Barberton item and create an even candor for its clicked event. Remember that this is not important. So the collective and is the one that we want to use the reason such thing as that are trapped inside. So it's in here. We want to create a new password object So I will define guys would that is going to be equal to a new password and own creation. I will assign the password name to be equal to what is greets in instead of the password named Text Field by accessing the text property. And now the attacks were value. He's going to be what is greeting the inside of the password text field, of course, again through the text property. Now, to insert this, it's actually going to be very simple. Not remember that interview controller. We already have a static mobile service that actually already contains the value for the user I. D. The current user that has already looked in and that also has a get table method They get Table method also has a generic overload, so we can set want table we want to get and once received these table, we have the insert a sing method. I noticed that because we are accessing the generic version off the get table method, the insert, a saying, is going to be requesting a password so we can pass that password itself. And because the insert a sing is, well, a synchronous, we can await it and we can. We have to make these method a sink. Now there is one thing that we're missing currently, and that is the owner for these passwords. And that again he's going to be instead of the view controllers mobile service which already cast occurring Yusor and the user has a user i d which is a strength that he's exactly the type off the owner variable. So there you have it. I am going to set a break point right after this is executed and I will also said this inside for try cats block just in case something unexpected happens the application dozing crash on. I am going to be just catching any type of exception. And when I test this, I want to see when this brake point is hit. So we know that this has bean executed and we can navigate to our azure portal and see if these were successfully inserted. Now we can do the exact same thing back in Android. I am going to open first the new bus worth activity class where I actually already have these options items selected method that is going to be executed whenever one of the items on the menu is selected breast and we already evaluating when in the item I d is equal to the safe items sweeties from here from where we want to do something very similar to what we have just on. In the case of Andrew, it is from the main activity from where we will be accessing the mobile service. So first things first, we will need to create a new password that is going to be equal to a new password and that on creation is going to have a value for the password name equal to that off the past, Worth name, any text of text. Then we will said the password value to be equal to pass worth edit, text the text. And finally the owner is going to be coming from the main activity where we have the mobile service which of course, also has occurring Yusor and the use of I d and finally Georgia within the US We will call in this case from the main activity the mobile services and get table method, getting its generic password version and calling the insert a sing method passing and that password that we have just created. You'll need to set this us A sing as well because we will be awaiting these method. The insert a sink now because we are awaiting something and this method is a synchronous. The method will have to be a task off bull and to be able to use the task class we will need toe are the using directive to system, though thriving though tasks. But actually there will be something wrong with this. This is the general functionality that we would have to add Board are on options items, selected East note, a method that we created. He's a method that already exists, and it has to have the same signature as its parent, which returns that bullion, not a task of bullion. So this is very straightforward to solve, or we can do these create on a sing method this is going to be facing that is going to be void and that is going to be insert and this is going to receive a past wars. And it's easy inside of these method form where we want to call the insert a sing method and back in the on options items selected. I will return this to be just a bowline, so we will not be an a sink, but we are going to be calling the insert method passing the possible that we have just created. We don't have to await this because it is void board from the intermittent. We are correctly awaiting the insert, a sing method so that is, in its justice, easy to implement a functionality again. This functionality will work the same on Unload and I Us. Now let's try this. So, of course, the first thing that I have to do e singing with Facebook again. And after that we have to, of course, navigate to the new password view controller. He here I am going to say they random name chose new password. I'm going to say the password just for your information, to 12345 I am going to click on Save and I should heed one of my break points, one of the break points that I have set. And once they have heat that break point, I know that either it was successful inserted or something bad happened on the catch was executed because an exception waas drone to make sure that it was successfully executed. I am here in my portable Microsoft. Asher and I can open my table the one that I created previously, I noticed that I do have a new password. The possible Tamimi's new password on the values want to treat for five jewels like I said before. But notice that I also have that owner said to the I D that I had us the use Raidi, after authenticating with Facebook along with the idea that I, that is also said by default and for other columns that are said by default. So now we have successfully inserted into the table, and we are also able to differentiate each and every one of the past wars by user because we now have these owner said to the user, I d now, as you can see, I am the really reusing cove. Right now, I have said the same functionality both in the view controller and in the main activity. What I want you to do is to think about a way in which you can solve these co that is being repeated. I want you to think about how you would reuse thes code from the PCL or in some other way and post your solution. Ah, long way. It may be a book of code that you created on where you are did it in the discussions for this lecture. So now that we're inserting the next step east to read from the table and that is exactly what we were going to do in the next lecture 11. Reading from the SQL Table: Currently, we're already successful inserting new items into our database back with Michael Natasha. And now that we're doing these next natural Step East to release items and to enlist them either on our table view or on the least view on Android here in the password stable the controller there are a couple of things that I will need. The first thing is to define a list off passwords that is going to hold precisely all the passwords. Eventually that I will be reading, of course, to be able to use the least class we will need toe are using directive to cyst them indoors , collections da generic and is at least he's simply going to be buzzwords individual load. I want to initialize the value of these new variable. So there's one is simply going to be a new list. The second thing that I need East to override a couple of methods there are the ones that we need to populate the table view, and you already know this, But let's override first, the roasting section method, which is going to return the amounts of rose are going to be displayed in this case. We're simply going to return the count off elements instead of these new least variable. And the second method that we have to override ease the good sale method. Now for us to be able to use these methods because we're going to be reusing sales, we need to open the storyboard one more time. And the signs are re use identifier to the sale that we have the fine instead of the stable of you controller. So here in that table view, all I have to do he still like the sale? Make sure that you are selecting the cell on You can test this by going to the properties and watching that the U I table view cell East said at the class. And we will need to say it and I don't the fire to this. What is that it? He said, As we use item to fire, these is going to be password cell and I'm going to cope with this value because eats the exact scene value that I have to use back in the table view controller. So here on the get cell, I am going to define and you sell that is going to be equal to Table V, the Q reusable cell, which is the method that is going to get a cell from a Q off reusable cells for us to start using it. And this, of course, needs theater in the fire of what cell we're going to be re using in this case, which is the password cell and finally is going to receive. They ain't Expand Variable, which is being received as a parameter off the get cell method as well. With they sell. The next thing that we need is the data that is going to be displayed or the password that is going to be displayed in this case, which is going to be coming from the passwords list in the position corresponding to the index paths row. So, if you remember, then expanded contains both row and section. Seems we only have one section. Currently, it is okay for us to just access the row itself. But if we had many sections who have to first evaluate in what section we are in on, then access the row itself having the password, then we can access the cell and said east, it's text labels text to be equal to the pas wards, vase, ward and name. And that's pretty much it. Off course while we have to return is the cell that we have created No, the default functionality. And this is how we're going to be populating the table view. But we are no reading from the database yet. When I want to do East override another method, the method is going to be called view did appear and that is going to be executed, as its name suggests, when the view appears in the recent way, I want to use this instead of the beauty load is because of you. Did load will only be executed the first time we navigate to these view. So the first time the view loads And if we, for example, navigate to other new passwords and then get back the view did load is not going to be executed. The view did appear ease so engaged we never get away from this view controller and the least, or the source changed. Either we deleted something, we added something. We edited something and navigate back David appear will be executed and we will be able to have the new data so here. What I want to do is assigned to passwords. Let me I says from the view controller, the mobile service and cool the gate table method. I will still beginning the password class for us to read the password table. And I am going to do at to least a sing method Coal. So we are actually going to be getting whatever ease returned by the get table ass out list now, because this is a sing. Of course, I will have to await this. So I will have to make these methods a sink. And now the passwords viable is going to contain all of the items from the table passwords that are now going to be displayed into the cells. Now, as you remember, what we also have to do X East access the table view, and we load the data now. So far, we are really getting all of the passwords. But notice what is running here. We're getting all off the passwords. We're not creating any filtering here. So if many users were toe other passwords in here, this would be terrible, because we would be able to know what their possible tar we have to do here, then, is filter what we're going to be getting. So notice that we can access aware state many here after getting the table and what is going to happen here. He's telling expression, which he's going to be very easy to create. He's going to be sent to the mobile service so very soon. National filter going on. And here is where we are going to be creating on expression that, while easy to create it has the same tax a little bit different to what we've been used to . Basically, we're going to be defining a variable which is going to be in this case is P for password. Then we have to grise equal and greater than two week week like this arrow and filter by the owner. So we're going to be getting the items where the owner is equal to something. And that's something, of course, ease inside of the view controllers, mobile services, curing user, and the current user has that use a righty. So in here we're still going to be accessing the mobile services curing Yusor, and these one is still going to contain that use writing because we have authenticated the user. And so we will want to filter the passwords table where the owner, he said to these particular use righty. And so we are now reading. They create passwords on Lee from the current user, and this is everything that we have to do on IOS. Let me just copy this code because he's going to be the exact same code that we will need in the passwords activity to populate on these view back on drawers. So again you hear, I won't want to override another method that is going to be the only resume method that is going to be doing something very similar toward the view did appear Method doors in comparison to the own create method. I will also need to define first at least off passwords, which is going to be cool passwords, and that I will initialize on the own create right after setting the view. So passwords is going to be equal to a new least of passwords and on the UNR assume we're going to be assigning to these passwords variable these same method that we have gold back on us. We'll need to make the own resume a sink. And in this case, there is no view controller, of course, but we do have the main activity, which also has a static mobile service property. And that is the one that we want to ask to call the get table and to get the curing users use writing now, after receiving these what we have to do, by the way, we also now have that Elise View ease access the past wars, at least view, least adapter, rather really school just adapter. And this is going to be equal to a new Are you a doctor which is going to first received the contacts, which is going to be these. And then it is going to require a research which is going to be inside of Andhra Ord Resource toe layout, and we're going to be using the simple least item one. Now, from these one to this one, we're going to be passing the past wards as the source. Now, if you think about it, each password east, a complex object and the simple least tighten one only has one label, and of course it doesn't. Even if it has more labeled, it wouldn't know where to put certain information from the past ward. The easy way around this is to simply open the passwords class rather the password class, and override the method that will be called to display in these single label. And that is the to string method. What is going to happen in here is that scenes these views, in thes least view, doesn't know how to display a complete password. He's going to call their to string method, and then here. Then what we can do, it seems, return the past worth name and that it now, even if it doesn't know how to display it. And it goes and calls for the two string method it is now going to believe playing the same thing. Asked on IOS for this well hidden test this out. So here I have the application upon running again, and I have Joe signed in. What is going to happen is that we are going to be reading from the table and the date at which she's currently just the name of the past Word will appear. So you haven't just like these. We're now reading from the table and displaying all of these elements and since we have now inserted as well. This is everything that we had to do. We can now, for example, are a new password by navigating to a new password view controller and setting a name, for example, these one just to differentiate it for the other one is going to be That's worth two, and the Valley is going to be a is the f. D. I am going to click on safe and currently we're not doing any evaluation or anything once this has been saved. But we can head back on because we are using the beauty appear we're going to be reading from the table again and we can see now the password, too. So that is almost all of functionality of the application. The next lecture. We're going to learn how we can select one of these items and after navigating to these new view controller, actually display the value for the selected item 12. Navigation to a Detail Page: So we're now also reading from the table and this playing a data into the table view. Now US and Elise View on on road. The next thing I'll have to do is navigate from that least over to the past worth detail of you controller or the password detail activity in here. If you remember, we already have one label that he's supposed to display the past would itself. So when the user selects one of the passwords in the least, they get navigated into these view to display the password. So let's implement this functionality. Now. The first thing that we have to do in case off the RUS project is to set an identifier for these sex as well, just like we did back in the safe that navigates from the view controller over to the passwords stable. The controller This one is going to be requiring on it in the fire. In this case, I'm just going to call this details. Hey, and I'll just make sure that I cope It is value so I could arrive when I write it down back in the past, words stable view controller There is one simple thing that I have to do board. Actually, before doing that, I need something else. In order for us to be able to pass information from these view controller to the password details you control her. And that is that in the past, would detail view controller, I will define a couple off public string variables. The 1st 1 is going to be the password value, and the 2nd 1 is going to be the past worth name. And these have to be public because we are going to be using them back in the password stable, the controller and the place where we want to use them. Ease in an over reading method that is gold. Prepare for set. So these method is going to be executed right before the SEC happens. And as you can see, we are receiving a set when I want to doing here before calling the base, prepare for segmented. He's evaluate if the sex I didn't fire is equal to the identifier that we have. Josette, which in my case waas detailed say so. In this case, we do need absolutely need this had in the fire because we have to sex originating from these same view. And only in the case of the second set do we want to do the full away. We want to get the destination view controller, which is actually going to be instead of the say itself. So notice how the SEC has a destination view controller. Now, in the case of these second particular we know that destination view controller, ease the past wars in detail of you controller and so we can convert or use these destinations. Controller Ah said past war details you can for her. And the reason why we need that is because now the destination view controller will have access to the password name on the past worth value. So we can said this values. Now the thing east want, are we going to be sitting these values? Well, we're going to find a new pause worth that is going to be equal to passwords, which is the least of possibles that we have in a particular position. Now what position? Well, we have the table view property, the table view itself, which is going to have and index path for selected row, which again is going to have both a row and section we have to do is get the row itself. So in expire, for selected row is going to have the position that path off. What row? What cell has been selected? Remember that we are going to be executing these, say when one of those items instead of the table view is selected. So we know that some table from sale has been selected in here. So now we're going to be using this and more specific. It's row to get the password. And so now, as he see as getting the destination of you controllers password volume, we're going to be assigning it to the password that we have just received and eats password value property. And the same is going to be for the buzzword name and so pass worth door passwords name. He's going to be the value that we pass, and we continued execution over the prepare for set. Now the next thing is to navigate back to that past war detail view, controller, and when I want to Dewey's override, the View did appear, which is going to be executed again every time we navigate to these view and because by thes time, the password value on the password name we already have value. I am going to set the label, which is the password label, to have a text equal to the pas word value just like this. And I will also want the navigations, the navigation items title to be the past wars name. So not only are we going to be setting the value into the label that we have, but we're also going to be changing the title which currently he set to be an empty string and that it This is everything that we need to do on IOS. So let me now close these that we're no longer going to be using and never get to the passwords activity to implement the functionality. An android in here. It's going to be very straightforward as well. We already have these item klieg where we're already starting the password details, activity, but we're starting is right away. What we need to do to pass on value is create an intent. So I am going to create these new value which is going to be equal to a new intent that is going to receive this as a context and the type is still going to be buzzword details, activity. And now it is this intended one that I have to pass through the start activity method. Of course, it is not everything that I have to do because these would execute the exact same thing that before we have to do ease to intend put a couple of extra's. So we're going to be using that put extra method, which is going to have 24 overloads. One of them certainly is going to require a strength. Now. Notice the first parameter because the first primary is always a strength, because it's going to be the name off the extra. In this case, it's going to be value for the password value and what we're going to pass ease the value itself, which is eventually going to be a strength number with me. Just a second I am going to out the other put extra, which is going to be name about what value are we going to be passing again? We will have to know what I term in the lease view wa selected. Fortunately, inside of the e parameter, we have the position, so that is everything that we need because now, just like in the US, we can define a password which is going to be equal to passwords, that again the least in the position that we can receive from the e parameter just like this. And so now we can access from that password the value to pass us the first extra and the name to pass as the second on. That's everything that we have to do instead of the passwords activity. Now in the password details activity, we have to receive those values and assigned them where needed. For example, we will need a string which is going to be name and another one that is going to be value. And on the own create, we will be able to assign to the name the value that we can't retrieve from the intent with the get string extra method. The name that we have to pass for these one will be named because that is the one that we said back in the passwords activity. If I remember correctly indeed its name and value and the same thing for volume just of course, we're going to be using assigning this to volley variable on using a different name for the extra having these values. Then we can access the paths worth text for you and said he's text to be equal to value and that it if you wanted to, you could also said the name somewhere else. Now I will just have the value being said to that text for you. And so we are now able to If we run this navigate to a details view and see the past world from the selected item and we contestation this simulator to, for example, select the new password, we get navigated. I notice that we both see the new passports it as the title and the value of the password said in the label, and we can get back and so the password to and we see password to us, a title and the password itself in the detail label. So there you have it. We have now completed the section and you are now able to read and write to a table inside of ah database that we have in the mobile service. And we have also used that mobile service and a Facebook application to authenticate our users. Now in the next lecture, we're going to address a very important issue. That is, that currently, are iris application on Lee looks well on the screens. That would assign the application for notice, for example, are signing base our view controller. That looks okay. Right now in the iPhones explores. And it looks okay when we run it on this. Explore six explores for implosive plus etcetera. But notice what happens if we were to run this, for example, in the knife from six. Look at the bottom. It looks off now. It's even wars. Who we were to run this one knife from five. The border needs now come. So this is the problem that we have to address in the next section.