Getting Started with Firebase Auth on Android - Firecasts

Getting Started with Firebase Auth on Android - Firecasts - Hello friends Android tutorial and tips trik, The article you are reading this time with the title Getting Started with Firebase Auth on Android - Firecasts, we have prepared this article for you to read and download the information therein. hopefully fill posts article -, article android, article Auth, article Firebase, article Firecasts, article Getting, article on, article Started, article Tutorial, article with, we can write this you understand. Well, happy reading.

Title : Getting Started with Firebase Auth on Android - Firecasts
link : Getting Started with Firebase Auth on Android - Firecasts

Baca juga


Getting Started with Firebase Auth on Android - Firecasts

[MUSIC PLAYING] Hey, what's up, everybody? Laurence Moroney herefrom the Firebase team, and welcome to anotherepisode of "Firecasts.

" On today's episode,I'm going to show you how to sign in with Googleusing Firebase Auth on Android.

And from that, you'll be ableto see how you can sign in with other providers, too.

You'll be up and running withthis feature in just a few minutes, so let's get started.

The first thingyou'll need to do is to make sure thatyou have a development environment properly set up.

To get started withFirebase and Android, use Android Studio tocreate a new project.

Just accept thedefault form factors, and create one withan empty activity.

Whenever you change anyof the Gradle files, you'll see thismessage telling you that a sync may be necessary.

It's good just to sync it.

In your module-levelbuild.

Gradle, you'll need to add the classpath to the Google services package as shown.

Then, in yourapp-level build.

Gradle, you'll apply thegoogle-services plug-in.

If you sync, you'll seean error that there's a missing google-servicesJSON file.

Don't worry, that's easy to fix.

You do this from theFirebase console.

If you don't havea project already, create one and follow its steps.

Once you're done, you'll seethe project on this screen.

Simply select theproject, and you'll see the apps associated with it.

Click the Add App button,and select Android.

You'll now need thepackage name and the SHA1.

The package name is what youused when you were specifying your app, and theSHA1 can be gotten from your debugkeystore, like this.

Paste them in, andthen add the app.

You'll see that thegoogle-services JSON file gets downloaded to your machine.

Select the project view,and then open your app.

Drag the file into theApp folder as shown.

Now, when youGradle sync, you'll see that everythingworks, and you're ready to build in Firebase.

OK, great.

Now that you have a workingdevelopment environment set up, the next steps will be to builda simple app that lets you sign in with Google and Android.

You'll import therequired files, create a simplesingle-activity app, and then finally code thisapp with a sign-in button that signs into Google andthen tells your app the ID of the signed-in person.

Let's get going.

Before you start codingyour Android app, make sure you haveeverything properly set up in the Firebase console.

If you've done that, you'llsee it in the Overview screen like this.

Next, ensure that auth isenabled for your project, which you can do in the Auth section.

Select the sign-inmethod that you want.

And in this case, it's Google.

In Android Studio,check your build.

Gradle.

Make sure that the Play ServicesAuth Libraries are included.

And then, in yourlayout file, specify that you're usinga sign-in button, and you'll get it at runtime.

Then, in your code,there's a few steps that you need to follow.

First is to create a Googlesign-in options object that specifies your sign-in scope anduse this to create a Google API client.

When the user clicksthe Sign-in button, you create a sign-in intent,and the activity for that.

You can see it here.

You get the intent from the APIand start an activity for it.

Then, on the result, you'll beable to get the user's data.

You get a Google sign-in resultobject from the data that comes back from the intent.

And from this, you canget a Google sign-in account, from which youcan get the display name.

As you'll see in the demo, weget the user's email address and effectively turn it into afriendly name and display it.

Signing out is even easier.

You simply call the Sign-outAPI, catch its result, and you can updateyour UI from that.

Let's look at this in action.

Here's the appwe've been building.

We have the branded Sign-inbutton and a Sign-out button.

When we click the Sign-inbutton, we're given a picker.

You pick the accountthat you want, and then once you've beensigned in, you're good to go.

You can sign back out again,and this clears the UI.

When you sign in, you'realso given the option to add an account.

And then you're taken intothe flow to add a new user.

I won't go through that now.

I'll just go back and pickan account with the picker.

That's how easy it is toadd Sign-in with Google to an Android app with Firebase.

There you go.

You've just builtyour first app that signs in withGoogle and Android, and it only took a few minutes.

You're now ready topersonalize your app, or maybe add other serviceproviders such as Facebook, GitHub, and more.

That's it for this "Firecast.

" Please leave your questionsin the comments below, or reach out on Twitter and G+using the #askfirebase hashtag.

Don't forget to hitthat Subscribe button.

I'm Laurence Moroney,and thanks for watching.

[MUSIC PLAYING].



Thus Article Getting Started with Firebase Auth on Android - Firecasts

That article Getting Started with Firebase Auth on Android - Firecasts This time, hopefully we can give you all of the benefits. Well, I'll see you in another article post.

You now read the article Getting Started with Firebase Auth on Android - Firecasts the link address http://svedda79.blogspot.com/2016/09/getting-started-with-firebase-auth-on.html

0 Response to "Getting Started with Firebase Auth on Android - Firecasts"

Post a Comment