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


Java Audience类代码示例

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


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

示例1: buildPushObject_android_regId_alert

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例2: buildPushObject_id_alert_title_extra

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例3: buildPushObjec_Tag

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例4: buildPushObject_Alias

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例5: buildPushObjec_Tag_Android

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例6: buildPushObject_Alias_Android

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例7: buildPushObjec_Tag_IOS

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例8: buildPushObject_Alias_IOS

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例9: buildPushObject_ios_tagAnd_alertWithExtrasAndMessage

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例10: buildPushObject_ios_tagAnd_alertWithExtrasAndMessage

import cn.jpush.api.push.model.audience.Audience; //导入依赖的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

示例11: buildPushObject_android_tags_alert

import cn.jpush.api.push.model.audience.Audience; //导入依赖的package包/类
/**
    * 
   * @Title: buildPushObject_all_tags_teacher_alert 
   * @Description: TODO(学生端) 
   * @return
   * PushPayload 
    */
private static PushPayload buildPushObject_android_tags_alert(String tag, String pushAlert, String pushTitle) {
       return PushPayload.newBuilder()
               .setPlatform(Platform.android())//设置接受的平台
               .setAudience(Audience.tag(tag))//Audience设置为all,说明采用广播方式推送,所有用户都可以接收到
               .setNotification(Notification.newBuilder()
               		.setAlert(pushAlert)
               		.addPlatformNotification(AndroidNotification.newBuilder()
               				.setTitle(pushTitle).build())
               		.build())
               .build();
   }
 
开发者ID:IaHehe,项目名称:classchecks,代码行数:19,代码来源:JPushUtils.java

示例12: buildPushObject_all_alias_alert

import cn.jpush.api.push.model.audience.Audience; //导入依赖的package包/类
public static PushPayload buildPushObject_all_alias_alert() {
    return PushPayload.newBuilder()
            .setPlatform(Platform.all())
            .setAudience(Audience.alias("alias1"))
            .setNotification(Notification.alert(ALERT))
            .build();
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:8,代码来源:PushExample.java

示例13: buildPushObject_android_tag_alertWithTitle

import cn.jpush.api.push.model.audience.Audience; //导入依赖的package包/类
public static PushPayload buildPushObject_android_tag_alertWithTitle() {
    return PushPayload.newBuilder()
            .setPlatform(Platform.android())
            .setAudience(Audience.tag("tag1"))
            .setNotification(Notification.android(ALERT, TITLE, null))
            .build();
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:8,代码来源:PushExample.java

示例14: buildPushObject_android_and_ios

import cn.jpush.api.push.model.audience.Audience; //导入依赖的package包/类
public static PushPayload buildPushObject_android_and_ios() {
    return PushPayload.newBuilder()
            .setPlatform(Platform.android_ios())
            .setAudience(Audience.tag("tag1"))
            .setNotification(Notification.newBuilder()
            		.setAlert("alert content")
            		.addPlatformNotification(AndroidNotification.newBuilder()
            				.setTitle("Android Title").build())
            		.addPlatformNotification(IosNotification.newBuilder()
            				.incrBadge(1)
            				.addExtra("extra_key", "extra_value").build())
            		.build())
            .build();
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:15,代码来源:PushExample.java

示例15: buildPushObject_with_extra

import cn.jpush.api.push.model.audience.Audience; //导入依赖的package包/类
public static void buildPushObject_with_extra() {

        JsonObject jsonExtra = new JsonObject();
        jsonExtra.addProperty("extra1", 1);
        jsonExtra.addProperty("extra2", false);

        Map<String, String> extras = new HashMap<String, String>();
        extras.put("extra_1", "val1");
        extras.put("extra_2", "val2");

        PushPayload payload = PushPayload.newBuilder()
                .setPlatform(Platform.android_ios())
                .setAudience(Audience.tag("tag1"))
                .setNotification(Notification.newBuilder()
                        .setAlert("alert content")
                        .addPlatformNotification(AndroidNotification.newBuilder()
                                .setTitle("Android Title")
                                .addExtras(extras)
                                .addExtra("booleanExtra", false)
                                .addExtra("numberExtra", 1)
                                .addExtra("jsonExtra", jsonExtra)
                                .build())
                        .addPlatformNotification(IosNotification.newBuilder()
                                .incrBadge(1)
                                .addExtra("extra_key", "extra_value").build())
                        .build())
                .build();

        System.out.println(payload.toJSON());
    }
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:31,代码来源:PushExample.java


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