Skip to content

[WIP] An extensive push plugin with custom onNotificationOpened workaround

Notifications You must be signed in to change notification settings

onurkenis/cordova-hms-push-plugin

Repository files navigation

[WIP] Cordova - HMS Push Plugin

This plugin is created to serve native HMS Push Kit functionality on the Android platform.

It supports handy features like triggering custom onNotificationOpened event to catch notification related data on JS layer when user clicks and opens push notification sent from Huawei Push Kit Server.

Preparation

Follow official codelab for HMS Core enablement.

Usage

  1. Add plugin to your projects.
cordova plugin add https://github.com/onurkenis/cordova-hms-push-plugin.git
  1. Add following line to the activity in src/android where you configured to open after user notification click.
PushUtils.setIntentData(bundle);
  1. Add event listener to deviceready Event Handler and get notification data in JS when app is opened.
document.addEventListener('onNotificationOpened', function (notification) {
    console.log("onNotificationOpened Title: " + notification.detail.title);
    console.log("onNotificationOpened Body: " + notification.detail.body);
}, false);

How to send HMS Push Notification with data?

This part will be updated.

How to configure your applications to receive click action and notification data?

This part will be updated.

Contributing

Commit messages must comply with conventional commits. Otherwise commitlint will complain.

Thanks to commitizen, npm run commit command can be used to create commit messages complying with conventional commits.

Don't forget to install dependencies before to use it with npm install.

Releases

No releases published

Packages

No packages published