我添加了插件cordova-plugin-media
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
1条答案
按热度按时间m3eecexj1#
找到了答案
实际上由于版本问题插件最新版本不支持android版本6
我的项目支持的插件:
对我有用!!!