Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

We are not getting Notification into HmsMessageService on onMessageReceived file in Android #3

Open
binitpatel opened this issue Oct 8, 2020 · 2 comments

Comments

@binitpatel
Copy link

I am using your example send_notify_message.js file from HUAWEI Push Kit(NodeJs). I get a success message in NodeJs log.
{
code: '80000000',
msg: 'Success',
requestId: '160213898154027353000507'
}

I can see Notification appears at top of the mobile but somehow we are not able to see into our Android log.

Normally any notification comes it should be handled by HmsMessageService method onMessageReceived. Based on that we further take programmatic action.

But in Huawei Notification does not appear in HmsMessageService. Currently, we are not able to take any action.

We have also tried to send notification via HUAWEI Push Kit from app gallery. Then also it does not appear into HmsMessageService. It only shows on top of mobile but it is useless for us we can not take any programmatic action.

@binitpatel
Copy link
Author

Here is the link to HUAWEI Push Kit from the app gallery
https://www.screencast.com/t/oAfcSIWq5J

@despotes
Copy link

despotes commented Aug 2, 2021

I am using your example send_notify_message.js file from HUAWEI Push Kit(NodeJs). I get a success message in NodeJs log.
{
code: '80000000',
msg: 'Success',
requestId: '160213898154027353000507'
}

I can see Notification appears at top of the mobile but somehow we are not able to see into our Android log.

Normally any notification comes it should be handled by HmsMessageService method onMessageReceived. Based on that we further take programmatic action.

But in Huawei Notification does not appear in HmsMessageService. Currently, we are not able to take any action.

We have also tried to send notification via HUAWEI Push Kit from app gallery. Then also it does not appear into HmsMessageService. It only shows on top of mobile but it is useless for us we can not take any programmatic action.

I was working on React Native
In my case, onMessageReceived was triggered only by DataMessages, at least it was I found out while testing this library.

From documentation here

image

Example of message that worked for me:

const payload = {
     // anything you want here
     test: 'test'
}

const notification = {
      title: 'Condivisione Messaggio',
      body: 'Message Shared',
    };

const message = {
      data: JSON.stringify({ ...notification, payload }), // added also this one for being sure will be passaed to onMessageReceived
      android: {
        collapse_key: -1,
        urgency: 'HIGH',
        ttl: '10000s',
        data: JSON.stringify({ ...notification, payload }), // this one is important
      },
      token: [
        pushChannel,
      ],
    };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants