资讯中心 / 消息推送MobPush集成-API详细说明

消息推送MobPush集成-API详细说明

消息推送MobPush
2019-01-14

MobPush是MOB继一系列公共SDK之后推出的一款专注消息推送服务的免费SDK。可以帮助开发者更快、更方便集成实现推送功能。推送可以大幅度提升用户活跃度,有效唤醒沉睡用户。

 

消息推送MobPush集成-API详细说明


目前MobPush可支持IOS 、Android两大平台APP集成,提供Rest API 方便开发者灵活发送推送消息,并且提供完整的可视化数据和强大管理后台。在推送形式上已经完全支持基本的通知栏消息、透传消息、本地消息的推送,并且可设置定时下发推送功能;在考虑精准推送上,MobPush支持不同程度的推送范围发送---Registration ID 、别名、标签、地理位置以及精细化的用户分群方式。

 

消息推送MobPush集成-API详细说明

 

1. 消息监听接口

MobPushReceiver: 消息监听接口(包含接收自定义消息、通知消息、通知栏点击事件、别名和标签变更操作等)

MobPush.addPushReceiver(MobPushReceiver receiver): 设置消息监听

MobPush.removePushReceiver(MobPushReceiver receiver): 移除消息监听

2. 推送开关控制接口

MobPush.stopPush(): 停止推送(停止后将不会收到推送消息,仅可通过restartPush重新打开)

MobPush.restartPush(): 重新打开推送服务

MobPush.isPushStopped(): 判断推送服务是否已经停止

3. 推送选项接口

MobPush.setSilenceTime(int startHour, int startMinute, int endHour, int endMinute): 设置通知静音时段(开始时间小时和分钟、结束时间小时和分钟)

MobPush.setCustomNotification(MobPushCustomNotification customNotification): 设置自定义通知样式

4. 业务接口

MobPush.getRegistrationId(MobPushCallback callback):获取注册id(可与用户id绑定,实现向指定用户推送消息)

别名操作:(同时只能设置一个别名,可用来标识一个用户)

MobPush.setAlias(String alias):设置别名

MobPush.getAlias():获取当前设置的别名

MobPush.deleteAlias():删除别名

标签操作:(同时可设置多个标签,可用于多用户订阅标签的方式,批量推送消息)

MobPush.addTags(String[] tags):添加标签

MobPush.getTags():获取所有已添加的标签

MobPush.deleteTags(String[] tags):删除标签

MobPush.cleanTags():清除所有已添加的标签

MobPushCustomeMessage: 自定义消息实体类

MobPushNotifyMessage: 通知消息实体类

5. 本地通知

MobPush.addLocalNotification(MobPushLocalNotification notification):添加本地通知

MobPush.removeLocalNotification(int notificationId):移除本地通知

MobPush.clearLocalNotifications():清空本地通知

MobPushLocalNotification:本地通知消息实体类,继承MobPushNotifyMessage

6. API错误码

API返回的错误码说明如下:(详见MobPushErrorCode.java说明)

-1 网络请求失败

-2 请求错误

上一篇 下一篇
SDK打包中 — 0%

SDK下载

正在根据您选择的SDK打包中,完成后自动下载
0%