Browse Source

@bugfix: custom notification sound in res/raw folder

halphass 7 years ago
parent
commit
a2f37c7a2f
3 changed files with 16 additions and 28 deletions
  1. BIN
      res/raw/alarm.wav
  2. 1 1
      www/index.html
  3. 15 27
      www/js/main.js

BIN
res/raw/alarm.wav


+ 1 - 1
www/index.html

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

+ 15 - 27
www/js/main.js

@@ -868,39 +868,27 @@ function onDeviceReadyPush() {
      * gestisce la notifica ricevuta
      */
     push.on('notification', function(data) {
-        // console.log(JSON.stringify(data));
+        console.log(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");
         $("#alert-title").html(data.title);
         $("#alert-message").html(data.message);
 
-        /*
-         * suona l'allarme
-         */
-        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();
+        // /*
+        //  * suona l'allarme
+        //  */
+        // 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();
     });
 
     push.on('error', function(e) {