hms-react-native-plugin
hms-react-native-plugin copied to clipboard
[@hmscore/react-native-hms-push] Downlink Messages are always sent to silent channel
"@hmscore/react-native-hms-push": "^6.3.0-304", "react-native": "0.63.4",

When I sent Downlink Message from my server to the device it is sent to the automatically created channel "Advertisements" and it has Gentle notifications enabled by default (a message is displayed only in the notification panel, and has no sound).
Here is the code:
fetch(
`https://push-api.cloud.huawei.com/v1/${appId}/messages:send`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
Authorization: `${tokenType} ${accessToken}`,
},
body: JSON.stringify({
message: {
android: {
notification: {
title: 'Title',
notify_summary: 'Summary',
body: 'Body',
click_action: { type: 3 },
default_sound: true,
importance: 'NORMAL',
},
},
token: [token],
},
}),
}

I tried to send it to that another channel (huawei-hms-rn-push-channel), got its id huawei-hms-rn-push-channel-id-4 and added channel_id property to the request but the messages wasn't sent to that channel. So specifying channel id doesn't work as well.
Silent mode on the device is not enabled.
How to send notifications that are not silent?
Could you kindly help us with some information to locate this issue?
- A push requestid and token which the value of the importance field is
NORMAL. - Push logs on devices side: You can obtain it by selecting File Management (APP) > Search push.log/NC.log > Deep Search.
Hi @Xuejiao-Shi, here is the data you asked for, thanks:
Push requestId:
165605476452135269037701
Push token:
IQAAAACy0tu7AACL3-_D7wkob1WwQ9JW4m_SsI1p48P7y1RIuu13kP1OY2TxHLHCbUdVERr08AtnltfETc4NDlCrW-jg7V-4vN2TSx3ErV3zMzBdew
Latest push logs after sending downlink message:
2022-06-24-11:11:49 -> PushLog110002306 [ReceiverDispatcher-231]enter AlarmTools:setExactAlarm(intent:Intent { act=com.huawei.android.push.intent.HEARTBEAT_RSP_TIMEOUT pkg=android } interval:10000ms
2022-06-24-11:11:49 -> PushLog110002306 [ReceiverDispatcher-231]setExactAlarm expectTriggerTime:1656054719013
2022-06-24-11:11:49 -> PushLog110002306 [ReceiverDispatcher-231]process cmdid to send to pushSrv:46, subCmdId:FF
2022-06-24-11:11:49 -> PushLog110002306 [ReceiverDispatcher-231]send msg to remote srv success
2022-06-24-11:11:49 -> PushLog110002306 [SocketRead_10:47:46-254]process cmdid to receive from pushSrv:47, subCmdId:FF
2022-06-24-11:11:49 -> PushLog110002306 [SocketRead_10:47:46-254]enter AlarmTools:setExactAlarm(intent:Intent { act=com.huawei.push.alarm.HEARTBEAT pkg=android } interval:180000ms
2022-06-24-11:11:49 -> PushLog110002306 [SocketRead_10:47:46-254]setExactAlarm expectTriggerTime:1656054889328
2022-06-24-11:11:49 -> PushLog110002306 [ReceiverDispatcher-231]process push message cmdid from pushSrv:47, subCmdId:FF
2022-06-24-11:12:48 -> PushLog110002306 [SocketRead_10:47:46-254]process cmdid to receive from pushSrv:44, subCmdId:FF
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]process push message cmdid from pushSrv:44, subCmdId:FF
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]msgType: 2 [0:PassBy msg, 1:System notification, 2:normal notification, 3:HCM PassBy msg]
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]receive a push msg,ctrl state:0, isDawn:false
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]send selfshow msg to NC to display, pkgName:com.myapp,msgID:013731D76C0B9930,haStorageId:-1,userId:0,subjectId:
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]AiClose Switch is off
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]process cmdid to send to pushSrv:45, subCmdId:FF
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]send msg to remote srv success
2022-06-24-11:12:48 -> PushLog110002306 [ReceiverDispatcher-231]handleMessageResponse the response msg is :45,msgId:013731D76C0B9930,displayPkgName:com.myapp,flag:00
Can you provide the push.log and NC.log log files on devices side? You can obtain it by selecting File Management (APP) > Search push.log/NC.log > Deep Search.
@Xuejiao-Shi, can you provide your email please or write to mine ([email protected])? I will answer with provided log files.
hi @yaroslavnikiforov you can send it to [email protected], thanks
Can I confirm that your app is going to release in China? Looks like you've set the Data Processing Location to China. If Data Processing Location is set to China and the app does not apply for self-categorization rights, the importance field does not take effect. As a result, the messages are intelligently classified as marketing notifications.
If your app users are not primarily in China, you are advised to set the data processing location based on the location of your users: https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/android-config-agc-0000001050170137#section3380135485
Yes, we are going to release it in China, and HMS Push Kit will be used mainly by Chinese users. Do you have the first link in the English locale? When I switch language on the page it seems that another content is opened. How to avoid classifying messages as marketing notifications in this case?
Sorry, as the self-categorized rights document is currently only available in Chinese, you can try to translate the content of that page.
How to avoid classifying messages as marketing notifications in this case? --For applications release in China, need to apply for self-classification rights to avoid this.
I don't have 'self-classification' option on the corresponding page in AppGallery Connect.

Sorry@yaroslavnikiforov, confirm with the product team that your account belongs to overseas, Therefore, the portal for applying for self-categorized rights button is not displayed on the AGC. You can refer to this document to send the application to Huawei Push operation team by email. We are very sorry that it brings you inconvinience and have reported this issue to the corresponding product team.