hms-react-native-plugin icon indicating copy to clipboard operation
hms-react-native-plugin copied to clipboard

[@hmscore/react-native-hms-push] Downlink Messages are always sent to silent channel

Open yaroslavnikiforov opened this issue 3 years ago • 10 comments

"@hmscore/react-native-hms-push": "^6.3.0-304", "react-native": "0.63.4",

Screenshot_20220621_162133_com android settings

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],
        },
      }),
    }

Screenshot_20220621_142107_com huawei systemmanager

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?

yaroslavnikiforov avatar Jun 21 '22 12:06 yaroslavnikiforov

Could you kindly help us with some information to locate this issue?

  1. A push requestid and token which the value of the importance field is NORMAL.
  2. Push logs on devices side: You can obtain it by selecting File Management (APP) > Search push.log/NC.log > Deep Search.

Xuejiao-Shi avatar Jun 22 '22 01:06 Xuejiao-Shi

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

yaroslavnikiforov avatar Jun 24 '22 07:06 yaroslavnikiforov

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 avatar Jun 24 '22 07:06 Xuejiao-Shi

@Xuejiao-Shi, can you provide your email please or write to mine ([email protected])? I will answer with provided log files.

yaroslavnikiforov avatar Jun 24 '22 08:06 yaroslavnikiforov

hi @yaroslavnikiforov you can send it to [email protected], thanks

Xuejiao-Shi avatar Jun 24 '22 08:06 Xuejiao-Shi

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

Xuejiao-Shi avatar Jun 27 '22 02:06 Xuejiao-Shi

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?

yaroslavnikiforov avatar Jun 27 '22 10:06 yaroslavnikiforov

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.

Xuejiao-Shi avatar Jun 28 '22 06:06 Xuejiao-Shi

I don't have 'self-classification' option on the corresponding page in AppGallery Connect. Screenshot 2022-07-06 at 18 52 21

yaroslavnikiforov avatar Jul 06 '22 15:07 yaroslavnikiforov

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.

Xuejiao-Shi avatar Jul 08 '22 06:07 Xuejiao-Shi