|
@@ -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));
|
|
|
});
|
|
|
};
|
|
|
|