本文整理汇总了Java中cn.jpush.api.push.PushResult类的典型用法代码示例。如果您正苦于以下问题:Java PushResult类的具体用法?Java PushResult怎么用?Java PushResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PushResult类属于cn.jpush.api.push包,在下文中一共展示了PushResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: pushByRegId
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
/**
* 按regId推送通知给教师端
*/
@Override
public BasicVo pushByRegId(List<JPushByTeacherVo> teachers) {
if(teachers.size() == 0) {
return new BasicVo(JPushBusinessCode.BUSSINESS_PUSH_EMPTY[0], JPushBusinessCode.BUSSINESS_PUSH_EMPTY[1]);
}
String pushAlert = "马上上课了,记得打开软件考勤哦!";
String pushTitle = "考勤提醒";
List<String> regIds = new ArrayList<String>();
for(JPushByTeacherVo jt : teachers) {
regIds.add(jt.getTeacherRegId());
}
PushResult pushResult = JPushUtils.sendPushByAndroidRegId(pushAlert, pushTitle, regIds);
if(null == pushResult) {
return new BasicVo(JPushBusinessCode.BUSSINESS_FAILED[0], JPushBusinessCode.BUSSINESS_FAILED[1]);
}
return new BasicVo(JPushBusinessCode.BUSINESS_SUCCESS[0], JPushBusinessCode.BUSINESS_SUCCESS[1]);
}
示例2: pushStuClockByRegId
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
/**
* 推送通知给学生,按regID列表
*/
@Override
public BasicVo pushStuClockByRegId(List<String> regIds) {
if(regIds.size() == 0) {
return new BasicVo(JPushBusinessCode.BUSSINESS_PUSH_EMPTY[0], JPushBusinessCode.BUSSINESS_PUSH_EMPTY[1]);
}
String pushAlert = "你当前教师考勤没有通过,请打开软件自己考勤";
String pushTitle = "考勤提醒";
PushResult pushResult = JPushUtils.sendPushByAndroidRegId(pushAlert, pushTitle, regIds);
if(null == pushResult) {
return new BasicVo(JPushBusinessCode.BUSSINESS_FAILED[0], JPushBusinessCode.BUSSINESS_FAILED[1]);
}
return new BasicVo(JPushBusinessCode.BUSINESS_SUCCESS[0], JPushBusinessCode.BUSINESS_SUCCESS[1]);
}
示例3: sendByAlias
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
private boolean sendByAlias(String type, String title, String msg, Map<String,String> extras, String[] alias){
boolean result = false;
try {
PushPayload pl = buildPushObject_Alias(type, title, msg, extras, alias);
PushResult pr = client.sendPush(pl);
result = pr.isResultOK();
// extras.put("MESSAGE", msg);
// pl = buildPushObject_Alias_IOS(type, title, extras, alias);
// pr = client.sendPush(pl);
// result = pr.isResultOK() && result;
} catch (Exception e) {
e.printStackTrace();
result = false;
}
return result;
}
示例4: sendByTag
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
private boolean sendByTag(String type, String title, String msg, Map<String,String> extras, String[] tags){
boolean result = false;
try {
extras.put("MESSAGE", msg);
extras.put("TITLE", title);
//
PushPayload pl = buildPushObjec_Tag_Android(type, title, msg, extras, tags);
PushResult pr = client.sendPush(pl);
result = pr.isResultOK();
////
// System.out.println(extras);
// pl = buildPushObjec_Tag_IOS(type, title, extras, tags);
// pr = client.sendPush(pl);
// result = pr.isResultOK() && result;
} catch (Exception e) {
e.printStackTrace();
result = false;
}
return result;
}
示例5: sendAndroidNotificationWithAlias
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendAndroidNotificationWithAlias(String title, String alert,
Map<String, String> extras, String... alias)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.alias(alias))
.setNotification(Notification.android(alert, title, extras))
.build();
return _pushClient.sendPush(payload);
}
示例6: sendAndroidNotificationWithRegistrationID
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendAndroidNotificationWithRegistrationID(String title, String alert,
Map<String, String> extras, String... registrationID)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.registrationId(registrationID))
.setNotification(Notification.android(alert, title, extras))
.build();
return _pushClient.sendPush(payload);
}
示例7: sendIosNotificationWithAlias
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendIosNotificationWithAlias(String alert,
Map<String, String> extras, String... alias)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.ios())
.setAudience(Audience.alias(alias))
.setNotification(Notification.ios(alert, extras))
.build();
return _pushClient.sendPush(payload);
}
示例8: sendIosNotificationWithRegistrationID
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendIosNotificationWithRegistrationID(String alert,
Map<String, String> extras, String... registrationID)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.ios())
.setAudience(Audience.registrationId(registrationID))
.setNotification(Notification.ios(alert, extras))
.build();
return _pushClient.sendPush(payload);
}
示例9: sendAndroidMessageWithAlias
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendAndroidMessageWithAlias(String title, String msgContent, String... alias)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.alias(alias))
.setMessage(Message.newBuilder()
.setTitle(title)
.setMsgContent(msgContent)
.build())
.build();
return _pushClient.sendPush(payload);
}
示例10: sendAndroidMessageWithRegistrationID
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendAndroidMessageWithRegistrationID(String title, String msgContent, String... registrationID)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.registrationId(registrationID))
.setMessage(Message.newBuilder()
.setTitle(title)
.setMsgContent(msgContent)
.build())
.build();
return _pushClient.sendPush(payload);
}
示例11: sendIosMessageWithAlias
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendIosMessageWithAlias(String title, String msgContent, String... alias)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.ios())
.setAudience(Audience.alias(alias))
.setMessage(Message.newBuilder()
.setTitle(title)
.setMsgContent(msgContent)
.build())
.build();
return _pushClient.sendPush(payload);
}
示例12: sendIosMessageWithRegistrationID
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendIosMessageWithRegistrationID(String title, String msgContent, String... registrationID)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.ios())
.setAudience(Audience.registrationId(registrationID))
.setMessage(Message.newBuilder()
.setTitle(title)
.setMsgContent(msgContent)
.build())
.build();
return _pushClient.sendPush(payload);
}
示例13: sendMessageWithRegistrationID
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
public PushResult sendMessageWithRegistrationID(String title, String msgContent, String... registrationID)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.all())
.setAudience(Audience.registrationId(registrationID))
.setMessage(Message.newBuilder()
.setTitle(title)
.setMsgContent(msgContent)
.build())
.build();
return _pushClient.sendPush(payload);
}
示例14: push
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
@Override
public boolean push(String alias, List<String> pushTags, String alert) {
try{
logger.info("push():alias:"+alias+" pushTags:"+pushTags+" alert:"+alert);
JPushClient jpushClient = getJpushClient();
Builder builder = PushPayload.newBuilder()
.setPlatform(Platform.all());//所有平台
if(StringUtils.isNotBlank(alias)){
builder = builder.setAudience(Audience.alias(alias));//向选定的人推送
}
if(pushTags!=null && pushTags.size()>0){
builder = builder.setAudience(Audience.tag(pushTags));//根据标签推送
}
if(StringUtils.isBlank(alias) && (pushTags==null || pushTags.size()==0)){
builder = builder.setAudience(Audience.all());
}
// PushPayload pushPayload = PushPayload.alertAll(content);
PushPayload pushPayload = builder.setNotification(Notification.alert( alert))//消息内容
.build();
logger.info("push():pushPayload:"+pushPayload);
PushResult result = jpushClient.sendPush(pushPayload);
logger.info("push():result:"+result);
return result.isResultOK();
}catch(Exception e){
logger.error("push():e:"+e.getMessage(),e);
return false;
}
}
示例15: sendAndroidNotificationWithAlias
import cn.jpush.api.push.PushResult; //导入依赖的package包/类
/**
* Shortcut
*/
public PushResult sendAndroidNotificationWithAlias(String title, String alert,
Map<String, String> extras, String... alias)
throws APIConnectionException, APIRequestException {
PushPayload payload = PushPayload.newBuilder()
.setPlatform(Platform.android())
.setAudience(Audience.alias(alias))
.setNotification(Notification.android(alert, title, extras))
.build();
return _pushClient.sendPush(payload);
}