使用 cordova-plugin-local-notifications 附件不显示图像 属性
Image not displaying using cordova-plugin-local-notifications attachment property
我是 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
});
}
App的推送消息
看这个 Gif 看图片(我知道,质量太差了):
我是 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
});
}
App的推送消息
看这个 Gif 看图片(我知道,质量太差了):