HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
241 stars 68 forks source link

setBackgroundMessageHandler is not working #221

Closed Daha62 closed 1 year ago

Daha62 commented 1 year ago

Hi! I'm trying to catch push-notifications in background or killed state of app, but HmsPushMessaging.setBackgroundMessageHandler not fired at all (I've done exactly the same.)

Also I was trying to catch notification when app is in foreground with HmsPushEvent.onRemoteMessageReceived - it also doesnt work.

(in both cases push was delivered successfully)

I was trying to check another functions like: HmsPushEvent.onLocalNotificationAction, HmsPushEvent.onPushMessageSentDelivered they also aren't working.

It seemed that com.huawei.hms.rn.push.remote.HmsPushMessageService is not started.

Any ideas?

"react-native": "0.68.3" "@hmscore/react-native-hms-push": "6.5.0-300",

Xuejiao-Shi commented 1 year ago

Check whether the sent message is a data messages. When the app is in background or killed state, the onRemoteMessageReceived handler will not be called when receiving data messages.

For more details, check this docs.

Daha62 commented 1 year ago

@Xuejiao-Shi Thank you for reply, I've placed the same link already.

It seemed that com.huawei.hms.rn.push.remote.HmsPushMessageService is not started. Do I need to insert something to AndroidManifest?

Daha62 commented 1 year ago

Oh, data-only is working, thank u.