ionic create notification channel code example
Example 1: ionic cordova icon notification
// Please test if this code added to config.xml <platform name="android"> tag will add the icon as default notification icon.
// Place the notification icon under "resources/android/notification/"
<resource-file src="resources/android/notification/notification_icon.png" target="app/src/main/res/drawable/notification_icon.png" />
<config-file parent="/manifest/application/" target="app/src/main/AndroidManifest.xml">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icon" />
</config-file>
Example 2: ionic play notification sound
import { NativeRingtones } from '@ionic-native/native-ringtones/ngx';
constructor(private ringtones: NativeRingtones) { }
...
this.ringtones.getRingtone().then((ringtones) => { console.log(ringtones); });
this.ringtones.playRingtone('assets/ringtones/sound_1.caf');
this.ringtones.stopRingtone('assets/ringtones/sound_1.caf');