华为厂商通道收到通知包括点击等没有回调方法。

用户3092379
2021-01-21 07:44 233 1

其它平台接收通知都会走 PushMessageReceiver 里面的方法,包括点击等操作,这样可以做到自定义一些需求。但是华为通道下发通知后可以收到通知,但是没有接收回调等方法,点击通知后会自动打开应用,但我的需求要在收到通知时做一些操作,请问要怎么实现?
下面是push相关的logcat信息:
2021-01-21 15:29:02.386 3044-3873/? I/PushLog100101304: [SocketRead_13:39:09-10131]enter cancelAlarm(Action=com.huawei.android.push.intent.RESPONSE_FAIL
2021-01-21 15:29:02.391 3044-3873/? I/PushLog100101304: [SocketRead_13:39:09-10131]process cmdid to receive from pushSrv:44, subCmdId:FF
2021-01-21 15:29:02.396 3044-3873/? I/PushLog100101304: [SocketRead_13:39:09-10131]dispatchIntent over
2021-01-21 15:29:02.398 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]process push message cmdid from pushSrv:44, subCmdId:FF
2021-01-21 15:29:02.427 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]msgType: 2 [0:PassBy msg, 1:System notification, 2:normal notification, 3:HCM PassBy msg]
2021-01-21 15:29:02.431 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109] closeTokenCheck: false
2021-01-21 15:29:02.435 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]areNotificationsEnabledForPackage:true
2021-01-21 15:29:02.435 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]isChannelAllowDisplay
2021-01-21 15:29:02.437 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]com.booway.forecastingwarning in user 0 ,uid is 10305
2021-01-21 15:29:02.439 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]importance:3
2021-01-21 15:29:02.439 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]receive a push msg,ctrl state:0, isDawn:false
2021-01-21 15:29:02.442 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]get com.huawei.android.pushagent version success , versionCode = 90100305
2021-01-21 15:29:02.454 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]areNotificationsEnabledForPackage:true
2021-01-21 15:29:02.454 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]send selfshow msg to NC to display, pkgName:com.booway.forecastingwarning,msgID:C4055EE830A7F1A5,haStorageId:-1,userId:0
2021-01-21 15:29:02.455 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]add com.huawei.android.pushagent to doze temp white list
2021-01-21 15:29:02.459 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]isSupportsMultiUsers: true
2021-01-21 15:29:02.462 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]process cmdid to send to pushSrv:45, subCmdId:FF
2021-01-21 15:29:02.465 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]send msg to remote srv success
2021-01-21 15:29:02.466 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]handleMessageResponse the response msg is :45,msgId:C4055EE830A7F1A5,displayPkgName:com.booway.forecastingwarning,flag:00
2021-01-21 15:29:02.466 3044-3089/? I/PushLog100101304: [ReceiverDispatcher-10109]enter AlarmTools:setInexactAlarm(intent:Intent { act=com.huawei.action.push.intent.CHECK_CHANNEL_CYCLE pkg=android } interval:1200000ms
2021-01-21 15:29:02.473 12790-12790/? I/PushLogNC90100305: [main-1]push receive broadcast message, Intent:com.huawei.intent.action.PUSH pkgName:com.huawei.android.pushagent(pushagent/PushEventReceiver.java:38)
2021-01-21 15:29:02.473 12790-12790/? D/PushLogNC90100305: Begin to init mFileNode
2021-01-21 15:29:02.476 12790-12790/? D/PushLogNC90100305: whether write file log:true
2021-01-21 15:29:02.477 12790-12790/? I/PushLogNC90100305: [main-1]action is com.huawei.intent.action.PUSH(pushagent/PushEventReceiver.java:50)
2021-01-21 15:29:02.481 12790-12790/? I/PushLogNC90100305: [main-1]run push selfshow(pushagent/PushEventReceiver.java:119)
2021-01-21 15:29:02.482 12790-12790/? D/PushLogNC90100305: Begin to init mFileNode
2021-01-21 15:29:02.482 12790-12790/? D/PushLogNC90100305: whether write file log:true
2021-01-21 15:29:02.482 12790-12790/? I/PushLogNC90100305: [main-1]NC receive the msgid:C4055EE830A7F1A5(pushagent/SelfShowReceiver.java:54)
2021-01-21 15:29:02.483 12790-12790/? I/PushLogNC90100305: [main-1]NC receive the clickId:[-1442480222],cmd:[app],eventId:null
2021-01-21 15:29:02.483 12790-12790/? I/PushLogNC90100305: [main-1]receive a selfshow message ,the type isapp(pushagent/SelfShowReceiver.java:99)
2021-01-21 15:29:02.489 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]handle to display push notification.(pushagent/PushSelfShowThread.java:29)
2021-01-21 15:29:02.490 1351-13274/? V/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{7ed496d u0 com.huawei.intent.action.PUSH}
2021-01-21 15:29:02.490 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]get small icon from com.booway.forecastingwarning(pushagent/NotificationIconUtil.java:280)
2021-01-21 15:29:02.502 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]getEmuiLevel:19(pushagent/BaseUtil.java:137)
2021-01-21 15:29:02.502 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]huawei phone, and emui5.0, need not show large icon.(pushagent/NotificationIconUtil.java:192)
2021-01-21 15:29:02.504 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]uid:10305(pushagent/PushNotification.java:397)
2021-01-21 15:29:02.507 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]createChannelForTargetPackage success, target pkg is com.booway.forecastingwarning(pushagent/PushNotification.java:362)
2021-01-21 15:29:02.510 1351-13274/? I/NotificationService: enqueueNotificationInternal: pkg=com.booway.forecastingwarning id=322228119 notification=Notification(channel=com.huawei.android.pushagent pri=0 contentView=null vibrate=null sound=default tick defaults=0x1 flags=0x10 color=0x00000000 vis=PRIVATE)
2021-01-21 15:29:02.516 12790-26682/? I/PushLogNC90100305: [Thread-92-10621] init NC BI reporter.(pushagent/BIReporter.java:47)
2021-01-21 15:29:02.530 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]Report BI event, cmd =app, msgid = -1442480222, eventId = 0,notifyId= 322228119(pushagent/BIReporter.java:98)
2021-01-21 15:29:02.532 12790-26682/? I/PushLogNC90100305: [Thread-92-10621]event cached(pushagent/BIReporter.java:125)
2021-01-21 15:29:02.540 1351-1351/? V/HwNotificationManagerService: isHwSoundAllow pkg=com.booway.forecastingwarning, channelId=com.huawei.android.pushagent, userId=0, cfg=1
2021-01-21 15:29:19.811 12790-12790/? I/PushLogNC90100305: [main-1]push receive broadcast message, Intent:com.huawei.intent.action.PUSH_DELAY_NOTIFY pkgName:com.huawei.android.pushagent(pushagent/PushEventReceiver.java:38)
2021-01-21 15:29:19.812 12790-12790/? D/PushLogNC90100305: Begin to init mFileNode
2021-01-21 15:29:19.816 12790-12790/? D/PushLogNC90100305: whether write file log:true
2021-01-21 15:29:19.817 12790-12790/? I/PushLogNC90100305: [main-1]action is com.huawei.intent.action.PUSH_DELAY_NOTIFY(pushagent/PushEventReceiver.java:50)
2021-01-21 15:29:19.827 12790-12790/? I/PushLogNC90100305: [main-1]run push selfshow(pushagent/PushEventReceiver.java:119)
2021-01-21 15:29:19.828 12790-12790/? D/PushLogNC90100305: Begin to init mFileNode
2021-01-21 15:29:19.828 12790-12790/? D/PushLogNC90100305: whether write file log:true
2021-01-21 15:29:19.829 12790-12790/? I/PushLogNC90100305: [main-1]NC receive the notifyId:322228119(pushagent/SelfShowReceiver.java:66)
2021-01-21 15:29:19.830 12790-12790/? I/PushLogNC90100305: [main-1]NC receive the clickId:[-1442480222],cmd:[app],eventId:2
2021-01-21 15:29:19.830 12790-12790/? I/PushLogNC90100305: [main-1]receive a message click event.(pushagent/SelfShowReceiver.java:122)
2021-01-21 15:29:19.837 12790-12790/? I/PushLogNC90100305: [main-1] init NC BI reporter.(pushagent/BIReporter.java:47)
2021-01-21 15:29:19.859 12790-12790/? I/PushLogNC90100305: [main-1]Report BI event, cmd =app, msgid = -1442480222, eventId = 2,notifyId= 322228119(pushagent/BIReporter.java:98)
2021-01-21 15:29:19.861 12790-12790/? I/PushLogNC90100305: [main-1]event cached(pushagent/BIReporter.java:125)
2021-01-21 15:29:19.863 1351-1702/? V/BroadcastQueue: Finished with ordered broadcast BroadcastRecord{6411611 u0 com.huawei.intent.action.PUSH_DELAY_NOTIFY}

2个回答

热门排序
  • 用户3092379
    2021-01-21 08:52
    我看到华为文档里面这条有办法让自己的receiver接收消息:https://developer.huawei.com/consumer/cn/doc/development/HMSCore-Guides-V5/android-fgrd-s 展示全部
  • 用户4419738
    2021-01-21 07:46

    查看此文章的第4,5点:https://community.jiguang.cn/article/464985

gptbots-widget