@bugfix: custom notification sound in res/raw folder

This commit is contained in:
halphass 2017-03-11 08:13:39 +01:00
parent 841e3fba85
commit a2f37c7a2f
3 changed files with 16 additions and 28 deletions

BIN
res/raw/alarm.wav Normal file

Binary file not shown.

View file

@ -383,7 +383,7 @@
<p><img src="image/xm-logo.png" class="rwd" /></p>
<h1 class="introlettera" id="alert-title"></h1>
<h2 id="alert-message"></h2>
<button onclick="spengimi()" id="spegni-musica">Ferma Musica</button>
<!--<button onclick="spengimi()" id="spegni-musica">Ferma Musica</button>-->
</div>
<!-- chiude body-->
</div>

View file

@ -868,39 +868,27 @@ function onDeviceReadyPush() {
* gestisce la notifica ricevuta
*/
push.on('notification', function(data) {
// console.log(JSON.stringify(data));
console.log(JSON.stringify(data));
// alert(JSON.stringify(data));
/*
{
"title": "ciaooo",
"message": "ciaone",
"additionalData": {
"google.message_id": "0:1489146072171053%91acc10daee52ff4",
"coldstart": false,
"collapse_key": "ciaooo",
"foreground": true
}
}
*/
$("body").pagecontainer("change", "#alert");
$("#alert-title").html(data.title);
$("#alert-message").html(data.message);
/*
* suona l'allarme
*/
my_media = new Media("/android_asset/www/media/alarm.wav",
// success callback
function () {
console.log("play(): Success");
},
// error callback
function (err) {
console.log("play(): Error: " + JSON.stringify(err));
}
);
my_media.play();
// /*
// * suona l'allarme
// */
// my_media = new Media("/android_asset/www/media/alarm.wav",
// // success callback
// function () {
// console.log("play(): Success");
// },
// // error callback
// function (err) {
// console.log("play(): Error: " + JSON.stringify(err));
// }
// );
// my_media.play();
});
push.on('error', function(e) {