请务必先接入快速接入接口,本地推送为不依赖服务端的本地定时推送,在游戏被结束进程以后无法获取。
接口描述:添加本地推送。 isAlarm 可设置不进行声音提醒,默认声音、振动、指示灯提示。 timeTamp 这里可以直接设置要提示的时间的时间戳。 一下参数均为 String 类型
参数 | 值 | 是否必传 |
---|---|---|
alertTitle | 标题文本 | 必传 |
alertBody | 文本内容 | 必传 |
isAlarm | 1 或者不传为提示,0 为不提示 | 可选 |
identifier | 文本 id 用于本地标记,只能是数值 | 必传 |
fireDate | 提示时间戳 | 必传 |
接口调用:
Map<String, String> params = new HashMap<String, String>();
params.put("alertTitle","本地推送测试");
params.put("alertBody","本地推送内容");
params.put("isAlarm","1");
params.put("identifier","1");
params.put("fireDate",fireDate+"");
SuperSDK.invoke(BcorePushConst.MODULE_NAME, BcorePushConst.ADDLOCALNOTIFICATION, params);
接口日志:
{"code":0,
"data":{"alertBody":"本地推送内容",
"alertTitle":"本地推送测试",
"fireDate":"1565019483662",
"identifier":"123",
"isAlarm":"1"},
"msg":"添加本地推送成功"}
接口描述:删除指定本地推送,notificationId 里为上面设置的 id 必须是 String 类型整数。
接口调用:
Map<String, String> params = new HashMap<String, String>();
params.put("notificationId","1");
SuperSDK.invoke(BcorePushConst.MODULE_NAME, BcorePushConst.REMOVELOCALNOTIFICATION, params);
接口描述:只可删除本地推送。
接口调用:
Map<String, String> params = new HashMap<String, String>();
SuperSDK.invoke(BcorePushConst.MODULE_NAME, BcorePushConst.CLEARLOCALNOTIFICATIONS, params);
常量字符串 | 实际字符串 | 描述 |
---|---|---|
暂无 | mobpush | 模块名称 |
ADDLOCALNOTIFICATION | addLocalNotification | 添加本地推送 |
REMOVELOCALNOTIFICATION | removeLocalNotification | 删除指定本地推送 |
CLEARLOCALNOTIFICATIONS | clearLocalNotifications | 删除所有本地推送 |