Skip to content

Instantly share code, notes, and snippets.

@Maxim-Kolmogorov
Last active May 6, 2021 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Maxim-Kolmogorov/55fff188611a91e1d9e8f5c6afbe7bb5 to your computer and use it in GitHub Desktop.
Save Maxim-Kolmogorov/55fff188611a91e1d9e8f5c6afbe7bb5 to your computer and use it in GitHub Desktop.
Add push notification tutorial (blog.vverh.digital)
<platform name="android">
<preference name="AndroidXEnabled" value="true" />
</platform>
<platform name="android">
<preference name="AndroidXEnabled" value="true" />
<resource-file src="res/google-services.json" target="app/google-services.json" />
</platform>
<resource-file src="res/drawable/drawable-anydpi-v24/notification_icons.xml" target="app/src/main/res/drawable-anydpi-v24/notification_icons.xml" />
<resource-file src="res/drawable/drawable-hdpi/notification_icons.png" target="app/src/main/res/drawable-hdpi/notification_icons.png" />
<resource-file src="res/drawable/drawable-mdpi/notification_icons.png" target="app/src/main/res/drawable-mdpi/notification_icons.png" />
<resource-file src="res/drawable/drawable-xhdpi/notification_icons.png" target="app/src/main/res/drawable-xhdpi/notification_icons.png" />
<resource-file src="res/drawable/drawable-xxhdpi/notification_icons.png" target="app/src/main/res/drawable-xxhdpi/notification_icons.png" />
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/notification_icons" />
</config-file>
<!-- And finally, add this dependency in tag <widget>: -->
<widget ... xmlns:android="schemas.android.com/apk/res/android" ...></widget>
window.pushNotification.registration(
(token) => {
console.log(token);
},
(error) => {
console.error(error);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment