5

Fixed server-side

Note: this was a server side bug and for now seems to be solved. Our mobile app code remains unchanged.


I have to use HMS Push Services in order to make my RN App working for Huawei EMUI devices: HMS Core.

I followed all the required steps to install and configure HMS both on the server and on the mobile App.

However... I noticed a weird behavior. I use a button on the web page to send a Push Notification from the server to the Mobile App. I ensured that Push Kit is enabled on my Huawei ID and the Push Device Token is the correct one.

Sometimes the notification is sent and sometimes no. I tried all the day to find the cause, but for now it seems to be completely aleatory, at least until the cause will be not found.

Please note that in the code below the mc.send() goes every times into the .then() and never raised the .catch().

Sometimes I get: OK {"code":"80000000","msg":"Success","requestId":"161832746491754926000107"} and the notification is actually received from the Mobile App (all fine!).

Sometimes (and quite often): OK {"code":"80300002","msg":"No permission to send message to these tmIDs","requestId":"161832753512250325000107"}

Lastly, I am getting continuously: OK {"code":"80000000","msg":"Success","requestId":"161832795126307445060711"} but... the App does not receives actually the notification.

I tried to restart server, keep the App in the three various States (closed, foreground, background), but nothing helped me to find the problem.

This is the last version of the code I use to send the notification (I changed it many times):

function sendPushNotificationHMS(pushDeviceToken, data, attempt){
  hcm.init({
      appId: configHMS.AppId,
      appSecret: configHMS.AppSecret,
      authUrl: configHMS.AuthUrl,
      pushUrl: configHMS.PushUrl
  });
  let mc = hcm.messaging().messaging;

  let androidConfig = {
      collapse_key: -1,
      urgency:"HIGH",
      ttl: "10000s",
      bi_tag: "the_sample_bi_tag_for_receipt_service",
  }

  let message = {
      data: JSON.stringify(data),
      android: androidConfig,
      token: new Array(pushDeviceToken)
  };

  mc.send(message, true).then(data => {
      console.log('OK ', data);
  }).catch(err => {
      console.log('ERR ', err);
  });
}
shogitai
  • 1,823
  • 1
  • 23
  • 50
  • 1
    hi@kitsune,Thank you for your feedback.The team confirms that this issue is known and will be corrected today. – zhangxaochen Apr 14 '21 at 02:24
  • 1
    Thanks for the reply. HMS is new but promising, we trust that the problem will be solved. Regards – shogitai Apr 14 '21 at 06:34
  • hi@kitsune,The team just confirmed that the problem was fixed yesterday. You can try again. – zhangxaochen Apr 15 '21 at 01:31
  • 1
    Hi @shirley, thank you for your support. We noticed that now the problem seems to be solved since we encountered anymore this issue. Good job! – shogitai Apr 16 '21 at 11:43

1 Answers1

0

Please refer to this documentation:

https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/commonerror-0000001059816656

and see if one of the solution under 80300002 is correct. Since you have checked if your IDs are correct, please check the tips under 2, 4, 6, and 7.

Zinna
  • 1,947
  • 2
  • 5
  • 20