cn.jpush.api.push.PushResult Java Examples

The following examples show how to use cn.jpush.api.push.PushResult. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
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; 
	}
 
Example #2
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
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(); 
////			 
//			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; 
	}
 
Example #3
Source File: JPushServiceImpl.java    From classchecks with Apache License 2.0 6 votes vote down vote up
/**
 * 按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]);
}
 
Example #4
Source File: JPushServiceImpl.java    From classchecks with Apache License 2.0 6 votes vote down vote up
/**
 * 推送通知给学生,按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]);
}