2017-06-19 63 views
0

接收通知我已經加入插件科爾多瓦 - 插件 - 媒體播放定製的歌曲,而在科爾多瓦

db.push.onNotificationGCM = function(e) { 

    var myMedia = new Media("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3") 
myMedia.play({ numberOfLoops: 2 }) 

     switch (e.event) { 
      case 'registered': 
       if (e.regid.length > 0) { 
        db.push.devicetoken = e.regid; 
        var data_to_send = { 
         devicetoken: db.push.devicetoken, 
         platform: 'android' 
        }; 
        db.push.register_push(data_to_send); 
       } 
       break; 
      case 'message': 
       if (e.foreground) { 
        app.t(e.payload.message); 
        db.notifications.data = TAFFY(); 
       } else { 
        db.push.deeplink = e.payload.deeplink; 
        if (e.coldstart) {} else { 
         db.notifications.data = TAFFY(); 
         db.push.gotoDeeplink(); 
        } 
       } 
       break; 
      case 'error': 
       break; 
      default: 
       break; 
     } 
    } 

問題:

Media is not defined 

回答

0

找到了答案,

實際上是由於版本問題插件最新版本不支持Android版本6

我的項目支持的插件:

cordova plugin add [email protected] 

爲我工作過!