I have a responsive web application and want to show notifications in the status bar of the mobile when the app is running in the mobile browser. After googling the best I can find is this : status-bar-notification
I am unable to understand how this would help to show the notification. Similar to the question in the aforementioned link I want to show notification on click.
<!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>
Is there any way to achieve this ?
There are two types of notifications:
– Local notification, which you can generate IN your app.
– Push notifications, which are provided by Apple, Google, … or some notification providers.
For both you need a plugin, have a look at the cordova plugin site .
If you use local notifications, then the plugin generates the message in the status bar, not your JS! But you give the plugin the message, an icon and a badge number.
All of the notification handling has to be inside your app. That means for example: You have to remove notifications, if the are no more used, the count of badge numbers, etc..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.