According to official Huawei docs, "You can set the message.android.notification.foreground_show field to make notification messages not displayed by NC. In this case, when your app is running in the foreground, the notification messages are transparently transmitted to your app, and processed and displayed by your app."
Sample code:
{
"message": {
"notification": {
"title": "message title",
"body": "message body"
},
"android": {
"notification": {
"foreground_show": false,
"click_action": {
"type": 1,
"action": "com.huawei.codelabpush.intent.action.test"
}
}
},
"token": [
"pushtoken1"
]
}
}
I have a problem with this parameter, it seems it's just ignored. I've created a message service that implements HmsMessageService class, then have overridden its OnMessageReceived(RemoteMessage message) method.
My app succesfully obtains access tokens from server, receives data messages when in foreground, my device receives notification messages when app killed or in background and then starts an app on user tap, but I still can't intercept notification messages when app is in foreground.
Has anyone else had this problem?