我正在开发一个PWA,需要推送通知。遗憾的是,IOS/Safari目前还不支持https://w3c.github.io/push-api/#pushmanager-interface,所以我想我可能不得不以某种方式包装一个本机应用程序。
在安卓系统中(在他们的“可信网络活动”出现之前),你可以使用WebView在你的应用程序中显示一个无头的Chrome-View。IOS中的等价物是什么?推送通知和Webapp (浏览器需要跳转到特定页面)之间的交互是如何工作的?
我需要的另一件事是与我们公司的移动设备管理集成,这是Microsoft Intune。我过去在Android中集成了MDM,我知道这可能是a**中的一个主要难题,所以我正在考虑自己构建包装器,以获得最大的灵活性。另一种选择是像Ionic这样的东西,现在不确定。
发布于 2020-04-06 22:55:32
这在您的情况下可能不一定有效,但我在Safari的PWA中遇到了完全相同的问题,我只是通过使用长轮询解决了这个问题。它将允许您绕过Safari的所有限制,并且我能够在我们的SPA中重定向和加载部分。
async function subscribe() {
let response = await fetch("/subscribe");
if (response.status == 502) {
// Status 502 is a connection timeout error,
// may happen when the connection was pending for too long,
// and the remote server or a proxy closed it
// let's reconnect
await subscribe();
} else if (response.status != 200) {
// An error - let's show it
showMessage(response.statusText);
// Reconnect in one second
await new Promise(resolve => setTimeout(resolve, 1000));
await subscribe();
} else {
// Get and show the message
let message = await response.text();
showMessage(message);
// Call subscribe() again to get the next message
await subscribe();
}
}
subscribe();https://stackoverflow.com/questions/60827563
复制相似问题