Javascript 未使用cordova插件本地通知附件属性显示图像
我是新的Javascript 未使用cordova插件本地通知附件属性显示图像,javascript,android,cordova,android-notifications,Javascript,Android,Cordova,Android Notifications,我是新的Cordovaandroid开发人员,希望创建一个非常简单的应用程序来显示最新的电影,并向用户显示电影的横幅。我的代码如下,通知正在显示,但没有显示横幅。我的图像保存在www/img文件夹中 cordova.plugins.notification.local.schedule({ id: 1, title: 'My first notification', text: 'Thats pre
Cordova
android开发人员,希望创建一个非常简单的应用程序来显示最新的电影,并向用户显示电影的横幅。我的代码如下,通知正在显示,但没有显示横幅。我的图像保存在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
});
这是我的文件路径
下面是我想要实现的一个例子,任何建议都会很好
推送通知的外观如何,请查看文件名及其扩展名,而不是文件名为Logo.jpg,您编写的是Logo.jpg。Android是基于Linux的,这可能会导致错误 我试着用你的代码来构建它,纯推是没有图像的,点击从上面拉它之后,它会显示这样的图像: 我的代码在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
});
}
将消息推出应用程序
看这张Gif图片(我知道,质量很糟糕):
你好!,我更新了显示文件路径的问题。我自己测试了代码,推送消息的第一次外观最小化,如果你看它,就会显示图像。你能更新你的答案并显示你的完整代码吗?我想交叉比较如果你对此有任何问题,我会在这里为你:)仍然,我的附件没有显示,可能是因为我的android版本,这真的让我很困惑,我将尝试在不同的android手机上。