我是Cordova安卓开发的新手,希望创建一个非常简单的应用程序来显示最新的电影,并向用户显示电影的横幅我的代码如下,通知正在显示,但它没有显示横幅。我的图像保存在www/img文件夹中
cordova.plugins.notification.local.schedule({
id: 1,
title: 'My first notification',
text: 'Thats pretty easy...',
attachments: ['file://img/logo.png'],
foreground: true,
vibrate: true
});这是我的文件路径

下面是我想要实现的一个例子,任何建议都会很棒。

发布于 2018-08-29 18:27:25
你的推送通知是什么样子的,看看文件的名称和它的扩展名,而不是文件名为logo.jpg,而你写的是Logo.jpg。Android是基于cause的,这可能会导致错误。
我试着用你的代码来构建它,纯推送是没有图片的,点击上面的pull it之后,它会像这样显示图片:

我的代码是一个用index.js编写的简单代码:
// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
cordova.plugins.notification.local.schedule({
id: 1,
title: 'My first notification',
text: 'Thats pretty easy...',
attachments: ['file://img/logo.png'],
foreground: true,
vibrate: true
});
}App外的推送消息

看看这张Gif图片(我知道,质量很差):

https://stackoverflow.com/questions/52070991
复制相似问题