Comments (8)
I have the same problem as vlasovilya and my service worker code looks the same as his. Everything is working fine when the app runs as PWA but not as TWA.
from svgomg-twa.
re: the issue with Pixel and Chrome 74 / 75, could you please test on Chrome Canary? An issue with bringing the application to foreground was fixed and is available there.
from svgomg-twa.
Hello @vlasovilya and @LukasSarnowskiC9,
I've faced the same issue but it still doesn't work for me.
self.addEventListener('notificationclick', function(event) {
function sendMsg(client, url, notification) {
client.postMessage(self.JSON.stringify({ url, notification }));
}
function openUrl(openingUrl) {
return self.clients.openWindow(openingUrl);
}
event.notification.close();
const data = event.notification.data;
const url = data.url;
const notification = data.notification;
event.waitUntil(
self.clients
.matchAll({ type: 'window', includeUncontrolled: true })
.then(function(clientList) {
const nonNested = clientList.filter(client => client.frameType !== 'nested');
// if there are no non-framed clients, just open the new window with the specified url
if (nonNested.length === 0) {
return openUrl(url);
} else {
for (let i = 0; i < clientList.length; i++) {
const firstClient = nonNested[i];
if ('focus' in firstClient) {
return firstClient
.focus()
.then(sendMsg.bind(null, firstClient, url, notification))
.catch(openUrl.bind(null, url));
}
}
}
})
);
});
Could you please share your piece of code which is working on Canary?
from svgomg-twa.
Can you provide more information on the browser version, device model and Android version? Also, can you take a look on #15 and point if that is a similar issue?
from svgomg-twa.
I have tested this on Android Studio Emulator (Chrome 74 and 75 on android 7.0 and 8.0), on Pixel XL (Android 8.0, Chrome 74 and 75) and on Huawei (Android 8.0, Chrome 74). On the Pixel devices the clients.openWindow(url) is ignored when the app is in background (not waking up the app) and on Huawai the app just closes/crashes when in background/foreground (it only opens the app when it is completely closed). When i run the page as PWA the clients.openWindow(url) brings the app to the foreground as expected.
from svgomg-twa.
Thank you for the information andreban. I have now tested my TWA with the canary Chrome version and it is working as intended.
from svgomg-twa.
Thanks @andreban and @LukasSarnowskiC9, it helped. Let's wait new Chrome version released then.
from svgomg-twa.
@LukasSarnowskiC9 Can you please tell me how did you test your TWA in chrome canary
? Because TWA always opens in default chrome
browser. How did you specify to open in canary instead of chrome? Or did you mean PWA
, not TWA
?
from svgomg-twa.
Related Issues (20)
- TWA top url bar not hiding HOT 2
- Unable to instantiate service androidx.browser.trusted.TrustedWebActivityService HOT 4
- how to use fcm push notification on TWA apk HOT 1
- Does TWA notification delegation handle sound also? HOT 9
- My TWA is crashing multiple times. HOT 7
- [Question] Adsense in PWA/TWA HOT 3
- Setting Notifications to true still asks for permission from user HOT 7
- Hide div in twa in-app browser HOT 1
- Running the TWA from a Chromebook just opens the URL in the browser and not a standalone window HOT 5
- TWA app can't run independently without running chrome browser first HOT 1
- Android TV app HOT 1
- open new a tab (url) inside of TWA by browser which is not inside of TWA HOT 1
- Update Android SDK studio to version 30 HOT 1
- Facebook Comments Plugin Not Working in The TWA HOT 1
- How to prevent app from going into background when a class 0 SMS (flash SMS) pops up thus preventing UPI verification.
- Android generating 404 errors on TWA website
- TWA asset ink is updated but address bar is visible HOT 4
- Android Browser Helper version HOT 2
- Multiple TWAs created for the same domain but google search only indexes one TWA HOT 1
- notifications only display when the phone is unlocked
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svgomg-twa.