cn.jpush.api.push.model.Options Java Examples

The following examples show how to use cn.jpush.api.push.model.Options. 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
@SuppressWarnings({ "unused", "static-access" })
private PushPayload buildPushObjectByTag(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(); 
}
 
Example #2
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("static-access")
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(); 
}
 
Example #3
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
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(); 
}
 
Example #4
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
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(); 
}
 
Example #5
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
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(); 
}
 
Example #6
Source File: JPushUtil.java    From anyline with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unused")
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(); 
}
 
Example #7
Source File: ApiBootMessagePushJiGuangServiceImpl.java    From api-boot with Apache License 2.0 6 votes vote down vote up
/**
 * setting platform
 *
 * @param messagePushBody ApiBoot Message Push request body
 * @param builder         push payload builder
 */
private void addPlatformMeta(MessagePushBody messagePushBody, PushPayload.Builder builder) {
    switch (messagePushBody.getPlatform()) {
        case ALL:
            builder.setPlatform(Platform.all());
            break;
        case IOS:
            builder.setPlatform(Platform.ios());
            // set is production
            builder.setOptions(Options.newBuilder().setApnsProduction(isProduction()).build());
            break;
        case ANDROID:
            builder.setPlatform(Platform.android());
            break;
        default:
            builder.setPlatform(Platform.all());
            break;
    }
}
 
Example #8
Source File: JpushInterface.java    From java_server with MIT License 6 votes vote down vote up
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();
}
 
Example #9
Source File: JpushInterface.java    From java_server with MIT License 5 votes vote down vote up
public static PushPayload buildPushObject_all_all_alert(String message) {
    return PushPayload.newBuilder()
            .setPlatform(Platform.android_ios())
            .setAudience(Audience.all())
            .setNotification(Notification.alert(message))
            .setOptions(Options.newBuilder().setApnsProduction(false).build())
            .setMessage(Message.newBuilder()
                    .setMsgContent(message)
                    .addExtra("from", "foryou")
                    .build())
            .build();
}
 
Example #10
Source File: JpushInterface.java    From java_server with MIT License 5 votes vote down vote up
public static PushPayload buildPushObject_android_and_ios_alias_alert(String alertString, String phone) {

        return PushPayload.newBuilder()
                .setPlatform(Platform.android_ios())
                .setAudience(Audience.alias(phone))
                .setNotification(Notification.alert(alertString))
                .setOptions(Options.newBuilder().setApnsProduction(false
                ).build())
                .setMessage(Message.newBuilder()
                        .setMsgContent(alertString)
                        .addExtra("from", "foryou")
                        .build())
                .build();
    }
 
Example #11
Source File: JpushInterface.java    From java_server with MIT License 5 votes vote down vote up
public static PushPayload buildPushObject_android_and_ios_tag_alert(
        String message, String tag) {
    return PushPayload.newBuilder()
            .setPlatform(Platform.android_ios())
            .setAudience(Audience.tag(tag))
            .setNotification(Notification.alert(message))
            .setOptions(Options.newBuilder().setApnsProduction(false).build())
            .setMessage(Message.newBuilder()
                    .setMsgContent(message)
                    .addExtra("from", "foryou")
                    .build())
            .build();
}