diff --git a/config.xml b/config.xml index 3bb5254..d9030d7 100644 --- a/config.xml +++ b/config.xml @@ -30,4 +30,5 @@ + diff --git a/www/js/main.js b/www/js/main.js index f7b9bd3..1a1e758 100644 --- a/www/js/main.js +++ b/www/js/main.js @@ -829,6 +829,9 @@ function checkAndReset() { } }; + + +var my_media = {}; function onDeviceReadyPush() { var push = PushNotification.init({ android: { @@ -850,19 +853,27 @@ function onDeviceReadyPush() { var url = "https://xm.bus.pm/api/d/c?device=" + registration.registrationId; $.get(url, function( data ) { console.log(JSON.stringify(data)); - console.log(JSON.stringify(data)); - // $(".hiddendiv").append('
  • REQ A2A: '+ data +'
  • '); }); }); push.on('notification', function(data) { + 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(); console.log(JSON.stringify(data)); - console.log(JSON.stringify(data)); + alert(JSON.stringify(data)); }); push.on('error', function(e) { console.log(JSON.stringify(e)); - console.log(JSON.stringify(e)); }); }; diff --git a/www/media/alarm.wav b/www/media/alarm.wav new file mode 100644 index 0000000..0682cd3 Binary files /dev/null and b/www/media/alarm.wav differ