Hi guys,
I’m encountering this problem while developing my app.
I just installed the ionic native push notification plugin and the cordova phonegap push.
Notifications work but i can’t set the small icon
Well, the small icon is set always with the default app’s icon (that is not optimized for Android 5.0+ notifications, cause it’s not monochromatic).
So i’ve used this helper (http://romannurik.github.io/AndroidAssetStudio/icons-notification.htm) for generating good notification icons that i’ve called ic_notify.
These images are under the following path: /resources/android/ic_notify
and i added them as resources under my config.xml :
<resource-file src="resources/android/ic_notify/drawable-mdpi-ic_notify.png" target="app/src/main/res/drawable-mdpi/ic_notify.png" />
<resource-file src="resources/android/ic_notify/drawable-hdpi-ic_notify.png" target="app/src/main/res/drawable-hdpi/ic_notify.png" />
<resource-file src="resources/android/ic_notify/drawable-xhdpi-ic_notify.png" target="app/src/main/res/drawable-xhdpi/ic_notify.png" />
<resource-file src="resources/android/ic_notify/drawable-xxhdpi-ic_notify.png" target="app/src/main/res/drawable-xxhdpi/ic_notify.png" />
<resource-file src="resources/android/ic_notify/drawable-xxxhdpi-ic_notify.png" target="app/src/main/res/drawable-xxxhdpi/ic_notify.png" />
This is my push plugin configuration:
private pushSetup(){
const options: PushOptions = {
android: {
senderID: 'XXXXXXXXXXX',
icon: 'ic_notify',
iconColor: '#228DFE',
sound: true,
vibrate: true,
clearBadge: true,
clearNotifications: true
},
ios: {
alert: 'true',
badge: true,
sound: 'false',
clearBadge: true
}
};
const pushObject: PushObject = this.push.init(options);
pushObject.on('notification').subscribe(
(notification: any) => console.log('Received a notification', notification),
error => console.error('Error with Push plugin', error)
);
pushObject.on('registration').subscribe(
(registration: any) => console.log('Device registered', registration),
error => console.error('Error with Push plugin', error)
);
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));
}
This is my ionic configuration:
Ionic:
ionic (Ionic CLI) : 4.1.1 (C:\Users\Alexiano\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.11
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.1.0
Cordova Plugins : no whitelisted plugins (21 plugins total)
System:
Android SDK Tools : 26.0.2 (D:\AndroidSDK)
NodeJS : v10.9.0 (D:\Software\NodeJS\node.exe)
npm : 6.2.0
OS : Windows 10
And finally this is my cordova’s plugin list:
cordova-android-play-services-gradle-release 1.4.3 "cordova-android-play-services-gradle-release"
cordova-open-native-settings 1.5.1 "Native settings"
cordova-plugin-actionsheet 2.3.3 "ActionSheet"
cordova-plugin-add-swift-support 1.7.2 "AddSwiftSupport"
cordova-plugin-advanced-http 1.11.1 "Advanced HTTP plugin"
cordova-plugin-camera 1.2.0 "Camera"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-mauron85-background-geolocation 2.3.5 "CDVBackgroundGeolocation"
cordova-plugin-media 5.0.2 "Media"
cordova-plugin-nativeaudio 3.0.9 "Cordova Native Audio"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-plugin-x-socialsharing 5.4.1 "SocialSharing"
cordova-sqlite-storage 2.4.0 "Cordova sqlite storage plugin"
cordova-support-google-services 1.1.0 "cordova-support-google-services"
cordova.plugins.diagnostic 3.9.2 "Diagnostic"
es6-promise-plugin 4.2.2 "Promise"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-multidex 1.0.0 "Multidex"
phonegap-plugin-push 2.1.3 "PushPlugin"
uk.co.workingedge.phonegap.plugin.launchnavigator 4.2.1 "Launch Navigator"
Any help would be really appreciated. Thank you