【问题标题】:How to send Push Notification In webview app where as notification going on website and PWA如何在 webview 应用程序中发送推送通知,其中通知在网站和 PWA 上进行
【发布时间】:2020-12-24 07:41:26
【问题描述】:

我正在开发我的网站的 Web 视图,我的网站已经启用了 PWA,并且使用 Firebase 我可以在我的网站 + PWA 上发送通知,但我的 Web 视图应用程序没有收到相同的通知。 我有一个美食餐厅网站,所以当订单状态发生变化时会发送通知。所以我不能一次又一次地进入firebase并将推送通知发送到我的网络视图应用程序。虽然我的网站和 PWA 收到了通知。

【问题讨论】:

    标签: javascript android firebase webview progressive-web-apps


    【解决方案1】:

    当你收到这样的通知时,你可以从 webview 触发 Java/Kotlin 方法的执行

        mWebView.addJavascriptInterface(new MyJavaInterface(), "test");
    
        private class MyJavaInterface {
            @android.webkit.JavascriptInterface
            public String getGreeting() {
                return "Hello JavaScript!";
            }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-06-11
      • 1970-01-01
      • 2020-07-12
      • 2020-06-07
      • 2022-12-21
      • 2020-12-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多