HarmonyOS 怎么判断EntryAbility是通过push拉起的?

HarmonyOS 怎么判断EntryAbility是通过push拉起的?

HarmonyOS
2024-11-14 10:25:39
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu
{'_push_notifyid': 12345,
'debugApp': False,
'isCallBySCB': False,
'moduleName': 'entry',
'ohos.aafwk.param.callerAbilityName': 'PushServiceInnerAbility',
'ohos.aafwk.param.callerBundleName': 'com.huawei.hms.pushservice',
'ohos.aafwk.param.callerPid': 18049,
'ohos.aafwk.param.callerToken': 537833925,
'ohos.aafwk.param.callerUid': 20004,
'ohos.dlp.params.sandbox': False,
'send_to_erms_targetAppDistType': 'none',
'send_to_erms_targetAppProvisionType': 'debug',
'send_to_erms_targetBundleType': 0}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.

​里面的callerBundleName是com.huawei.hms.pushservice,只有推送消息才有。

Notification发送的结果是下面这样:​

{
"component.startup.newRules": true,
"isCallBySCB": false,
"moduleName": "entry",
"ohos.aafwk.param.callerAbilityName": '',
"ohos.aafwk.param.callerBundleName": "com.ohos.sceneboard",
"ohos.aafwk.param.callerPid": 2613,
"ohos.aafwk.param.callerToken": 537515597,
"ohos.aafwk.param.callerUid": 20020021,
"ohos.ability.launch.reason": 1,
"send_to_erms_targetAppDistType": "none",
"send_to_erms_targetAppProvisionType": "debug",
"send_to_erms_targetBundleType": 0,
"specifyTokenId": 536931207
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.

请使用want里面的callerBundleName==com.huawei.hms.pushservice来判断是否是push下发的消息。

分享
微博
QQ
微信
回复
2024-11-14 15:03:34


相关问题
JS UI 怎么判断键盘 是否拉起
7056浏览 • 1回复 待解决
HarmonyOS 怎么接入push
751浏览 • 1回复 待解决
怎么判断一个类型stirng
1596浏览 • 1回复 待解决
HarmonyOS 怎么清除entryAbility及后台任务
1142浏览 • 1回复 待解决
HarmonyOS 通过https地址拉起应用
503浏览 • 1回复 待解决
Flutter 如何判断HarmonyOS环境
1041浏览 • 1回复 待解决