@adding custom alarm..

This commit is contained in:
halphass 2017-03-10 13:43:11 +01:00
parent fa341173e9
commit 9f98cfc95f
3 changed files with 16 additions and 4 deletions

View file

@ -30,4 +30,5 @@
<variable name="SENDER_ID" value="667898382143" />
</plugin>
<plugin name="cordova-sqlite-storage" spec="~2.0.2" />
<plugin name="cordova-plugin-media" spec="~3.0.0" />
</widget>

View file

@ -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('<li>REQ A2A: '+ data +'</li>');
});
});
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));
});
};

BIN
www/media/alarm.wav Normal file

Binary file not shown.