android推送服务端,友盟消息推送服务端接口(android)

try {

//list是用户集合

//dev是要推动的用户的终端device_token(友盟的device_token不可定制不可自定义)

for (String dev : list) {

//实例化AndroidUnicast 类,传入参数appkey和appMasterSecret。参数在友盟控制台获取

AndroidUnicast unicast = new AndroidUnicast(appkey, appMasterSecret);

//设置要推送的终端device_token

unicast.setDeviceToken(dev);

//通知栏提示文字

unicast.setTicker("Android unicast ticker");

//通知栏提示文字

unicast.setTitle("友盟推送");

//设置android端展示通知时通知栏所用的图标,放在drawable目录下

unicast.setIcon("R.drawable.umeng_push_notification_default_small_icon");

unicast.setLargeIcon("R.drawable.[umeng_push_notification_default_small_icon]");

//设置通知内容

unicast.setText(msg);

unicast.goAppAfterOpen();

//设置通知方式为通知(NOTIFICATION改为MESSAGE时,终端不会再状态栏提示,需要手动在android端处理推送内容)

unicast.setDisplayType(AndroidNotification.DisplayType.NOTIFICATION);

unicast.setProductionMode();

//设置自定义参数

unicast.setExtraField("id","自定义参数"));

//发送至友盟服务器

client.send(unicast);

}

} catch (Exception e) {

e.printStackTrace();

log.error(e.getMessage());

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值