You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -367,7 +374,7 @@ As a final step, we're going to allow the users of our app to log in using email
367
374
We have two `EditText controls` under each other, one for the user's name, the other for their password.
368
375
The rest of the popup will be handled by a stock Android dialog.
369
376
370
-
[screenshot:dialog_signin.xml (or maybe the design view)]
377
+

371
378
372
379
4. Since our app will display the sign-in dialog as a popup, add the handling to MainActivity.java:
373
380
@@ -396,11 +403,11 @@ As a final step, we're going to allow the users of our app to log in using email
396
403
397
404
This method builds and show the dialog, with our two text boxes as the main body.
398
405
399
-
[screenshot:login dialog]
406
+

400
407
401
408
When the user clicks OK, it extracts the email address and password from the text controls.
402
409
403
-
[screenshot:login OnClickHandler]
410
+

404
411
405
412
5. Now wire the values that we got from the dialog to the Firebase Authentication back-end. Replace the `TODO` with the following code:
406
413
@@ -419,15 +426,15 @@ As a final step, we're going to allow the users of our app to log in using email
419
426
420
427
Either way, we next call `authWithPassword` to authenticate the (pre-existing or just-created) user.
421
428
422
-
[screenshot:OnClickHandler with the login behavior]
429
+

423
430
424
431
6. With the above we have the registration/login flow working. But we still need to listen to when Firebase Authentication tells us the user has been authenticated, so that we can store the username and use that in the chat message instead of the hard-coded value we have now.
425
432
426
433
Add a field to the class to hold the user name:
427
434
428
435
String mUsername;
429
436
430
-
Add the end of the `onCreate` method, add a callback method that listens for authentication state changes in Firebase:
437
+
Add the end of the `onCreate` method, add a callback method that listens for authentication state changes in Firebase:
@@ -445,15 +452,15 @@ Add the end of the `onCreate` method, add a callback method that listens for aut
445
452
446
453
Firebase calls our listener whenever the authentication state changes, so whenever the user logs in or out. When the user logs in, we store their email address in our field and hide the login button.
447
454
448
-
[screenshot:authstatelistener]
455
+

449
456
450
457
Firebase Authentication supports multiple authentication providers and each of them exposes a different set of data. For example, if we'd allow our users to authenticate with their existing Twitter account, we could identify them by their twitter handle.
451
458
452
459
7. Finally, replace the hard-coded username with the field we just populated:
We could definitely improve the layout of things. But this step has been long enough as it is. So let's wrap up with a few notes.
459
466
@@ -465,7 +472,7 @@ Add the end of the `onCreate` method, add a callback method that listens for aut
465
472
466
473
9. If you want to know which users logged in to your application, you can find them in the Login & Auth tab of your Firebase's dashboard.
467
474
468
-
[screenshot:auth dashboard with some users]
475
+

469
476
470
477
This is also where you can configure the password reset emails that you can send to your users, in case they forgot their password.
471
478
@@ -475,7 +482,7 @@ Wrap-up
475
482
476
483
Congratulations! You've just built a fully functional multi-user chat application that uses Firebase to store the data and authentication users.
477
484
478
-
[screenshot:app]
485
+

479
486
480
487
As a reward for finishing the codelab you’ve earned a promo code! When you’re ready to put your Firebase app in production, you can use the promo code `androidcodelab49` for $49 off your first month of a paid Firebase plan. Just enter the code when you upgrade your Firebase.
0 commit comments