个推平台服务端API文档-Java

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

个推平台服务端API文档-Java

JAVA开发准备

转至元数据结尾

转至元数据起始

∙ 1. 前期准备

∙ 2. 环境搭建

1. 前期准备

【1】请确保您已经初始化客户端SDK,并成功取得ClientID

【2】文档以JAVA程序为例介绍了如何调用OpenService提供的HTTP服务接口,采用json作为数据传输格式

【3】HTTP上行的Json消息体最大长度为25KB

【4】请确保工程编码格式为UTF-8,否则可能导致报错:“result=sign_error”

2. 环境搭建

【1】下载服务端SDK开发工具包,目录结构如下图所示

(下载地址:/download/server/GETUI_SERVER_SDK.zip)

【2】在Eclipse中新建工程(注:工程类型为Java Project)

【3】在工程中新建一个libs目录,将“...\GETUI_SERVER_SDK\资源文件”目录下的所有jar包复制到该目录中(若没有libs目录,则选中工程右键“New”->Folder->命名为“libs”),如下图所示

【4】右键单击工程,选择Build Path中的Configure Build Path...,选中Libraries这个tab,并通过Add Jars...导入工程libs目录下的所有jar文件,如下图所示

JAVA推送模板实例

转至元数据结尾

转至元数据起始

本章介绍了JAVA API的推送模板实例,如有更多疑问,请联系我们

点击通知打开应用模板| 点击通知打开网页模板

点击通知栏弹框下载模板| 透传消息模板| iOS模板说明

点击通知打开应用模板(JAVA)

转至元数据结尾

转至元数据起始

模板说明

模板参数说明

NotificationTemplate代码实例

public static NotificationTemplate NotificationTemplateDemo() { NotificationTemplate template = new NotificationTemplate();

// 设置APPID与APPKEY

template.setAppId(appId);

template.setAppkey(appkey);

// 设置通知栏标题与内容

template.setTitle("请输入通知栏标题");

template.setText("请输入通知栏内容");

// 配置通知栏图标

template.setLogo("icon.png");

// 配置通知栏网络图标

template.setLogoUrl("");

// 设置通知是否响铃,震动,或者可清除

template.setIsRing(true);

template.setIsVibrate(true);

template.setIsClearable(true);

// 透传消息设置

template.setTransmissionType(1);

template.setTransmissionContent("请输入您要透传的内容");

return template;

}

点击通知打开网页模板(JAVA) 转至元数据结尾

转至元数据起始

模板说明

模板参数说明

LinkTemplate代码实例

public static LinkTemplate linkTemplateDemo() {

LinkTemplate template = new LinkTemplate();

// 设置APPID与APPKEY

template.setAppId(appId);

template.setAppkey(appkey);

// 设置通知栏标题与内容

template.setTitle("请输入通知栏标题");

template.setText("请输入通知栏内容");

// 配置通知栏图标

template.setLogo("icon.png");

// 配置通知栏网络图标

template.setLogoUrl("");

// 设置通知是否响铃,震动,或者可清除

template.setIsRing(true);

template.setIsVibrate(true);

template.setIsClearable(true);

// 设置打开的网址地址

template.setUrl("");

return template;

}

点击通知栏弹框下载模板(JAVA) 转至元数据结尾

转至元数据起始

模板说明

模板参数说明

NotyPopLoadTemplate代码实例

public static NotyPopLoadTemplate NotyPopLoadTemplateDemo() {

NotyPopLoadTemplate template = new NotyPopLoadTemplate();

// 设置APPID与APPKEY

template.setAppId(appId);

template.setAppkey(appkey);

// 设置通知栏标题与内容

template.setNotyTitle("请输入通知栏标题");

template.setNotyContent("请输入通知栏内容");

// 配置通知栏图标

template.setNotyIcon("icon.png");

// 设置通知是否响铃,震动,或者可清除

template.setBelled(true);

template.setVibrationed(true);

template.setCleared(true);

// 设置弹框标题与内容

template.setPopTitle("弹框标题");

template.setPopContent("弹框内容");

// 设置弹框显示的图片

template.setPopImage("/wp-content/uploads/2013/08/logo_ge tui1.png");

template.setPopButton1("下载");

template.setPopButton2("取消");

相关文档
最新文档