@adding custom alarm..
This commit is contained in:
parent
fa341173e9
commit
9f98cfc95f
3 changed files with 16 additions and 4 deletions
|
@ -30,4 +30,5 @@
|
||||||
<variable name="SENDER_ID" value="667898382143" />
|
<variable name="SENDER_ID" value="667898382143" />
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin name="cordova-sqlite-storage" spec="~2.0.2" />
|
<plugin name="cordova-sqlite-storage" spec="~2.0.2" />
|
||||||
|
<plugin name="cordova-plugin-media" spec="~3.0.0" />
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -829,6 +829,9 @@ function checkAndReset() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var my_media = {};
|
||||||
function onDeviceReadyPush() {
|
function onDeviceReadyPush() {
|
||||||
var push = PushNotification.init({
|
var push = PushNotification.init({
|
||||||
android: {
|
android: {
|
||||||
|
@ -850,19 +853,27 @@ function onDeviceReadyPush() {
|
||||||
var url = "https://xm.bus.pm/api/d/c?device=" + registration.registrationId;
|
var url = "https://xm.bus.pm/api/d/c?device=" + registration.registrationId;
|
||||||
$.get(url, function( data ) {
|
$.get(url, function( data ) {
|
||||||
console.log(JSON.stringify(data));
|
console.log(JSON.stringify(data));
|
||||||
console.log(JSON.stringify(data));
|
|
||||||
// $(".hiddendiv").append('<li>REQ A2A: '+ data +'</li>');
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
push.on('notification', function(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));
|
||||||
console.log(JSON.stringify(data));
|
alert(JSON.stringify(data));
|
||||||
});
|
});
|
||||||
|
|
||||||
push.on('error', function(e) {
|
push.on('error', function(e) {
|
||||||
console.log(JSON.stringify(e));
|
console.log(JSON.stringify(e));
|
||||||
console.log(JSON.stringify(e));
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
BIN
www/media/alarm.wav
Normal file
BIN
www/media/alarm.wav
Normal file
Binary file not shown.
Loading…
Reference in a new issue