Search code examples
androidcredentialsgoogle-smartlockpasswords

How do I control the SmartLocks blue banner?


When the user starts the app, I'm able to retrieve a previously stored credential. When this happens, the blue SmartLock banner shows up. On the app I work on, this is covering a FAB making it unusable until the blue banner goes away. Is there a way to control the length of time the banner is shown? Additionally, is there a way to let the FAB move up like it would with a snackbar showing?

Lastly, if the user exits the app as the banner is showing, it will continue to show on the phone home screen, blocking any use of the bottom app bar. Is there a way to prevent this?


Solution

  • The auto sign-in banner is shown by Play Services and drawn over the app. The intent is to notify the user that their saved credentials have been retrieved and avoid app inadvertently not displaying or displaying the notification at an incongruous time or place.

    Right now, there is not much flexibility about it, the banner won't be in the app view hierarchy and might cover other elements, such as floating action buttons, for a few seconds. In practice, we haven't found this to be much of an issue ... many apps have put the auto sign-in at start and it shows over a splash screen and only once per device install since most apps don't need to sign users out.

    But fair concerns that if credentials might be retrieved frequently or user may interact or switch apps immediately after signing in. Do comment with any feedback/requests, examples of problematic scenarios, or suggestions of alternative UX or implementation we'll see if we can accommodate them.