GithubHelp home page GithubHelp logo

googlechromelabs / svgomg-twa Goto Github PK

View Code? Open in Web Editor NEW
512.0 36.0 130.0 158 KB

A sample that project Trusted Web Activities technology to wrap SVGOMG in an Android Application

License: Apache License 2.0

Shell 100.00%

svgomg-twa's People

Contributors

andreban avatar andrew67 avatar fluorescenthallucinogen avatar kimuradev avatar peconn avatar rayankans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

svgomg-twa's Issues

Transparent statusbar possible?

Hello!
I've got a web app where the theme is heavily based around the currently viewed content.
Is it possible to make the status bar translucent or transparent?

If that isn't possible, how would I best go about changing the status bar color dynamically based page content?

In a normal browser window and as a PWA I can achieve this by changing the content of the meta tag theme-color.

Thanks!

Support Splash Screen?

When I add a PWA to homescreen with Chrome on Android, an APK is generated which displays the splash screen as defined in the manifest file.

Is there an easy way to define a splash screen with TWA? It displays a white screen currently (as defined here).

Web Push doesn't open app, if the app is in background

Web Push click does open the app if the app is fully closed, but if it is in background click does nothing.

Service worker code:

self.addEventListener('notificationclick', function(event){
        event.notification.close();
        event.waitUntil(clients.matchAll({
           type: "window"
        }).then(function(clientList) {

            var url=event.notification.data.url || '/';

            for (var i = 0; i < clientList.length; i++) {            
                if ('focus' in client){
                    return client.focus();
                }
            }
            if (clients.openWindow) {
                return clients.openWindow(url);
            }
        }));
    });

Looks like client.focus and clients.openWindow doesn't work, if the app is in background

Fullscreen mode exists in PWA but not TWA?

It seems quite weird to us that Status and Nav bar cannot be hidden in TWA activity even though it's a non-issue for a PWA installed app. Can anything be done about it?

Update TWA Cookies

Since TWA supports first party website, is any possible solution that we can update/sync cookies between TWA and Native parts?

Thanks very much!

Asset links configured correctly but still opening in a tab.

Hi I have tried building my PWA to apk but it still opens the app in a tab view after many attemps. Here's what I'm currently doing:

  • I have my PWA at https://staging.ratex.co/home,
  • my assetlinks is at https://staging.ratex.co/.well-known/assetlinks.json, and it passes the 'Statement List Generator and Tester' test
  • my manifestPlaceholders is:
manifestPlaceholders = [
                hostName: "staging.ratex.co",
                defaultUrl: "https://staging.ratex.co/home",
                launcherName: "RateX Lite",
                assetStatements: '[{ "relation": ["delegate_permission/common.handle_all_urls"], ' +
                        '"target": {"namespace": "web", "site": "https://staging.ratex.co/home"}}]'
        ]

Is there anything I'm doing wrong? Would really appreciate the help. Thanks!

Support for Crashlytics

Some devices are crashing with a blank screen or just freeze, so I want to add crashlytics but I cannnot find the file MainActivity.java, which leads me to think that it is not supported here, can you please confirm?

Thanks

How to specify a custom icon for push notifications?

Our PWA uses push notifications. We managed to wrap it as a TWA, thanks to this excellent demo! Our TWA does receive push notifications, but they are shown with the Chrome icon in the status bar. Is there any way to replace that with our own, app-specific icon?

I tried putting

<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />

into ApplicationManifest.xml, but it didn't help.

Violation of Families Policy Requirements

Hello All,

First off, thank you so much for this code, it's been a tremendous time saver and super helpful!

I updated this code and followed the TWA guidelines to the tee and my app continues to get rejected on the following basis:

Webviews:
We don't allow apps whose primary purpose is to provide a webview of a website, regardless of ownership, or to aggregate content that does not belong to the developer. To resolve this issue, please remove violating content and resubmit your app.

My app is pure PWA with service workers, works offline and has no Google Analytics, tracking or ads in it.

You can view it here: https://opposites.co

I want to know if this project is valid and if Google is still supporting TWA?

Please add Options for Fallback to Website if TWA is not Supported

Hi @andreban, sorry but i have another feature request to you ;)

I got my TWA: https://play.google.com/store/apps/details?id=com.devMonkeys.expenser i got alot feedback (Also one bad rating) because people can download the App with devices they dont support TWA...

my please to you: Can you check please a possibility to add 2 Options?

  1. Boolean that set the dependencylist correctly, that it shows the App in Playstore only if peoples device support TWA

  2. Open a Dialog inside the App, when it runs on a Device that have no TWA Support, with text: Your device is not supporting TWA, you want to open the App in your Browser? and if they click yes it just opens the URL of the PWA inside Chrome.

I know it makes no sense to use both at same time, but maybe some people want to list it in store for marketing reasons, so thy set 1. to false and use 2. to catch customers. Also this will help to make TWA more popular.

Create default values for the the app`build.gradle` TWA configuration

Currently, all configurations are specified on the top of the application's build.gradle. Values like enableNotifications, useBrowserOnChromeOS and shortcuts are not frequently used and, as more configurations are added, the configuration ends up with a lot of visual pollution, making it harder for developers to understand.

For the values that can have defaults specified, those should be specified in the build script, and should only be added to the configuration section if a developer wants to override the default value.

This will make the configuration section shorter and easier understand.

@PEConn, WDYT?

Lock screen orientation

Hi,

I'm trying to figure out how to lock screen orientation to portrait (so that it doesn't switch to landscape when rotating the device) for my TWA/WebApp.

I tried locking the screen orientation both from the WebApp side (screen.orientation.lock) and both through the AndroidManifest (using the android:screenOrientation attribute), but neither of them worked.

Would appreciate help with how to do this!

I want to hide a div in twa app

I used below code to hide a div in twa, but not working,

<script>
if (window.matchMedia('(display-mode: standalone)').matches) {
  console.log('display-mode is standalone');
  document.getElementById("play-button").style.display = 'none';
}
</script>

How to do it?

How exactly Notification Delegation does work?

From the description, I don’t quite understand how Notification Delegation works.

Could you please explain?

If I set enableNotifications to true, does this mean that notifications will be managed by TWA wrapper and Chrome notification permission prompts will not be displayed (because TWA wrapper is Android native app and notifications in Android native apps are enabled by default without permission prompts)?

If yes, how does this fit with the recent notification experiment in Chrome?

Exception when trying to run the app

Hi,
I've tried cloning the repository, changing the manifest overrides and applicationId in app/build.gradle, running enable-debug.sh and I get the following exception when trying to run the app:

E/AndroidRuntime: FATAL EXCEPTION: main
                  Process: cz.skaut.odyssea.odymaterialy, PID: 16631
                  java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.customtabs.CustomTabsSession.validateRelationship(int, android.net.Uri, android.os.Bundle)' on a null object reference
                      at android.support.customtabs.TrustedWebUtils.launchAsTrustedWebActivity(TrustedWebUtils.java:91)
                      at android.support.customtabs.trusted.LauncherActivity$TwaCustomTabsServiceConnection.onCustomTabsServiceConnected(LauncherActivity.java:192)
                      at android.support.customtabs.CustomTabsServiceConnection.onServiceConnected(CustomTabsServiceConnection.java:44)
                      at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1730)
                      at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1762)
                      at android.os.Handler.handleCallback(Handler.java:873)
                      at android.os.Handler.dispatchMessage(Handler.java:99)
                      at android.os.Looper.loop(Looper.java:193)
                      at android.app.ActivityThread.main(ActivityThread.java:6694)
                      at java.lang.reflect.Method.invoke(Native Method)
                      at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
                      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

My device is the Xiaomi Mi A2 Lite, running Android One, Android version 9 with build version PKQ1.180917.001.V10.0.3.0.PDLMIXM. I am running Chrome version 72.0.3626.76, the latest I can get from the Play store

Do you have any idea what could be causing this? I am a relative beginner to Android development, so any help is appreciated.

Thank you

App crashes with IllegalStateException

Hi,

We're getting a small number of crashes from various devices with the following stack trace:

java.lang.IllegalStateException: 
  at android.support.customtabs.trusted.TwaLauncher.launchWhenSessionEstablished (TwaLauncher.java:176)
  at android.support.customtabs.trusted.TwaLauncher.lambda$launchTwa$0$TwaLauncher (TwaLauncher.java:158)
  at android.support.customtabs.trusted.-$$Lambda$TwaLauncher$0c_zkUHgDllmcAlOM3gechJInp0.run (Unknown Source:8)
  at android.support.customtabs.trusted.TwaLauncher$TwaCustomTabsServiceConnection.onCustomTabsServiceConnected (TwaLauncher.java:226)
  at android.support.customtabs.CustomTabsServiceConnection.onServiceConnected (CustomTabsServiceConnection.java:44)
  at android.app.LoadedApk$ServiceDispatcher.doConnected (LoadedApk.java:1839)
  at android.app.LoadedApk$ServiceDispatcher$RunConnection.run (LoadedApk.java:1871)
  at android.os.Handler.handleCallback (Handler.java:873)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loop (Looper.java:214)
  at android.app.ActivityThread.main (ActivityThread.java:7050)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:965)

Seems to be something going wrong when trying to establish the session. Is this a known issue?

Thanks

Splash Screen Icon?

Hi @andreban

Thanks for the Update with Splash Screen Support :) But... can you maybe also add a option that allow people to add a Splash Screen Icon?

def twaManifest = [
    applicationId: 'org.chromium.twa.svgomg',
    hostName: 'svgomg.firebaseapp.com', // The domain being opened in the TWA.
    launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
    name: 'SVGOMG TWA', // The name shown on the Android Launcher.
    themeColor: '#303F9F', // The color used for the status bar.
    backgroundColor: '#ffffff' // The color used for the splash screen background.
]

Currently is it not possible. I was just wondering why i just see a white Screen when i started the App first time...

Splash screen doesn't work

Pull request #23 was merged into master recently. I've cloned the master branch and built the app, but I don't see the splash screen.

@andreban Have you tested the PR before merging?

twa has assetLinks but is still opening with address bar

Hello, I am experiencing the same kind of issue that was seen here: #4

my angular app served w/ https on firebase hosting: https://pwa-demo-5dcd2.firebaseapp.com/

asset links: https://pwa-demo-5dcd2.firebaseapp.com/.well-known/assetlinks.json

I put the app to beta test: you can install it here: https://play.google.com/apps/testing/com.wm.pwaexample

my pwa: https://github.com/WagnerMoreira/pwa-demo
my twa https://github.com/WagnerMoreira/twa-demo

is there something wrong in my configs on build.gradle or my manifest file? it seems to have some sort of issue because if assetLinks were working the address bar would not be visible right?

Firebase Notifications

hello, i want to know if for this kind of apps we can integrate FCM. my idea is to generate the token, then save it as a cookie(if possible), then save that cookie from the backend server.

Thank you!

twa has assetLinks but is still opening with address bar

how wil the gradle config look like if it is a path on a site .. example : https://a.b.com/myPWA

I am getting the address bar in my app.
Here is the gradle file:


android {
    compileSdkVersion 28
    defaultConfig { 
        applicationId "zzz.a.b.com"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 3
        versionName "1.1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        manifestPlaceholders = [
                // The hostname is used when building the intent-filter, so the TWA is able to
                // handle Intents to open https://svgomg.firebaseapp.com.
                hostName: "a.b.com",
                defaultUrl: "https://a.b.com/myPWA",
                launcherName: "UATZZ  ",
                // This variable below expresses the relationship between the app and the site,
                // as documented in the TWA documentation at
                // https://developers.google.com/web/updates/2017/10/using-twa#set_up_digital_asset_links_in_an_android_app
                // and is injected into the AndroidManifest.xml
                assetStatements: '[{ "relation": ["delegate_permission/common.handle_all_urls"], ' +
                        '"target": {"namespace": "web", "site": "https://a.b.com"}}]'

// is site the fullpath or root url
        ]

        // This attribute sets the status bar color for the TWA. It can be either set here or in
        // `res/values/colors.xml`. Setting in both places is an error and the app will not
        // compile. If not set, the status bar color defaults to #FFFFFF - white.
        resValue "color", "colorPrimary", "#303F9F"
    }
    buildTypes {
        release {
            minifyEnabled false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

Is site the fullpath or root url ?

my home page is at
https://a.b.com/myPWA
and my service worker is under the same

i have the asset link and manifest.json, still it is showing up the

I am still seeing the address bar. What all things i must make sure are correct to remove the address bar.

TWA doesn't hide url bar

Hello, I have downloaded your repository and followed the steps to upload my PWA to the Play Store, but I have an error even though I already set up the assetlinks.json and it seems that the TWA configuration is fine, still do not hide the bar url.

I have seen other issues here with the same problem but none has given me a solution.

Even I managed to upload my PWA to the play store but the problem continues...

Next my assetlinks.json: https://tumototaxi.co/.well-known/assetlinks.json.

My assetlinks.json has the keys generated from the android studio and from the signing of the Google Console apps, however I already try to leave only one of the two and it does not work.

My build.gradle:

apply plugin: 'com.android.application'

def twaManifest = [
    applicationId: 'tumototaxi.twa.pwa',
    hostName: 'tumototaxi.co', // The domain being opened in the TWA.
    launchUrl: '/app', // The start path for the TWA. Must be relative to the domain.
    name: 'Tu Mototaxi', // The name shown on the Android Launcher.
    themeColor: '#FFF', // The color used for the status bar.
    backgroundColor: '#FFF', // The color used for the splash screen background.
    enableNotifications: false // Set to true to enable notification delegation
]

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId twaManifest.applicationId
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 5
        versionName "1.1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        resValue "string", "appName", twaManifest.name
        resValue "string", "launchUrl", "https://" + twaManifest.hostName + twaManifest.launchUrl

        resValue "string", "hostName", twaManifest.hostName

        resValue "string", "assetStatements",
                '[{ \\"relation\\": [\\"delegate_permission/common.handle_all_urls\\"],' +
                        '\\"target\\": {\\"namespace\\": \\"web\\", \\"site\\": \\"https://' +
                        twaManifest.hostName + '\\"}}]'

        resValue "color", "colorPrimary", twaManifest.themeColor

        resValue "color", "backgroundColor", twaManifest.backgroundColor

        resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'

        resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
    }
    buildTypes {
        release {
            minifyEnabled false
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.github.GoogleChrome.custom-tabs-client:customtabs:e849e45c90'
}

My AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.placeholder">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/appName"
        android:supportsRtl="true"
        android:theme="@style/Theme.LauncherActivity">

        <meta-data
            android:name="asset_statements"
            android:resource="@string/assetStatements" />

        <activity android:name="android.support.customtabs.trusted.LauncherActivity"
            android:label="@string/appName">
            <meta-data android:name="android.support.customtabs.trusted.DEFAULT_URL"
                android:value="@string/launchUrl" />

            <meta-data
                android:name="android.support.customtabs.trusted.STATUS_BAR_COLOR"
                android:resource="@color/colorPrimary" />

            <meta-data android:name="android.support.customtabs.trusted.SPLASH_IMAGE_DRAWABLE"
                android:resource="@drawable/splash"/>

            <meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_BACKGROUND_COLOR"
                android:resource="@color/backgroundColor"/>

            <meta-data android:name="android.support.customtabs.trusted.SPLASH_SCREEN_FADE_OUT_DURATION"
                android:value="300"/>

            <meta-data android:name="android.support.customtabs.trusted.FILE_PROVIDER_AUTHORITY"
                android:value="@string/providerAuthority"/>

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE"/>
                <data android:scheme="https"
                    android:host="@string/hostName"/>
            </intent-filter>
        </activity>

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="@string/providerAuthority"
            android:grantUriPermissions="true"
            android:exported="false">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/filepaths" />
        </provider>

        <service
             android:name="android.support.customtabs.trusted.TrustedWebActivityService"
             android:enabled="@bool/enableNotification"
             android:exported="@bool/enableNotification">

             <intent-filter>
                 <action android:name="android.support.customtabs.trusted.TRUSTED_WEB_ACTIVITY_SERVICE"/>
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
         </service>

    </application>
</manifest>

Thanks for your help

Feedback about TWA

I recently migrated my app to TWA, and wanted to share some feedback.

Being primarily a web dev, I always had this believe that web apps would eventually land on App Stores, glad to see that its finally happening. Great job Google team :)

There are few things that I wanted to point out and if these could be fixed it would be awesome.

My PWA make use to Push notifications, Credential Management API and Web Share API.

Web Share API and Credential Management API works perfectly in TWA.

There are some issue with Push Notifications, although clicking a Push Notification from notifications tray, launches the App, similarly clicking Action Button on a Push Notification does open the app, but it doesn't switch to the app, we have to swipe up to close the notifications panel to see the app.

When the app is already running (in background/minimized), clicking the push notification, launches the app again, I mean shows the splash screen again and re-init the PWA. If it could reuse the already running instance of the app it would be great and would improve the user experience.

There should be a way to minimize app when the back button is pressed in app. Currently if we are on the root page and press back button it closes the app, whereas in most of the apps, this actually minimize the app and send app to background. And when we re open the app it reuses the same instance. If the same behavior could be implemented for TWA it would be great.

I have start_url:"/account/dashboard" specified in manifest.json but when I open my TWA app it launches the root page instead of starting app from url /account/dashboard.

My app also uses third party login and allow users to login using Google, Facebook or LinkedIn account. But the issue is when user clicks link of any of the provider e.g. Facebook, it takes too much time to launch new tab and present user with login screen. Can this experience be improved?

I'm also not clear about the push notifications permissions in TWA, are the push notifications enabled by default in TWA?

[Proposal] Use web app manifest as single source of truth

Currently, developers when packaging PWA to TWA should duplicate web app manifest properties in build.gradle file, that has a different format.

What about using manifest.webmanifest file as single source of truth and generate build.gradle from it? This should improve the DX (Developer Experience).

twa has assetLinks but is opening with address bar

I followed the offical way to publish my pwa on the play store but whatever i tried i still have this url adress bar. I have a correct assetlinks.json on my server (i've tested it with the google tool) at https://www.elec-tricks.com/.well-known/assetlinks.json and here is my gradle file :

`apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
applicationId "com.quicksize.elec_tricks"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [
hostName: "www.elec-tricks.com",
defaultUrl: "https://www.elec-tricks.com",
launcherName: "Elec-Tricks",
assetStatements: '[{ "relation": ["delegate_permission/common.handle_all_urls"], ' +
'"target": {"namespace": "web", "site": "https://www.elec-tricks.com"}}]'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.github.GoogleChrome:custom-tabs-client:a0f7418972'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
`
Is there something missing in the way i did it ?

How to support multi environment urls?

I'm very new to Android Studio and android development as a whole. I found this article to work twas-quickstart, but not so much this article: using-twa

What's the way to change the hostname and release it to a particular track in the Google Play Store?

I released our first ever version of the TWA to the Internal Track in the Play Store pointing to a beta URL just to test it out.

If I want to change my hostName in the build.gradle do I change that value, build and then upload that app bundle to a different release track, e.g, production track?

I'm aware that I need to probably have two sha256_cert_fingerprints in my assetlinks.json, that's taken care of.

White screen

When you close the application with the back button, a white blank screen is displayed for a short period of time, how can I fix this?

Status Bar Color Precedence Issue

I'm seeing an issue with the status bar color, and I'm not sure whether the problem is in this test app, the support library, Chrome, or something I'm doing wrong.

https://bugs.chromium.org/p/chromium/issues/detail?id=964914

According to that issue, if a trusted webpage specifies a theme color, this theme color should take precedence over any values specified in the app.

However, I'm not seeing this behavior with the test app. To test this, I've done the following:

  1. Navigate to https://svgomg.firebaseapp.com/ and install the app to the home screen.
  2. Observe that the status bar is a dark blue color (#303F9F)
  3. Update the TWA's twaManifest.themeColor to #00FFFF
  4. Run the app and observe the color is turquoise rather than dark blue

It looks like this change should have landed in Chrome 76, but I'm not seeing it in Chrome 77.

Am I missing something obvious?

Handle back button in TWA

Hi,

I'm not sure I should post this request here.. But I have set a PWA+TWA using this repo to start.
I managed to get the expected result, except on the mobile "back" button which seems not to works as expectd on the TWA.

Actually, when I tap to back button on my mobile, nothing is happening. and the PWA (so the TWA) is using "window.location.hash" to handle the pages changes.

Is there anything I can do so far?

Thanks.

How to know when running inside the TWA vs Browser vs PWA.

Thanks for the great project. It's awesome for us web-only guys.

My question concerns how to identify that the user is viewing the website from inside the TWA. I know that there is a referer during the launch, but setting a cookie or local storage based upon that referer to identify the TWA in the user's session is no good because that data is shared with Chrome as well as the PWA, if installed.

Perhaps there a way to set a custom header? I found a conversation on SO to this effect:

https://stackoverflow.com/questions/54580414/how-can-i-detect-if-my-website-is-running-inside-a-trusted-web-actvity

With this solution:

    Bundle headers = new Bundle();
    headers.putString("key", "value");
    customTabsIntent.intent.putExtra(Browser.EXTRA_HEADERS, headers);

If we could send a custom header with the request from the TWA, or a custom user agent, it would be a breeze to identify the environment.

Maybe there is a better way that I haven't come across.

Thanks for any help!

application close issue

created pwa app and integrated in twa android app. now i want to exit from android app from my pwa app. how i can do that, any help.
thanks in advance

Run twa in fullscreen mode without Action- and Statusbar

Hi there,

we are building a pwa game and want to launch it also as twa without action- and statusbar in fullscreen mode. Currently I found no way to do this and my received answer on stackoverflow does not work me. So (how) is it possible to run a twa completely without ui (actionbar, statusbar) in fullscreen mode?

Thanks! 😊

android:statusBarColor buggy?

I updated the minSdkVersion to version 21 and add to the stylings:

<item name="android:statusBarColor">@color/ic_launcher_background</item>

For a very short moment when the app gets initialized i see the correct color. but it seems that after this first init the app starts the web view and the statusbar turns into white. Is it possible that this is a bug?

by the way... isnt it possible to let the chrome WebView uses the styles from the webmanifest? Does not that make the most sense?

Support Library update?

@andreban you posted in #4 (comment) this:

One possible cause is the version of the Support Library being used. The version in the demo had an issue that showed the URL Bar when the TWA is opened and Chrome is being cold-started. Updating the Support Library version fixes the issue:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.github.GoogleChrome.custom-tabs-client:customtabs:7ab7178ae0'
}

If the Support Library is outdated or contains a bug, can you please update this in the repository? Then i can remove my fork of this repo and can link the original source repo in my blog article

[Ask] How to use Google Play App Signing in Debug

  1. I have done to app signing on google play console.
  2. get SHA-256 certificate fingerprint from App signing
  3. Add SHA-256 certificate fingerprint on assetlinks.json to PWA site.
    => downloading the app from google play, the address bar is hidden when running the app, because app sign is meet between the website and app.

There is a problem in here that if I want to build an �APK file in Android studio the key signing which is upload certificate (gen from keystore, not app signing) so TWA app will show the address bar.
I would like to know how to use google app sign if I want to build an APK file at the local?

9-patch on splash screen not strech

Hi all,

I'm not able to activate 9 patch on splash screen.

  • Launcher is displaying splash screen with image not strech, a normal .png
  • I created .9.png files using the Android Studio editor (a crazy tool.. :-) )

But then the image remain centered and not stretch.
Are there any additional setup to do with a TWA?

Thanks a lot.

Not able to put a svg gradient as TWA splash screen background.

I'm not sure if this is even possible, but is there some way to do it?

<meta-data
android:name="android.support.customtabs.trusted.SPLASH_SCREEN_BACKGROUND_COLOR"
android:resource="@color/backgroundColor"/>

Being, @drawable/gradient instead of @color/backgroundColor, I did this but didn't worked, the app just throws an error, I asked this on Stack too, but didn't got an answer, so I thought on asking here, it would be good as an enhacement.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.