Adding Splash Screen to Trusted Web Activity with Android’s FileProvider

⚠️ THIS ARTICLE IS MORE THAN 1 YEAR OLD.

Please refer to this article on how to add splash screen to Trusted Web Activities.

What is Trusted Web Activity?

Trusted Web Activities (TWA) are a new way to integrate your web-app content such as your PWA with your Android app using a protocol based on Custom Tabs.

Step 1: Add Logo

Add your app logo to the drawable folder (using Asset Studio). In this case, I set the logo size to 96dp and named it ic_splash.

drawable/ic_splash

Step 2: Create an XML file

Create a new XML file in the XML resources folder. In this case, I’m calling it file_path.xml.

Adding “file_path.xml”

Then, add the following code to the XML file you just created:

xml/file_path.xml

Step 3: Update AndroidManifest.xml

Update your AndroidManifest.xml file by adding a new <meta-data> and <provider>:

AndroidManifest.xml

Step 4: Update the Trusted Web Activity Library

Make sure you are using the latest build of Chrome Tabs Client (or at least build 3679335).

Check the latest build here: https://chromium.googlesource.com/custom-tabs-client/+log

You can update the library in the build.gradle file:

build.gradle

Step 5: Party Time 🎉

Now you should see your app logo showing in the splash screen. Yay!

Remote for Slides Lite Splash Screen

Psst, are you a public speaker or you are going to give a presentation soon?

Try out Remote for Slides. It allows you to control Google Slides on any device, remotely, without the need of any extra hardware:

--

--

--

Google Developer Expert in Web Technologies | Front-end Web Developer | Making the web better with Preact, Polymer, Web Components, PWA & Firebase

Love podcasts or audiobooks? Learn on the go with our new app.

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
Henry Lim

Henry Lim

Google Developer Expert in Web Technologies | Front-end Web Developer | Making the web better with Preact, Polymer, Web Components, PWA & Firebase

More from Medium

How to launch any mobile app from the web

11 Ways to Boost Your Android Studio Flutter Development Productivity

Firebase push notifications in ionic capacitor app (Android)

Angular vs React: What to Choose in 2022