2

我从这种类型的服务器发送通知:

let message = {
  notification: notification,
  android: {
        notification: {
               channel_id: "huawei-hms-rn-push-channel",
               ...
        },
        urgency: "HIGH",
        ... 
  },
  token: new Array(pushDeviceToken)
};

mc.send(message, false).then(...);

频道“huawei-hms-rn-push-channel”已经存在,是在App安装时创建的。

通知正确到达,但我们注意到通知来了,创建了一个新通道“中优先级通道”,不幸的是,通知没有传递到“huawei-hms-rn-push-channel”。

我们的目标是在应用程序的任何状态下显示通知横幅。


更新 1

Android logcat 日志:

--------- beginning of system
06-25 10:59:48.973  1427  1552 I AppEyeFwkBlock: do monitor
--------- beginning of main
06-25 10:59:49.549  1427  1899 I WificondControl: Noise: 0, Snr: -1, Chload: 6, rssi: -45, txBitrate: 390, rxBitrate: 433, frequency: 5260, UlDelay: -1, currentTxBytes: 1010707, currentTxPackets: 9508, currentTxFailed: 0, currentRxBytes: 10976153, currentRxPackets: 14883
06-25 10:59:49.553  1427  1974 I HwQoeQualityMonitor: continue check internet for app : com.huawei.android.launcher
06-25 10:59:49.553  1427  1898 I WiFi_PRO: MSG_RETURN_AP_CURRY_RSSI rssi = -45
06-25 10:59:49.553  1427  1974 I HuaweiWifiWatchdogStateMachine: POta txb txg rxg:0, 13, 0. Lr =0% Totpkt=13
06-25 10:59:49.553  1427 14604 I HwUidTcpMonitor: TcpStatisticsRun run
06-25 10:59:49.553  1427  1898 I QosMonitor: queryRtt: rttType = 3
06-25 10:59:49.553  1427 14604 I HwWifiProServiceProxy: ctrlHwWifiNetwork pkgName: WIFIPRO_SERVICE interfaceId: 79
06-25 10:59:49.554  1427  1898 I HwWifiProServiceProxy: ctrlHwWifiNetwork pkgName: WIFIPRO_SERVICE interfaceId: 8
06-25 10:59:49.554  1427 14605 I HwWifiProServiceProxy: TcpStatisticsRun run
06-25 10:59:49.555  1427  1898 I QosMonitor: postEventFromNative: msg=100,arg1=4,arg2=10
06-25 10:59:49.555  1427  1898 I HwWifiProServiceProxy: ctrlHwWifiNetwork pkgName: WIFIPRO_SERVICE interfaceId: 8
06-25 10:59:49.556  1427  1898 I QosMonitor: postEventFromNative: msg=100,arg1=0,arg2=10
06-25 10:59:49.556  1427  1898 I MQoS    : rtt=416,tcpTxPkts=9022,tcpRxPkts=9574
06-25 10:59:49.555    47    47 W migration/6: type=1400 audit(0.0:22171): avc: granted { setsched } for pid=47 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=process
06-25 10:59:49.556  1427  5567 D HwConnectivityServiceEx: set 1000 wlan0 value false
06-25 10:59:49.558  1427  1974 I HuaweiWifiWatchdogStateMachine: PTcp RTT:0, rtt pkt=0, tcp_rx=0, tcp_tx=0, tcp_reTran=0, rtRate=0
06-25 10:59:49.558  1427  1974 I HuaweiWifiWatchdogStateMachine: start computeQosLevel tcpRtt = 0 ,rssi = -45 ,mBestSpeedInPeriod = 1247
06-25 10:59:49.561  1427  5567 I MQoS    : QOS_level:0(0),wifi-link;SIM error;use level-0
06-25 10:59:49.561  1427  5567 I MQoS    : skip-low-Level:0(0),wifi-link;SIM error;use level-0
06-25 10:59:49.579  1427  1898 I TrafficMonitor: expired arrive. level:-1
06-25 10:59:49.582  1427  1898 I TrafficMonitor: update:rxPkts:4,txPkts:0,rxBytes:1506,txBytes:0
06-25 10:59:49.582  1427  1898 I TrafficMonitor: start expired. level:-1
06-25 10:59:49.582  1427  1898 I TrafficMonitor: gettimer:interval=5000
06-25 10:59:49.582  1427  1898 I TrafficMonitor: during_ms:5003,period_ms:2000
06-25 10:59:49.582  1427  1898 I TrafficMonitor: count:400,rx_sum:4,tx_sum:0,rxBytes:1506,during_ms:5003,rx_speed:301.0193883669798,tx_speed:0.0,rto:0.0
06-25 10:59:49.582  1427  1898 I HuaweiWifiWatchdogStateMachine: Get speed information rx_speed = 301 ,tx_speed = 0 ,isSpeedOk = false ,mBestSpeedInPeriod = 1247
06-25 10:59:49.659    47    47 W migration/6: type=1400 audit(0.0:22172): avc: granted { setsched } for pid=47 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=process
06-25 10:59:49.793   646  9901 I netd    : trafficSwapActiveStatsMap() <10.99ms>
06-25 10:59:50.534  3055  3977 I PushLog110102300: [SocketRead_09:54:58-81]enter cancelAlarm(Action=com.huawei.android.push.intent.RESPONSE_FAIL
06-25 10:59:50.537  3055  3977 I PushLog110102300: [SocketRead_09:54:58-81]process cmdid to receive from pushSrv:44, subCmdId:FF
06-25 10:59:50.540  3055  3977 I PushLog110102300: [SocketRead_09:54:58-81]dispatchIntent over
06-25 10:59:50.541  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]process push message cmdid from pushSrv:44, subCmdId:FF
06-25 10:59:50.543    47    47 W migration/6: type=1400 audit(0.0:22173): avc: granted { setsched } for pid=47 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=process
06-25 10:59:50.553  3055  3679 E         : [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
06-25 10:59:50.554  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]msgType: 2 [0:PassBy msg, 1:System notification, 2:normal notification, 3:HCM PassBy msg]
06-25 10:59:50.558  3055  3809 I PushLog110102300: [ReceiverDispatcher-58] closeTokenCheck: false
06-25 10:59:50.562  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]custom channel not exist: huawei-hms-rn-push-channel
06-25 10:59:50.563  3055  3809 E SecurityComp10105302: kj: content or algorithm is null.
06-25 10:59:50.563  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]accountVerify profileId is empty.
06-25 10:59:50.564  1427  2129 I HwResolverManager: isMultiScreenCollaborationEnabled: Operate settings exception! 
06-25 10:59:50.568  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]receive a push msg,ctrl state:0, isDawn:false
06-25 10:59:50.568  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]send selfshow msg to NC to display, pkgName:my.app.package,msgID:0F5651DE4BE06117,haStorageId:-1,userId:0,subjectId:
06-25 10:59:50.570  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]get com.huawei.android.pushagent version success , versionCode = 110102302
06-25 10:59:50.575  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]add com.huawei.android.pushagent to doze temp white list
06-25 10:59:50.579  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]AiClose Switch is off
06-25 10:59:50.579  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]process cmdid to send to pushSrv:45, subCmdId:FF
06-25 10:59:50.581  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]send msg to remote srv success
06-25 10:59:50.582  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]handleMessageResponse the response msg is :45,msgId:0F5651DE4BE06117,displayPkgName:my.app.package,flag:00
06-25 10:59:50.582  3055  3809 I PushLog110102300: [ReceiverDispatcher-58]enter AlarmTools:setInexactAlarm(intent:Intent { act=com.huawei.action.push.intent.CHECK_CHANNEL_CYCLE pkg=android } interval:1200000ms
06-25 10:59:50.588 12583 12583 I PushLogNC110102302: [main-1]NC receive a push message, Intent:com.huawei.intent.action.PUSH(pushagent/:40)
06-25 10:59:50.589 12583 12583 I PushLogNC110102302: [main-1]NC receive the eventId:null(pushagent/:43)
06-25 10:59:50.566  1427  2129 I chatty  : uid=1000(system) Binder:1427_6 identical 2 lines
06-25 10:59:50.567  1427  2129 I HwResolverManager: isMultiScreenCollaborationEnabled: Operate settings exception! 
06-25 10:59:50.589  1427  2129 I AlarmManager: remove alarm:Alarm{e43a43 type 1 when 1624612743573 PendingIntent{59400f6: PendingIntentRecord{148d1b7 android broadcastIntent}}android procName com.huawei.android.pushagent.PushService} according to operation:c6923f2
06-25 10:59:50.589 12583 12583 I PushLogNC110102302: [main-1]NC receive the notifyId:0(pushagent/:47)
06-25 10:59:50.591  1427  2392 V BroadcastQueue: Finished with ordered broadcast BroadcastRecord{554eb54 u0 com.huawei.intent.action.PUSH}
06-25 10:59:50.591  1427  2129 D SmartHeartBeat: isPendingAlarm, false, pkg:com.android.deskclock, action:com.android.deskclock.ALARM_ALERT,not pending alarm with AlarmClockInfo
06-25 10:59:50.592 12583 14608 D PushLogNC110102302: Begin to init mFileNode
06-25 10:59:50.592 12583 14608 D PushLogNC110102302: whether write file log:true
06-25 10:59:50.593 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]NC receive the msgId:[-1308221953],cmd:[cosa],eventId:[null](pushagent/:66)
06-25 10:59:50.593 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]receive a selfshow message ,the type iscosa(pushagent/:101)
06-25 10:59:50.593  1427  2392 I ActivityManager: Killing 8565:android.process.acore/u0a4 (adj 925): empty #33
06-25 10:59:50.594 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]handle to display push notification.(pushagent/:26)
06-25 10:59:50.603    53    53 W migration/7: type=1400 audit(0.0:22174): avc: granted { setsched } for pid=53 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=process
06-25 10:59:50.606  1427  6796 I HwResolverManager: isMultiScreenCollaborationEnabled: Operate settings exception! 
06-25 10:59:50.611 12583 14608 W PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]need permission:null(pushagent/:470)
06-25 10:59:50.611 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]getSmallIcon(pushagent/:256)
06-25 10:59:50.612 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]resource or package name is empty(pushagent/:258)
06-25 10:59:50.613 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]get target application icon (pushagent/:280)
06-25 10:59:50.613 12583 14608 W PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]mutiLang title or content is null(pushagent/:382)
06-25 10:59:50.614 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]notify big icon url is not valid.(pushagent/:96)
06-25 10:59:50.617 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]getNotificationChannel pkgName: my.app.package channelId: huawei-hms-rn-push-channel(pushagent/:61)
06-25 10:59:50.618 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]getNotificationChannel pkgName: my.app.package channelId: com.huawei.android.pushagent48444(pushagent/:61)
06-25 10:59:50.619 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]channel has been created by NC, do not need to create again(pushagent/:111)
06-25 10:59:50.609  1427  6796 I chatty  : uid=1000(system) Binder:1427_14 identical 2 lines
06-25 10:59:50.610  1427  6796 I HwResolverManager: isMultiScreenCollaborationEnabled: Operate settings exception! 
06-25 10:59:50.620  1427  6796 D ActivityManager: cleanUpApplicationRecord app: 8565:android.process.acore/u0a4, bad: false, restarting: false, allowRestart: true
06-25 10:59:50.620  1427  1618 I HwPowerManagerService: appdie release wakelock, pid = 8565, uid = 10004
06-25 10:59:50.620  1427  6796 I ActivityManager: Killing 13069:com.huawei.contacts/u0a111 (adj 925): depends on provider com.android.providers.contacts/.ContactsProvider2 in dying proc android.process.acore (adj 925)
06-25 10:59:50.620  1427  1926 I HwAudioServiceEx: sendAppKilledIntentForKit, isKitPackageOnPause = false, isKitPackageKill = false, isKitPackageOnResume = false
06-25 10:59:50.620 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]uid:10174(pushagent/:732)
06-25 10:59:50.621 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]channel priority : 0 [0:Medium Level Channel, 1:High Level Channel, 2:Low Level Channel](pushagent/:266)
06-25 10:59:50.622  2181  3653 E AwareLog: Stub: processProcessDied has not been overridden!
06-25 10:59:50.622 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]createChannelForTargetPackage success, target pkg is my.app.package(pushagent/:281)
06-25 10:59:50.622  2010  2418 I BoosterSwitchP: notifyUidState do nothing
06-25 10:59:50.622  2010  2418 I DeepNoDisturbP: notifyUidState
06-25 10:59:50.622  2010  2418 I BrowserChrP: notifyUidState
06-25 10:59:50.622 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]flash channel name for target package success by NC(pushagent/:156)
06-25 10:59:50.623  1427  1462 V HwNotificationService: Notification Center targetPkg:my.app.package
06-25 10:59:50.624  1427  1462 I NotificationService: enqueueNotificationInternal: pkg=my.app.package id=-542625601 notification=Notification(channel=com.huawei.android.pushagent48444 pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x110 color=0x00000000 vis=PUBLIC)
06-25 10:59:50.625  2010  2418 E HsmCoreServiceImpl: onTransact in code is: 102
06-25 10:59:50.625  2010  2418 I MediaProcessHandler: processOp opType: 1, uid: 10004, pid: 8565
06-25 10:59:50.625  2010  2418 W MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10004, pid: 8565
06-25 10:59:50.625  2010  2418 I MediaProcessHandler: executedCallBack opType: 1 mMediaStatusObservers.size=0
06-25 10:59:50.625  1427  1462 I NotificationService: enqueueNotificationInternal Channel Info : pkg=my.app.package id=-542625601 importance =3
06-25 10:59:50.629 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]setAutoClear time is: 0(pushagent/:197)
06-25 10:59:50.630 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]BadgeClassName: PackageName:com.huawei.android.pushagent DispPkgName:my.app.package BadgeAddNum:1 BadgeSetNum:-1(pushagent/:224)
06-25 10:59:50.630 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]no need to refresh badge number.(pushagent/:230)
06-25 10:59:50.630 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]no need send notify info broadcast(pushagent/:542)
06-25 10:59:50.630 12583 14608 I PushLogNC110102302: [ReceiverHandler-pool-thread-4-167]biurl is null, not report data to bi.(pushagent/:277)
06-25 10:59:50.635  2266  2562 E         : [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
06-25 10:59:50.635   647   647 I Zygote  : Process 8565 exited due to signal 9 (Killed)
06-25 10:59:50.637  1427  1670 I libprocessgroup: Successfully killed process cgroup uid 10004 pid 8565 in 41ms
06-25 10:59:50.638  1427  2392 D ActivityManager: cleanUpApplicationRecord app: 13069:com.huawei.contacts/u0a111, bad: false, restarting: false, allowRestart: true
06-25 10:59:50.638  1427  1926 I HwAudioServiceEx: sendAppKilledIntentForKit, isKitPackageOnPause = false, isKitPackageKill = false, isKitPackageOnResume = false
06-25 10:59:50.638  1427  1618 I HwPowerManagerService: appdie release wakelock, pid = 13069, uid = 10111
06-25 10:59:50.639  2010  2418 I BoosterSwitchP: notifyUidState do nothing
06-25 10:59:50.639  2010  2418 I DeepNoDisturbP: notifyUidState
06-25 10:59:50.639  2010  2418 I BrowserChrP: notifyUidState
06-25 10:59:50.639  2010  2418 E HsmCoreServiceImpl: onTransact in code is: 102
06-25 10:59:50.640  2010  2418 I MediaProcessHandler: processOp opType: 1, uid: 10111, pid: 13069
06-25 10:59:50.640  2010  2418 W MediaProcessHandler: remove target not exist, maybe the UI process: uid: 10111, pid: 13069
06-25 10:59:50.640  2010  2418 I MediaProcessHandler: executedCallBack opType: 1 mMediaStatusObservers.size=0
06-25 10:59:50.640  2181  3653 E AwareLog: Stub: processProcessDied has not been overridden!
06-25 10:59:50.652  2266  2562 I id.ext.service: Explicit concurrent copying GC freed 988(95KB) AllocSpace objects, 0(0B) LOS objects, 82% free, 1272KB/7416KB, paused 51us total 17.236ms
06-25 10:59:50.653  2266  2562 W ExtAssistant: trimMemory. false
06-25 10:59:50.657   646  9901 I netd    : trafficSwapActiveStatsMap() <25.63ms>
06-25 10:59:50.662   647   647 I Zygote  : Process 13069 exited due to signal 9 (Killed)
06-25 10:59:50.683  1427  1670 I libprocessgroup: Successfully killed process cgroup uid 10111 pid 13069 in 45ms
06-25 10:59:50.735  1427  1427 V HwNotificationService: isHwSoundAllow pkg=my.app.package, channelId=com.huawei.android.pushagent48444, userId=0, cfg=3
06-25 10:59:50.735  1427  1427 V HwNotificationService: isHwVibrateAllow pkg=my.app.package, channelId=com.huawei.android.pushagent48444, userId=0, cfg=3
06-25 10:59:50.735  1427  1427 I NotificationService: buzzBeepBlinkLocked hasValidSound=true,hasValidVibrate=true,key=0|my.app.package|-542625601|null|10174
06-25 10:59:50.735  1427  1427 V NotificationService: Interrupting!
06-25 10:59:50.736  1427  1427 V AudioManager: getStreamVolume streamType: 5 volume: 15
06-25 10:59:50.736  1427  1427 V AudioManager: getRingtonePlayer...
06-25 10:59:50.737  2000  3262 I RingtonePlayer: acquireWakeLock. held : false
06-25 10:59:50.741  1427  1427 I HwNotificationService: specialType is: ,topFullscreen is:false,HWMULTIWIN_ENABLED is:true
06-25 10:59:50.741  1427  1427 D HwNotificationService: mGameDndStatus is:false ,isGameDndSwitchOn is:false,isDeferLaunchActivity is:false
06-25 10:59:50.743  2181  2529 I AppManager: app:my.app.package Notification update time:3925426
06-25 10:59:50.745  1427  1427 D AudioManager: dispatching onPlaybackConfigChanged()
06-25 10:59:50.746  2000 14612 W MediaPlayer: Couldn't open uri in attemptDataSource
06-25 10:59:50.746  2289  3249 D AudioManager: dispatching onPlaybackConfigChanged()
06-25 10:59:50.747  2000  2000 I NotificationListener: onNotificationPosted: StatusBarNotification(pkg=my.app.package user=UserHandle{0} id=-542625601 tag=null key=0|my.app.package|-542625601|null|10174: Notification(channel=com.huawei.android.pushagent48444 pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x110 color=0x00000000 vis=PUBLIC)) important=3, post=1624611590625, when=1624611590614,showWhen=true, vis=1, userid=0, hasFullScreenIntent=false
06-25 10:59:50.748  1427  6796 V ActivityManager: Successfully start provider ContentProviderRecord{2d3b5ef u0 com.android.providers.media/.MediaProvider} launchingApp=null caller pid= 2000
06-25 10:59:50.758  2000  2000 I HwNotificationMenuRowImpl: checkNotificationIconColor Notification(channel=com.huawei.android.pushagent48444 pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x110 color=0x00000000 vis=PUBLIC)false
06-25 10:59:50.759  3751  7348 I ctaifs  : <IU sistema>[IU sistema][com.android.systemui]:[openFile] openFile
06-25 10:59:50.762  2000  2000 I NotificationViewHierarchyManager: updateNotificationViews activeNotificationSize=5
06-25 10:59:50.763   885  1259 I MediaPlayerService: Client(28) constructor pid = 2000
06-25 10:59:50.763   885  1259 I MediaPlayerService: player type = 4
06-25 10:59:50.763   885  1259 I MediaPlayerService: create player pid = 2000
06-25 10:59:50.763   885  1259 D NuPlayerDriver: NuPlayerDriver(0xe9cf3500) created, clientPid(2000)
06-25 10:59:50.764  2000  2000 I InterruptionStateProvider: No heads up: unimportant notification: 0|my.app.package|-542625601|null|10174
06-25 10:59:50.766   885  1259 I Codec2Client: Creating a Codec2 client to service "software"
06-25 10:59:50.767   885  1259 I Codec2Client: Client to Codec2 service "software" created
06-25 10:59:50.769   885  1259 I MediaPlayerService: [28] prepareAsync [pid:2000]
06-25 10:59:50.769  2000 14612 I MediaPlayerNative: prepare MediaPlayer(0x71bc229c00)
06-25 10:59:50.770  2181  2529 I PGAudioState: receive session 257 loop : false
06-25 10:59:50.770  2181  2529 I PGAudioState: audio loop can not find session 257
06-25 10:59:50.770   885 14615 D GenericSource: FileSource remote
06-25 10:59:50.772   883  1283 D MediaExtractorFactory: MediaExtractorFactory::CreateFromService (null), uid = 1013
06-25 10:59:50.774   883  1283 D MediaExtractorFactory: Created an extractor 'OggExtractor' with confidence 0.20
06-25 10:59:50.776  2000  3262 D MediaPlayerNative: Message: MEDIA_PREPARED(1), ext1=0, ext2=0x0
06-25 10:59:50.776  2000 14612 I MediaPlayerNative: prepare complete - status=0 MediaPlayer(0x71bc229c00)
06-25 10:59:50.780  1427  2392 I MediaFocusControl: requestAudioFocus() from uid/pid 10049/2000 clientId=android.media.AudioManager@4dc5080 callingPack=com.android.systemui req=3 flags=0x0 sdk=29
06-25 10:59:50.781  1427  2392 I HwPCUtils#HwMediaFocusControl: isMediaForDPExternalDisplay aa = AudioAttributes: usage=USAGE_NOTIFICATION content=CONTENT_TYPE_SONIFICATION flags=0x800 tags= bundle=null, clientId = android.media.AudioManager@4dc5080, pkgName = com.android.systemui, mInDestopMode = false, uid = 10049, isHiCarMode = false
06-25 10:59:50.781  1427  2392 I HwPCUtils#MediaFocusControl: requestAudioFocus isInExternalDisplay = false
06-25 10:59:50.863   722   722 E WifiHAL : enter wifi_get_link_stats
06-25 10:59:50.866  1427  1899 I WificondControl: Noise: 0, Snr: -1, Chload: 6, rssi: -45, txBitrate: 390, rxBitrate: 433, frequency: 5260, UlDelay: -1, currentTxBytes: 1011062, currentTxPackets: 9510, currentTxFailed: 0, currentRxBytes: 10977128, currentRxPackets: 14887
06-25 10:59:50.868  1427  1899 V HwWifiServiceFactory: get AllImpl object = com.android.server.wifi.HwWifiServiceFactoryImpl@3b34ecf
06-25 10:59:50.903    53    53 W migration/7: type=1400 audit(0.0:22175): avc: granted { setsched } for pid=53 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=process
06-25 10:59:51.069  2308  2308 I HiAdKit.ExSplashManager:  request exsplash config
06-25 10:59:51.071  2308 14621 I HiAdKit.ExSplashUtil:  cache exsplash mode:1
06-25 10:59:51.073  2308 14620 I HiAdKit.DeviceUtil:  getHMVerion, ver= 
06-25 10:59:51.079  2308 14620 I HiAdKit.SystemUtil:  isDeviceProvisioned: true
06-25 10:59:51.081  1427  2392 I HwResolverManager: isMultiScreenCollaborationEnabled: Operate settings exception! 
06-25 10:59:51.083  2308 14620 I HiAdKit.HttpCall:  oobe: false
06-25 10:59:51.086  2308 14620 I NetworkSdk_CountryCodeBean: [I/HMSCore/NetworkSdk_CountryCodeBean 2308:240 SourceFile:28] PPS-Net-pool-thread-21|null|com.huawei.hms.framework.network.grs.local.model.CountryCodeBean|getVendorCountryCode|40|countryCode by ro.hw.country is: eu
06-25 10:59:51.087  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.090  2308 14620 I NetworkSdk_CountryCodeBean: [I/HMSCore/NetworkSdk_CountryCodeBean 2308:240 SourceFile:28] PPS-Net-pool-thread-21|null|com.huawei.hms.framework.network.grs.local.model.CountryCodeBean|getSimCountryCode|75|countryCode by SimCountryIso is: 
06-25 10:59:51.090  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.091  2308 14620 I NetworkSdk_CountryCodeBean: [I/HMSCore/NetworkSdk_CountryCodeBean 2308:240 SourceFile:28] PPS-Net-pool-thread-21|null|com.huawei.hms.framework.network.grs.local.model.CountryCodeBean|getRegionSettingCountryCode|31|countryCode by system's region setting is: IT
06-25 10:59:51.091  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.092  2308 14620 I NetworkSdk_CountryCodeBean: [I/HMSCore/NetworkSdk_CountryCodeBean 2308:240 SourceFile:28] PPS-Net-pool-thread-21|null|com.huawei.hms.framework.network.grs.local.model.CountryCodeBean|init|49|get issue_country code from LOCALE_INFO
06-25 10:59:51.092  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.093  2308 14620 I HiAdKit.AccessMethod.Builder:  countryCode:IT
06-25 10:59:51.095  2308 14512 I HiAdKit.HiAdRequestDataLogger:  upper thread name: PPS-Net-pool-thread-21 request data: {"androidApiVer":"29","buildVer":"JNY-L21 10.1.0.323(C432E1R6P1)","emuiVer":"EmotionUI_10.1.0","maker":"HUAWEI","model":"JNY-LX1","ppsKitVersion":"3.4.41.303","appPkgName":"com.huawei.systemmanager","appVersionCode":"1000106365","type":4} 
06-25 10:59:51.095  2308 14620 I HiAdKit.HttpUrlConnectionCaller:  createConnection: https://******/exS******
06-25 10:59:51.098   646  1104 W /system/bin/netd: A binder object at 0x7467d23080 is being transacted on, however, this object is in the same process as its proxy. Transacting with this binder is expensive compared to just calling the corresponding functionality in the same process.
06-25 10:59:51.098   646  1104 I PreDnsController: canPreDnsQuery,persist.sys.predns is false!
06-25 10:59:51.100  2308 14361 I NetworkSdk_a: [I/HMSCore/NetworkSdk_a 2308:235 SourceFile:28] PPS-Cal-pool-thread-32|null|bie|e|22|get url from sp is not empty.
06-25 10:59:51.100  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.100  2308 14361 I NetworkSdk_LocalManagerProxy: [I/HMSCore/NetworkSdk_LocalManagerProxy 2308:235 SourceFile:28] PPS-Cal-pool-thread-32|null|bij|d|20|appGrs is not null and clear services.
06-25 10:59:51.101  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.101  2308 14361 I NetworkSdk_LocalManagerProxy: [I/HMSCore/NetworkSdk_LocalManagerProxy 2308:235 SourceFile:28] PPS-Cal-pool-thread-32|null|bij|d|20|appGrs is not null and clear services.
06-25 10:59:51.101  2308  3478 D LogWrite: wtf Exception
06-25 10:59:51.121   697   697 I audio_hw_direct: usb_ext_get_typec_parameters: check show hires (false)
06-25 10:59:51.134  1427  1427 D HwConnectivityManagerImpl: getNetworkPolicyFlag flagStr null
06-25 10:59:51.139   697   697 I audio_hw_direct: usb_ext_get_typec_parameters: check show hires (false)
06-25 10:59:51.239    47    47 W migration/6: type=1400 audit(0.0:22177): avc: granted { setsched } for pid=47 scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=process
06-25 10:59:51.083  1427  2392 I HwResolverManager: isMultiScreenCollaborationEnabled: Operate settings exception! 
06-25 10:59:51.242  1427 14625 I VibratorService: isNeedDisableVibratorOn camera is not active
06-25 10:59:51.243   714   714 I hwvibrator@1.0-service: on: timeout is 350 ms
06-25 10:59:51.270  2308 14620 I HiAdKit.Response:  setNetDuration1 174
06-25 10:59:51.272  2308 14620 I HiAdKit.Response:  setNetDuration2 175
06-25 10:59:51.272  2308 14620 I HiAdKit.Response:  setDataConverterCost 1
06-25 10:59:51.273  2308 14620 I HiAdKit.HttpUrlConnectionCaller:  close connection
06-25 10:59:51.273  2308 14512 I HiAdKit.HiAdResponseDataLogger:  upper thread name: PPS-Net-pool-thread-21 response data: {"exSplashConfigInterval":1440,"retcode":200} 
06-25 10:59:51.273  2308 14620 I HiAdKit.HttpCall:  response http code: 200
06-25 10:59:51.282  2000 14612 V PlayerBase: baseStart() piid=335

更新 1

我们尝试缩短频道名称,但没有结果。

我们从服务器发送推送,其中 channel_id 现在是“sahms”。App端收到通知,我们听到声音和振动,但没有出现横幅。

我们去检查 Settings > Notifications > MyApp > Channels 并看到“sahms”频道已创建,但是,通知似乎被引导到“默认中等优先级频道”(图 1)。

他为什么这样做?

“默认中等优先级频道”的问题在于它关闭了“显示横幅”选项,因此当通知到达时您看不到横幅出现。

我们希望显示横幅。有没有办法通过应用代码激活“显示横幅”选项?或者,我们如何将通知引导到“sahms”,因为该通道已选中“显示横幅”?

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

4

1 回答 1

0

更新

    /**
     * Create a Custom Channel
     * @param channelId
     * @param channelName
     */
    private void createNotificationChannel(String channelId, String channelName) {
        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        Notification.Builder builder = new Notification.Builder(getApplicationContext());
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
            builder.setChannelId(channelId);
            NotificationChannel channel = new NotificationChannel(channelId, channelName, NotificationManager.IMPORTANCE_DEFAULT);
            String soundID="";
            if (channelId.equals("1")) {
                soundID = "custom_sound1";
            } else if (channelId.equals("2")) {
                soundID = "custom_sound2";
            } else {
                soundID = "custom_sound3";
            }
            Uri coinUri = findUri(this, soundID);
            channel.setSound(coinUri, Notification.AUDIO_ATTRIBUTES_DEFAULT);
            manager.createNotificationChannel(channel);
        }
    }

    /**
     * Specify a Channel Ringtone Method
     * @param context
     * @param sound
     * @return
     */
    private static Uri findUri(Context context, String sound) {
        try {
            int resId = context.getResources().getIdentifier(sound, "raw", context.getPackageName());
            if (resId != 0) {
                Uri soundUri = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + context.getPackageName() + "/raw/" + sound);
                Log.d(TAG, "found sound uri:" + soundUri);
                return soundUri;
            } else {
                Log.w(TAG, "not sound susu:" + sound);
            }
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
        return null;
    }

在此处输入图像描述


根据下面

06-25 10:59:50.562 3055 3809 I PushLog110102300:[ReceiverDispatcher-58]自定义通道不存在:huawei-hms-rn-push-channel

这表示通道创建失败。建议您创建一个具有短名称的新频道,然后查看它是否有效。

于 2021-06-28T02:31:38.100 回答