测试机型华为p30,系统安卓10
代码 var huaweiPush = api.require('huaweiPush');
huaweiPush.getToken(function(ret, err) {
if (ret.status) {
console.log({ msg: JSON.stringify(ret) });
} else {
console.log({ msg: "获取token失败" });
}
});
文档中所说的 “在华为推送后台需要填写一个自定义动作的字符串”后台 是指的哪里? 华为的推送配置里没找到自定义动作字符串的配置项
华为推送对通知的点击有两种后续行为:1、直接打开应用 2、自定义动作;现对自定义动作做如下说明: <intent-filter> <action name="android.intent.action.VIEW"/> <category name="android.intent.category.DEFAULT"/> <data host="com.apicloud.push" path="/hwpush_detail" scheme="apischeme"/></intent-filter>(2) 完成第一步的操作后,在华为推送后台需要填写一个自定义动作的字符串,格式如下: intent://{host}/{path}?message=what#Intent;scheme={scheme};launchFlags=0x30000000;end其中: - host 就是第一步配置的intent-filter中的host
- path 就是第一步配置的intent-filter中的path
- scheme 就是第一步配置的intent-filter中的scheme
- message=what 这部分就是自定义的内容了
示例代码 intent://com.apicloud.push/hwpush_detail?message={name:'tim', age:'20'}#Intent;scheme= apischeme;launchFlags=0x30000000;end
|