Hello,
I have a problem displaying images in local notifications on Android device (Android 7). I tried a lot of things in “attachment” property of notifications (absolute https/http urls, local URIs (file:///, file://, http://localhost…), raw svg, raw base64, simple text…) but the notifications never display any image in their body…
I know it can work on my device because I receive almost everyday this kind of notifications embedding images from some of my applications…
Here is my setup :
"dependencies": {
"@capacitor/android": "^3.0.0-rc.1",
"@capacitor/app": "^0.3.7",
"@capacitor/camera": "^0.4.4",
"@capacitor/core": "^3.0.0-rc.1",
"@capacitor/filesystem": "^0.5.3",
"@capacitor/haptics": "^0.3.7",
"@capacitor/keyboard": "^0.6.0",
"@capacitor/local-notifications": "^0.6.1",
"@ionic/storage": "^3.0.4",
"@ionic/vue": "^5.4.0",
"@ionic/vue-router": "^5.4.0",
"android-native-http": "file:../android-native-http",
"axios": "^0.21.1",
"core-js": "^3.6.5",
"es6-promise": "^4.2.8",
"ionicons": "^5.5.1",
"luxon": "^1.26.0",
"vue": "^3.0.0-0",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.0"
},
"devDependencies": {
"@capacitor/cli": "^3.0.0-rc.1",
"@types/jest": "^24.0.19",
"@types/luxon": "^1.26.3",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-e2e-cypress": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-typescript": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^2.0.0-0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0-0",
"typescript": "~3.9.3",
"vue-jest": "^5.0.0-0"
},
and sample code used :
import { LocalNotifications } from '@capacitor/local-notifications';
LocalNotifications.schedule({
notifications: [
{
id: 2,
//schedule: { every: 'minute' },
body: "Voyant allumé!",
title: "Sensor ",
actionTypeId: "SENSOR_NOTIF",
attachments: [
{
id: "1",
url: //all tests here!,
},
],
}
]
})
Thanks for your help!