Firebase Auth

Why is my current user equal to null?
Why is my current user equal to null?

If I had to hazard a guess about the most frequent point of confusion when starting with Firebase Authentication, it would be the currentUser API. While it seems simple enough to get an object representing the currently signed in user, there is one hidden complexity.

Auth state seems binary: null or non-null (or is it?)

Here’s an easy enough bit of code in JavaScript that checks to see if a user is signed in:

const user = firebase.auth().currentUser
if (user) {
// user is signed in, show user data
}
else {
// user is signed out, show sign-in form
}

Here’s the equivalent in Java:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();
if (user != null) {
// user is signed in, show user data
}
else {
// user is signed out, show sign-in form…

The Web Accessibility Content Guidelines (WCAG) 2.1 recommendations explain the success criteria for making web and mobile apps accessible to people with disabilities. The guidelines are pretty straightforward, but can be difficult to eyeball, as they make very specific requirements about the visual qualities of text and other on-screen elements. As someone without any recognized disabilities, I find it difficult to spot potential problems on my own, so it’s helpful to use tools to point out where they occur.

If you don’t know if your app is WCAG compliant, it probably isn’t. Here are three tools that help you get there. Note that these tools do not certify an app for WCAG compliance — they merely help spot certain issues that are possible to assess using Android APIs.


Cloud Functions for Firebase and Node.js logos
Cloud Functions for Firebase and Node.js logos

You might have heard that Cloud Functions supports Node.js 10 since May 18, 2020 and has deprecated Node.js 8 since June 5, 2020. And in the Firebase console, you’ll notice this message:

Node.js 8 has been deprecated.

- Starting Feb 15, 2021, we’ll no longer support new deploys or updates of Node.js 8 functions.
- Starting Mar 15, 2021, we’ll no longer support executions of existing Node.js 8 functions.

Read more about the deprecation in the Firebase FAQ.

So, if you’re running functions on node 8, it’s a great idea to take some steps to migrate to node 10 very soon. Fortunately, it’s pretty easy. …


Wikipedia web page rendered for portrait, but shown in landscape
Wikipedia web page rendered for portrait, but shown in landscape
Having trouble reading this? So are some of your users with disabilities.

If your app provides a public service in the US, ADA Title III law says YES. The required WCAG 2.1 level AA guidelines forbid locking orientation to portrait. Here’s what you need to know.

One historically problematic issue with development on Android is support for landscape orientation. Developers often loathe the extra work involved, or neglect it entirely. Now, that’s no longer a (lawful) option for some apps.

Android, at the platform level, was designed to put apps through what are called “configuration changes” in order to allow them to best adapt to specific changes in the device’s environment. The most common configuration change is an orientation change — switching from portrait to landscape and back. (It’s actually a lot more than just device orientation. …


In this edition of our mobile accessibility roundup, we have some tips from the BBC, a call for more accessibility in health care apps, and a huge upgrade to Google’s Voice Access in Android 11.

8 tips to guide accessibility in apps and games

Accessibility is often left as an afterthought during the design and development phases of mobile apps. This just doesn’t work — it needs to be taken into account from the beginning in order to make sure all are included. Read these tips about how the BBC organizes their efforts for their apps.

Title: Building apps for everyone: discover why inclusivity and accessibility truly matter
Authors: Ceri Lindsay & Rosalind Whittam
Published on: May 27…


In my last post, I discussed some ways to make sure your app’s design handles text with variable length and font sizes. This is a good starting point, however, for the legally blind, no increase in the size of text will help them read that text. Your design should also be accessible via a screen reader, such as TalkBack.

Android screen reader basics

For Android, Google provides two screen readers: TalkBack and Select to Speak. In order to see these options in the Accessibility settings, you should have the Android Accessibility Suite installed.

Android accessibility settings screen
Android accessibility settings screen
Android accessibility settings screen

The primary reader is TalkBack. It provides both accessible navigation and text to speech. When enabled, it completely changes the way the touch screen works. A word of caution: if you enable TalkBack, you will want to go through the provided tutorial to understand how to get around. Without understanding navigation, you will likely get frustrated, as the touch screen will no longer work the way you expect. I have also found Google’s cheat sheets for TalkBack gestures and keyboard shortcuts to be very helpful. …


When people say that it’s important to build an “accessible” app, that generally means that the app should be usable by as many people as possible, regardless of any disabilities they might have. The most common disabilities that affect mobile applications are vision and motor control impairments. For those with some degree of vision impairment, apps should be designed to allow for variable size fonts and screens, as well as for use by screen readers that speak the content aloud. In this article, I’ll talk first about designing for variable font and screen sizes on Android.

Always use “scale-independent pixels” for font measurement

When you’re working with TextView, you’ve probably seen Android Studio warn you when you use a font size measurement other than sp, or “scale-independent pixels”. Here’s what happens when you use dp (density-independent pixels)…


Last week, May 21, 2020 brought Global Accessibility Awareness Day. Google celebrated by releasing some new accessibility features for Android and some apps. This roundup covers those releases and more.

Accessibility affordances for disabled UI elements

The problems with greyed-out, disabled UI elements have been well-discussed in the past. And it gets worse when factoring in accessibility. What can you do instead? Hannah suggests some alternatives.

Title: Is it ok to ‘grey out’ disabled buttons?
Author: Hannah Locke
Published on: May 11, 2020
Note: Posted behind the Medium paywall

Accessibility problems with neumorphism, illustrated

Neumorphism is a modern reboot of skeumorphism, a UI design trend that looks to real-world counterparts for inspiration. While these designs are clever and attractive, they perform poorly for the visually impaired. Tammy illustrates with some simulations of what a neumorphic design can look like with various impairments. …


Even after you’ve gone through great lengths to optimize the performance of your tests, and the hardware and software they run on, you still might be slowed down by the sheer volume of tests that you have to run. At this point, to get more significant performance gains, you’ll have to shard your tests to run on multiple devices concurrently. By “shard”, I mean splitting up the tests into groups of roughly equivalent size, to run on each device independently. …


Image for post
Image for post

If you’re anything like me, you like it when there is one button to push that Just Does What I Want. When it comes to running tests in Android Studio, I like that it’s easy to configure it to run all my tests with the run button. However, when the number and complexity of tests grows over time, the actions behind that one button can take a lot longer than I’d like, especially if it’s testing application code that I’m not currently working with.

Why run all tests all of the time, when you really just want to run the ones that matter right now? Or at least just the ones that run quickly. Fortunately, the Android test tools give you a way to slice up your tests into related groups for faster testing. …

About

Doug Stevenson

firebase-consultant.com, Firebase GDE, engineer, developer advocate, Xoogler

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store