远程推送提供了服务端推送的功能,请务必先阅读快速接入。 接入分级分为 必接 -》重要 -》选接 必接为核心接口,重要为推荐接口,选接为可选。
接口描述:监听远程异步回调,本监听回调为 supersdk 回调,如同时接入登录/支付,可使用同一个 mSuperSDKListener。 注意这里是 BcorePushConst.MODULE_NAME 有别于 BCoreConst.platform.MODULE_NAME(下同)
接口回调:
private OnSuperSDKListener mSuperSDKListener = new OnSuperSDKListener() {
@Override
public void onSuperSDK(String moduleName, String funcName, String result) {
if(xxx){
//支付登录等回调
}else if(BcorePushConst.MODULE_NAME.equals(moduleName)) {
//判断这是平台模块("mobpush")内的方法
switch(funcName){
//根据具体的方法名接收具体的回调事件
case xx:
break;
...
}
}else {
Log.d("supersdk", "其他模块方法的监听结果");
}
}
};
//这个方法处理服务端推送消息
privite void receive(String result) {
String data = JsonUtils.parseObject(result).getJSONObject("data");
//推送的消息放在 data 里面,为 json 格式的字符串
Log.e(TAG, "data=" + data);
}
接口日志:
result: {
"code": 0,
"data": {
"code": 0,
"content": "test内容",//内容
"extrasMap": {
"workId": "5d4852fe7fbebe9a75c85ede"
},
"light": true,
"messageId": "321800954716188672",
"shake": true,
"style": 0,//接收到推送类型
"timestamp": 1565020926714,//时间戳
"title": "testa",//标题
"voice": true
},
"msg": "receiveRemoteNotification"
}
接口描述:解除推送绑定,注销完成后调用。 注意:如不调用该功能,会存在,注销以后仍然能继续受到该用户的定向推送消息。
接口调用:
Map<String, String> params = new HashMap<String, String>();
SuperSDK.invoke(BcorePushConst.MODULE_NAME, BcorePushConst.BINDUSER, params);
接口描述:获取当前绑定用户
接口调用:
Map<String, String> params = new HashMap<String, String>();
SuperSDK.invoke(BcorePushConst.MODULE_NAME, BcorePushConst.GETBINDUSER, params);
接口回调: if(BcorePushConst.GETBINDUSER.equals(funcName))
接口日志:
result:{
"code":0,
"data":{
"alias":"0060015_guest05100152"
},
"msg":"getBindUserId"}
接口描述:获取推送绑定唯一标识,本标识不同于 imei,不需要获取额外权限。
Map<String, String> params = new HashMap<String, String>();
SuperSDK.invoke(BcorePushConst.MODULE_NAME, BcorePushConst.GETREGISTRATIONID, params);
接口回调: if(BcorePushConst.GETREGISTRATIONID.equals(funcName)) 接口日志:
result:{"code":0,"data":"6725cf97c81e21dcaa9d5f67","msg":"getRegistrationId"}