Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HMS Push notifications issue on HMS+GMS devices

Tags:

I am encountering an issue regarding HMS on a Samsung device, which has GMS too.

Huawei notifications are of two types:

  1. Data Messages (DM)
  2. Notification Messages (NM)

Huawei device (HMS only)

NM If we send NM, then the pushes arrive at the App in any state (closed, background and foreground), but they are not be processed automatically... it has to be tappet iw I want to be processed by the App. It seems to be a limitation imposed by HMS. And this could be okay for now.

DM If we send DM, then the pushes can be processed automatically by the App, but they arrive at the App only if the status of the App is foreground (processed automatically) or background. They are not received (no sounds, no bubble, ...) if the App is in the closed state. But this for the moment is not a bug issue.

Non-Huawei devices (HMS + GMS), e.g. Samsung A10

NM Same as HMS only above, except they are not processed in any way. This is a big problem... we need the payload of the NM is passed to the App. ⚠️

DM If we send DM, bad ... the push notifications are not even processed and they arrive at the App only if the status of the App is foreground or background. They are not received (no sounds, no bubble, ...) if the App is in the closed state. This problem could be an HMS Core misconfiguration problem... but it is not said. ⚠️

We have registered ads logs (below, filtered by HMSSDK):

05-05 15:38:19.130  4452  4688 D SDHMS:s : SIOP:: AP:270(293,30) BAT:261(261,0) CHG:0(0,0) USB:0(0,0) 
05-05 15:38:24.045   551 16859 I PushLog3203_HMS: [SocketRead_15:36:31-2319]process cmdid to receive from pushSrv:44(:277)
05-05 15:38:24.050   551 16859 I PushLog3203_HMS: [SocketRead_15:36:31-2319]dispatchIntent over(:277)
05-05 15:38:24.051   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]enter ConnectReceiver:onReceive(:277)
05-05 15:38:24.052   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]enter CommandReceiver:onReceive,Intent { act=com.huawei.android.push.intent.MSG_RECEIVED (has extras) }(:277)
05-05 15:38:24.059   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]Device type is :2 [1:NOT_GDPR, 2:GDPR](:277)
05-05 15:38:24.060   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]msgType: 2 [0:PassBy msg, 1:System notification, 2:normal notification](:277)
05-05 15:38:24.076   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]send selfshow msg to [my.appid](:277)
05-05 15:38:24.076   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]send msg(:277)
05-05 15:38:24.076   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]bindservice(:277)
05-05 15:38:24.083   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]startService: actioncom.huawei.push.msg.NOTIFY_MSG(:277)
05-05 15:38:24.084   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]process cmdid to send to pushSrv:45(:277)
05-05 15:38:24.086   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]send msg to remote srv success(:277)
05-05 15:38:24.086   551 16857 I PushLog3203_HMS: [ReceiverDispatcher-2317]rspPushMessage the response msg is :45,msgId:08415B32F5B0813B,flag:00(:277)
05-05 15:38:24.094 16862 16862 I HMSSDK_HmsMsgService: onBind
05-05 15:38:24.102   551   551 I PushLog3203_HMS: [main-2]on service connected(:277)
05-05 15:38:24.118 16862 16862 I HMSSDK_HmsMsgService: chose push type
05-05 15:38:24.123 16862 16862 I HMSSDK_HmsMsgService: invokeSelfShow
05-05 15:38:24.130 16862 16862 I HMSSDK_PushSelfShowLog: get notifyId:0
05-05 15:38:24.140 16862 16862 I HMSSDK_PushSelfShowLog:  onReceive the msg id = -1979310593,and cmd iscosa,and the eventId is null
05-05 15:38:24.143 16862 16862 I HMSSDK_PushSelfShowLog: receive a selfshow message ,the type iscosa
05-05 15:38:24.147 16862 16862 I HMSSDK_PushSelfShowLog: startIndex is 31,ap is:,length is:0
05-05 15:38:24.151 16862 16862 I HMSSDK_HmsMsgService: invokeSelfShow done
05-05 15:38:24.151 16862 17852 I HMSSDK_PushSelfShowLog: enter run()
05-05 15:38:24.163 16862 17852 I HMSSDK_PushSelfShowLog: exportedFlag:true
05-05 15:38:24.166 16862 17852 I HMSSDK_PushSelfShowLog: need permission:null
05-05 15:38:24.171 16862 17852 I HMSSDK_PushSelfShowLog: get left bitmap from my.appid
05-05 15:38:24.205 16862 17852 I HMSSDK_PushSelfShowLog: setAutoClear time is: 0
05-05 15:38:24.209 16862 17852 I HMSSDK_PushAnalyticsUtils: Not support report BI
05-05 15:38:28.603 16803 16803 I HMSSDK_PushMsgReceiver: push receive broadcast message, Intent:com.huawei.intent.action.PUSH_DELAY_NOTIFY pkgName:my.appid
05-05 15:38:28.610 16803 16803 I HMSSDK_PushSelfShowLog: get notifyId:-542625601
05-05 15:38:28.618 16803 16803 I HMSSDK_PushSelfShowLog:  onReceive the msg id = -1979310593,and cmd iscosa,and the eventId is 1
05-05 15:38:28.624 16803 16803 I HMSSDK_PushSelfShowLog: run into launchCosaApp 
05-05 15:38:28.627 16803 16803 I HMSSDK_PushSelfShowLog: enter launchExistApp cosa, appPackageName =my.appid,and msg.intentUri is strongauth
05-05 15:38:28.634 16803 16803 I HMSSDK_PushSelfShowLog: Intent.parseUri(msg.intentUri, 0),android.intent.action.VIEW
05-05 15:38:28.640 16803 16803 I HMSSDK_PushSelfShowLog: exportedFlag:true
05-05 15:38:28.642 16803 16803 I HMSSDK_PushSelfShowLog: need permission:null
05-05 15:38:28.646 16803 16803 I HMSSDK_PushSelfShowLog: start #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x30020000;package=my.appid;component=my.appid/.MainActivity;end
05-05 15:38:28.668 16803 16803 I HMSSDK_PushAnalyticsUtils: Not support report BI
05-05 15:38:29.180  4452  4688 D SDHMS:s : SIOP:: AP:272(297,30) BAT:261(261,0) CHG:0(0,0) USB:0(0,0) 

but I have not clear at all what is happening... why notification payload is passed correctly to the App when using Huawei device and when using Samsung device is not working?

like image 489
shogitai Avatar asked May 06 '21 09:05

shogitai


2 Answers

I believe you have already installed HMS Core to receive the push notifications. However, on non-Huawei devices, HMS Core is not treated as a system app. It's possible that the OS/battery-optimizer will kill the HMS Core process and cause issues with receiving push messages.

Even if HMS Core staying alive in the background is not the root cause, please note that there is no official support for this use case on non-Huawei devices. As you are testing this on a Samsung device, it is recommended that you implement push using GMS instead.

like image 134
Zinna Avatar answered Sep 30 '22 16:09

Zinna


why notification payload is passed correctly to the App when using Huawei device and when using Samsung device is not working?

Currently, the message delivery rate of non-Huawei mobile phones cannot be guaranteed stably.

Notifications can pass parameters in either of the intent parameter or the action pass the date parameter by now.

The intent parameter can also be used on non-Huawei mobile phones.But to pass data to your app through the data field, the Push Service app version must be 9.1.1 or later.

Therefore, if the notification needs to transfer parameters, you may can use the intent parameter.

For details, see Docs.

like image 26
zhangxaochen Avatar answered Sep 30 '22 14:09

zhangxaochen