DEV Community

Kimura, L. 木村
Kimura, L. 木村

Posted on

Trusted Web Activities

A new way to integrate your web app with your Android!

Alt Text

Hey guys, today I'll tell you a little bit more about TWA.

But after all, what is a TWA, why and when to use?

What is there today?

Well, first of all, it's worth remembering that even before TWA, there are two other ways to integrate our web content into an Android app:

WebViews:

WebView is the most used component, mainly because there are some successful frameworks in the market, such as Ionic, that work in this format. With it you have full-screen support of your application, working with cookies, and linking Javascript code to Android code. The downside is that its performance is compromised and varies with each operating system.

Alt Text

Chrome Custom Tabs:

Chrome Custom Tabs, or CCT, in turn was introduced to Chrome in version 45. And unlike WebView, instead of looking like a full-screen application, the user will see it as an Activity with a custom toolbar. However this customization is limited and the user will always see the content URL. And finally, your app will have no access to web state, such as cookie, storage, etc…

Alt Text

Cool, so what changes with TWA?

Well, first of all, your TWA will run Chrome in full screen. And what does that mean? It means that for the user it is transparent. It will feel like a native application is actually running. And this is because of the ability to verify that your site and application are digitally certified through Digital Link Assets (which we talk about in the PWA article), and therefore are reliable.

TWA also has access to all Chrome features and can perform certain features not possible in WebViews. Some of these features are, for example, push notifications, autofill forms in Chrome, background synchronization, among others.

And just like CCT, a TWA can share data stored in Chrome, including cookies, as well as share session states, etc.

Okay, but when and why use it?

Well, there are several situations, where not necessarily an application is the main product of disclosure of your company. A classic example is shopping sites, or market places. The checkout system is often somewhat complex, and is often worth keeping in web format. That's where the versatility that TWA brings.

You can work on your native application until you checkout. From there you call your site through Trusted Web Activities, perform every checkout operation that already works today, and if you want, go back to the native app to complete the user purchase.

Well, the idea was to really explain a little bit more about what TWA really is, and what its advantages are.

Questions, doubts or suggestions are welcome! Just ping me on Twitter for @kimuradev

See ya!

Top comments (0)