当前位置: 首页>>代码示例>>Java>>正文


Java PushPayload类代码示例

本文整理汇总了Java中cn.jpush.api.push.model.PushPayload的典型用法代码示例。如果您正苦于以下问题:Java PushPayload类的具体用法?Java PushPayload怎么用?Java PushPayload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PushPayload类属于cn.jpush.api.push.model包,在下文中一共展示了PushPayload类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildPushObject_id_alert_title_extra

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
/**
 * 
 * @param MSG_CONTENT 消息内容
 * @param ALERT alert
 * @param TITLE 标题 //ios没有title
 * @param extra 附加参数
 * @param regid 用户注册id
 * @return
 */
public PushPayload buildPushObject_id_alert_title_extra(String ALERT,String TITLE,Map<String, String> extra,String regId) {
	Audience registrationId;
	if(regId!=null){
		registrationId = Audience.registrationId(regId);
	}else{
		registrationId = Audience.all();
	}
	return PushPayload.newBuilder()
            .setPlatform(Platform.android_ios())
            .setAudience(registrationId)
            .setNotification(Notification.newBuilder()
            		.setAlert(ALERT)
            		.addPlatformNotification(AndroidNotification.newBuilder()
            				.setTitle(TITLE).addExtras(extra).build())
            		.addPlatformNotification(IosNotification.newBuilder()
            				.incrBadge(1)
            				.addExtras(extra).build())
            		.build())
            //.setMessage(Message.content(MSG_CONTENT))
            .build();
}
 
开发者ID:noseparte,项目名称:Spring-Boot-Server,代码行数:31,代码来源:PushService.java

示例2: buildPushObject_android_regId_alert

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private static PushPayload buildPushObject_android_regId_alert(String pushAlert, String pushTitle, List<String> regIds) {
	
	Map<String, String> extras = new HashMap<String, String>();
    extras.put("extra_1", "val1");
    extras.put("extra_2", "val2");
	
	return PushPayload.newBuilder()
			.setPlatform(Platform.android())
			.setAudience(Audience.registrationId(regIds))
			.setNotification(Notification
					.newBuilder()
					.setAlert(pushAlert)
					.addPlatformNotification(AndroidNotification.newBuilder()
							.setTitle(pushTitle)
							.addExtras(extras)
							.build())
					.build())
			.build();
}
 
开发者ID:IaHehe,项目名称:classchecks,代码行数:20,代码来源:JPushUtils.java

示例3: sendByAlias

import cn.jpush.api.push.model.PushPayload; //导入依赖的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;
	}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:18,代码来源:JPushUtil.java

示例4: sendByTag

import cn.jpush.api.push.model.PushPayload; //导入依赖的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;
	}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:21,代码来源:JPushUtil.java

示例5: buildPushObjec_Tag

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private PushPayload buildPushObjec_Tag(String type, String title, String msg, Map<String, String> extras,String[] tags) {
	if(null == extras){
		extras = new HashMap<String,String>();
	}
	return PushPayload.newBuilder()
			.setPlatform(Platform.all())
			.setAudience(Audience.newBuilder()
					.addAudienceTarget(AudienceTarget.tag_and(tags))
					.build())
					.setMessage(Message.newBuilder()
							.setMsgContent(type)
							.addExtras(extras)
							.build()).setOptions(Options.newBuilder()
			                         .setApnsProduction(true)
			                         .build())
							.setNotification(Notification.android(msg, title, extras).ios(title, extras))
							.build();
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:19,代码来源:JPushUtil.java

示例6: buildPushObject_Alias

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private PushPayload buildPushObject_Alias(String type, String title, String msg, Map<String, String> extras,String[] alias) {
	if(null == extras){
		extras = new HashMap<String,String>();
	}
	return PushPayload.newBuilder()
			.setPlatform(Platform.all())
			.setAudience(Audience.newBuilder()
					.addAudienceTarget(AudienceTarget.alias(alias))
					.build())
					.setMessage(Message.newBuilder()
							.setMsgContent(type)
							.addExtras(extras)
							.build()).setOptions(Options.newBuilder()
			                         .setApnsProduction(true)
			                         .build())
							.setNotification(Notification.android(msg, title, extras).ios(title, extras))
							.build();
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:19,代码来源:JPushUtil.java

示例7: buildPushObjec_Tag_Android

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private PushPayload buildPushObjec_Tag_Android(String type, String title, String msg, Map<String, String> extras,String[] tags) {
	if(null == extras){
		extras = new HashMap<String,String>();
	}
	return PushPayload.newBuilder()
			.setPlatform(Platform.all())
			.setAudience(Audience.newBuilder()
					.addAudienceTarget(AudienceTarget.tag_and(tags))
					.build())
					.setMessage(Message.newBuilder()
							.setMsgContent(type)
							.addExtras(extras)
							.build()).setOptions(Options.newBuilder()
			                         .setApnsProduction(true)
			                         .build())
							.setNotification(Notification.android(msg, title, extras))
							.build();
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:19,代码来源:JPushUtil.java

示例8: buildPushObject_Alias_Android

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private PushPayload buildPushObject_Alias_Android(String type, String title, String msg, Map<String, String> extras,String[] alias) {
	if(null == extras){
		extras = new HashMap<String,String>();
	}
	return PushPayload.newBuilder()
			.setPlatform(Platform.all())
			.setAudience(Audience.newBuilder()
					.addAudienceTarget(AudienceTarget.alias(alias))
					.build())
					.setMessage(Message.newBuilder()
							.setMsgContent(type)
							.addExtras(extras)
							.build()).setOptions(Options.newBuilder()
			                         .setApnsProduction(true)
			                         .build())
							.setNotification(Notification.android(msg, title, extras))
							.build();
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:19,代码来源:JPushUtil.java

示例9: buildPushObjec_Tag_IOS

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private PushPayload buildPushObjec_Tag_IOS(String type, String title,Map<String, String> extras,String[] tags) {
	if(null == extras){
		extras = new HashMap<String,String>();
	}
	return PushPayload.newBuilder()
			.setPlatform(Platform.all())
			.setAudience(Audience.newBuilder()
					.addAudienceTarget(AudienceTarget.tag_and(tags))
					.build())
					.setMessage(Message.newBuilder()
							.setMsgContent(type)
							.addExtras(extras)
							.build()).setOptions(Options.newBuilder()
			                         .setApnsProduction(true)
			                         .build())
							.setNotification(Notification.ios(title, extras))
							.build();
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:19,代码来源:JPushUtil.java

示例10: buildPushObject_Alias_IOS

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private PushPayload buildPushObject_Alias_IOS(String type, String title,Map<String, String> extras,String[] alias) {
	if(null == extras){
		extras = new HashMap<String,String>();
	}
	return PushPayload.newBuilder()
			.setPlatform(Platform.all())
			.setAudience(Audience.newBuilder()
					.addAudienceTarget(AudienceTarget.alias(alias))
					.build())
					.setMessage(Message.newBuilder()
							.setMsgContent(type)
							.addExtras(extras)
							.build()).setOptions(Options.newBuilder()
			                         .setApnsProduction(true)
			                         .build())
							.setNotification(Notification.ios(title, extras))
							.build();
}
 
开发者ID:anylineorg,项目名称:anyline,代码行数:19,代码来源:JPushUtil.java

示例11: buildPushObject_ios_tagAnd_alertWithExtrasAndMessage

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
public static PushPayload buildPushObject_ios_tagAnd_alertWithExtrasAndMessage() {
    return PushPayload.newBuilder()
            .setPlatform(Platform.all())
            .setAudience(Audience.tag_and("tag1", "tag_all"))  ///客户端必须同时存在这两个tag
            .setNotification(Notification.newBuilder()
                    .addPlatformNotification(AndroidNotification.newBuilder()
                            .setAlert(ALERT)
                            //.setBadge(5)
                            //.setSound("happy")
                            .addExtra("from", "JPush")
                            .build())
                    .build())
             .setMessage(Message.content(MSG_CONTENT))
             .setOptions(Options.newBuilder()
                     .setApnsProduction(true)
                     .build())
             .build();
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:19,代码来源:PushExample.java

示例12: createPeriodicalSchedule

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
private ScheduleResult createPeriodicalSchedule(String name, String start, String end, String time,
                                                TimeUnit timeUnit, int frequency, String[] point, PushPayload push)
        throws APIConnectionException, APIRequestException {
    TriggerPayload trigger = TriggerPayload.newBuilder()
            .setPeriodTime(start, end, time)
            .setTimeFrequency(timeUnit, frequency, point )
            .buildPeriodical();
    SchedulePayload payload = SchedulePayload.newBuilder()
            .setName(name)
            .setEnabled(true)
            .setTrigger(trigger)
            .setPush(push)
            .build();

    return _scheduleClient.createSchedule(payload);
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:17,代码来源:JPushClient.java

示例13: sendPush

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
public PushResult sendPush(PushPayload pushPayload) throws APIConnectionException, APIRequestException {
    Preconditions.checkArgument(! (null == pushPayload), "pushPayload should not be null");
    
    if (_apnsProduction > 0) {
        pushPayload.resetOptionsApnsProduction(true);
    } else if(_apnsProduction == 0) {
        pushPayload.resetOptionsApnsProduction(false);
    }

    if (_timeToLive >= 0) {
        pushPayload.resetOptionsTimeToLive(_timeToLive);
    }

    ResponseWrapper response = _httpClient.sendPost(_baseUrl + _pushPath, pushPayload.toString());
    
    return BaseResult.fromResponse(response, PushResult.class);
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:18,代码来源:PushClient.java

示例14: sendPushValidate

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
public PushResult sendPushValidate(PushPayload pushPayload) throws APIConnectionException, APIRequestException {
    Preconditions.checkArgument(! (null == pushPayload), "pushPayload should not be null");
    
    if (_apnsProduction > 0) {
        pushPayload.resetOptionsApnsProduction(true);
    } else if(_apnsProduction == 0) {
        pushPayload.resetOptionsApnsProduction(false);
    }

    if (_timeToLive >= 0) {
        pushPayload.resetOptionsTimeToLive(_timeToLive);
    }
    
    ResponseWrapper response = _httpClient.sendPost(_baseUrl + _pushValidatePath, pushPayload.toString());
    
    return BaseResult.fromResponse(response, PushResult.class);
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:18,代码来源:PushClient.java

示例15: buildPushObject_ios_tagAnd_alertWithExtrasAndMessage

import cn.jpush.api.push.model.PushPayload; //导入依赖的package包/类
public static PushPayload buildPushObject_ios_tagAnd_alertWithExtrasAndMessage(String message, String msg_content) {
    return PushPayload.newBuilder()
            .setPlatform(Platform.ios())
            .setAudience(Audience.tag_and("tag1", "tag_all"))
            .setNotification(Notification.newBuilder()
                    .addPlatformNotification(IosNotification.newBuilder()
                            .setAlert(message)
                            .setBadge(5)
                            .setSound("happy")
                            .addExtra("from", "JPush")
                            .build())
                    .build())
            .setMessage(Message.content(msg_content))
            .setOptions(Options.newBuilder()
                    .setApnsProduction(true)
                    .build())
            .build();
}
 
开发者ID:xiaowei1118,项目名称:java_server,代码行数:19,代码来源:JpushInterface.java


注:本文中的cn.jpush.api.push.model.PushPayload类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。