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

View file

@ -868,39 +868,27 @@ function onDeviceReadyPush() {
* gestisce la notifica ricevuta * gestisce la notifica ricevuta
*/ */
push.on('notification', function(data) { push.on('notification', function(data) {
// console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
// alert(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"); $("body").pagecontainer("change", "#alert");
$("#alert-title").html(data.title); $("#alert-title").html(data.title);
$("#alert-message").html(data.message); $("#alert-message").html(data.message);
/* // /*
* suona l'allarme // * suona l'allarme
*/ // */
my_media = new Media("/android_asset/www/media/alarm.wav", // my_media = new Media("/android_asset/www/media/alarm.wav",
// success callback // // success callback
function () { // function () {
console.log("play(): Success"); // console.log("play(): Success");
}, // },
// error callback // // error callback
function (err) { // function (err) {
console.log("play(): Error: " + JSON.stringify(err)); // console.log("play(): Error: " + JSON.stringify(err));
} // }
); // );
my_media.play(); // my_media.play();
}); });
push.on('error', function(e) { push.on('error', function(e) {