簡體   English   中英

Web應用程序中的狀態欄通知

[英]status bar notification in web application

我有一個響應式Web應用程序,並且當該應用程序在移動瀏覽器中運行時,希望在移動設備的狀態欄中顯示通知。 谷歌搜索后,我能找到的最好的是: status-bar-notification

我無法理解這將如何幫助顯示通知。 與上述鏈接中的問題類似,我想在點擊時顯示通知。

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="format-detection" content="telephone=no" />
        <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
        <link rel="stylesheet" type="text/css" href="css/index.css" />
        <title>Hello World</title>
    </head>
    <body>
        <input type="button" value="Notiiiiiiif" id="btNotif"/>
        <script type="text/javascript" src="cordova.js"></script>  
        <script type="text/javascript" src="js/index.js"></script>

        <script type="text/javascript">
            app.initialize();
            btNotif = document.getElementById('btNotif');
            btNotif.addEventListener('click', function(){
                //There I want a notification to appear in the mobile status bar
            });
        </script>
    </body>
</html>

有什么辦法可以做到這一點?

通知有兩種類型:

–本地通知,您可以在應用程序中生成本地通知。

–推送通知,由Apple,Google或某些通知提供者提供。

對於這兩者,您都需要一個插件,請查看cordova插件站點

如果您使用本地通知,那么插件會在狀態欄中生成消息,而不是JS! 但是,您要給插件提供消息,圖標和徽章編號。

所有通知處理都必須在您的應用程序內部。 例如,這意味着:您必須刪除通知,如果不再使用通知,則必須刪除徽章編號等。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM