| | |
| | | /** |
| | | * 推送商品 |
| | | * |
| | | * @param deviceTokens |
| | | * -最大值1000 |
| | | * @param deviceTokens -最大值1000 |
| | | * @param title |
| | | * @param content |
| | | * @param goodsType |
| | | * @param goodsId |
| | | * @throws PushException |
| | | */ |
| | | public static void pushGoods(List<String> deviceTokens, String title, String content, int goodsType, Long goodsId) |
| | | public static void pushGoods(List<String> deviceTokens, String title, String content, int goodsType, Long goodsId, String androidBaseActivityName) |
| | | throws PushException { |
| | | if (deviceTokens != null && deviceTokens.size() > 100) |
| | | throw new PushException(1, "设备数不能超过100个"); |
| | | |
| | | String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() |
| | | String activity = androidBaseActivityName |
| | | + ".ui.recommend.GoodsBrowserActivity"; |
| | | String intent = getIntent("goodsdetail", activity, null, null, goodsId); |
| | | |
| | |
| | | /** |
| | | * 网页推送 |
| | | * |
| | | * @param deviceTokens |
| | | * 最大值1000 |
| | | * @param deviceTokens 最大值1000 |
| | | * @param title |
| | | * @param content |
| | | * @param url |
| | | * -网页链接 |
| | | * @param url -网页链接 |
| | | * @throws PushException |
| | | */ |
| | | public static void pushUrl(List<String> deviceTokens, String title, String content, String url) |
| | | public static void pushUrl(List<String> deviceTokens, String title, String content, String url, String androidBaseActivityName) |
| | | throws PushException { |
| | | if (deviceTokens != null && deviceTokens.size() > 100) |
| | | throw new PushException(1, "设备数不能超过1000个"); |
| | | |
| | | String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.invite.ShareBrowserActivity"; |
| | | String activity = androidBaseActivityName + ".ui.invite.ShareBrowserActivity"; |
| | | String intent = getIntent("url", activity, null, url, null); |
| | | try { |
| | | String result = sendPushHWMessageForIntent(deviceTokens, title, content, intent); |
| | |
| | | /** |
| | | * 站内信推送 |
| | | * |
| | | * @param deviceTokens |
| | | * 最大值1000 |
| | | * @param deviceTokens 最大值1000 |
| | | * @param title |
| | | * @param content |
| | | * @param url |
| | | * -网页链接 |
| | | * @param url -网页链接 |
| | | * @throws PushException |
| | | */ |
| | | public static void pushZNX(List<String> deviceTokens, String title, String content) throws PushException { |
| | |
| | | } |
| | | } |
| | | |
| | | public static void pushWEEX(List<String> deviceTokens, String title, String content, String weexUrl) |
| | | public static void pushWEEX(List<String> deviceTokens, String title, String content, String weexUrl, String androidBaseActivityName) |
| | | throws PushException { |
| | | String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.weex.WeexApplicationActivity"; |
| | | String activity = androidBaseActivityName + ".ui.mine.weex.WeexApplicationActivity"; |
| | | String intent = getIntent("weex", activity, weexUrl, weexUrl, null); |
| | | if (intent == null) |
| | | return; |
| | |
| | | } |
| | | } |
| | | |
| | | public static void pushWelfareCenter(List<String> deviceTokens, String title, String content) throws PushException { |
| | | String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.mine.WelfareCenterActivity"; |
| | | public static void pushWelfareCenter(List<String> deviceTokens, String title, String content, String androidBaseActivityName) throws PushException { |
| | | String activity = androidBaseActivityName + ".ui.mine.WelfareCenterActivity"; |
| | | String intent = getIntent("welfare", activity, null, null, null); |
| | | if (intent == null) |
| | | return; |
| | |
| | | } |
| | | |
| | | |
| | | public static void pushUserSignInNotification(List<String> deviceTokens, String title, String content) throws PushException { |
| | | String activity = Constant.systemCommonConfig.getAndroidBaseactivityName() + ".ui.goldtask.GoldTaskActivity"; |
| | | public static void pushUserSignInNotification(List<String> deviceTokens, String title, String content, String androidBaseActivityName) throws PushException { |
| | | String activity = androidBaseActivityName + ".ui.goldtask.GoldTaskActivity"; |
| | | String intent = getIntent("signin", activity, null, null, null); |
| | | if (intent == null) |
| | | return; |
| | |
| | | /** |
| | | * 推送设备消息 |
| | | * |
| | | * @param deviceTokens |
| | | * -最大1000条 |
| | | * @param title |
| | | * -标题 |
| | | * @param content |
| | | * -内容 |
| | | * @param intent |
| | | * 如:intent:#Intent;component=com.yeshi.ec.rebate/.myapplication. |
| | | * @param deviceTokens -最大1000条 |
| | | * @param title -标题 |
| | | * @param content -内容 |
| | | * @param intent 如:intent:#Intent;component=com.yeshi.ec.rebate/.myapplication. |
| | | * ui.invite.ShareBrowserActivity;S.url="+URLEncoder.encode("http |
| | | * ://www.baidu.com")+";end |
| | | * @return |
| | |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * 方法说明: 获取下发通知消息的认证Token |
| | | * |
| | | * @author mawurui createTime 2018年5月14日 下午4:47:26 |
| | | * @throws IOException |
| | | * @author mawurui createTime 2018年5月14日 下午4:47:26 |
| | | */ |
| | | private static void refreshToken() throws IOException { |
| | | String msgBody = MessageFormat.format("grant_type=client_credentials&client_secret={0}&client_id={1}", |