Java呼び出しオーロラプッシュメッセージ


プロジェクト開発の過程でモバイル側にメッセージをタイミングよくプッシュする機能を使用し、テストの結果、正常に使用できることが分かった.コードは以下の通りである.
public class JPushManager {

	//  
	private static final Logger log = Logger.getLogger(JPushManager.class);
	//  
	private static JPushClient buyerJpushClient = null;

	static {
		String buyerAppKey = null; //  app key
		String buyerMasterSecret = null;//  app 
		// int buyerMaxRetryTimes = 3;//  

		buyerAppKey = "********";
		buyerMasterSecret = "***********";
		ClientConfig config = ClientConfig.getInstance();
		config.setMaxRetryTimes(5);
		config.setApnsProduction(false); 	// development env
		config.setTimeToLive(60 * 60 * 24);
		buyerJpushClient = new JPushClient(buyerMasterSecret, buyerAppKey,
				null, config);
	}

	public static void sendClient(JPushData pushData,
			Map extraMap) {
		PushPayload payload = buildPushObject_all_alias_alert(pushData,
				extraMap);
		try {
			PushResult result = buyerJpushClient.sendPush(payload);
			log.info("Got result - " + result);
		} catch (APIConnectionException e) {
			log.error("Connection error, should retry later", e);
		} catch (APIRequestException e) {
			log.error("Should review the error, and fix the request", e);
			log.info("HTTP Status: " + e.getStatus());
			log.info("Error Code: " + e.getErrorCode());
			log.info("Error Message: " + e.getErrorMessage());
		}
	}

	public static PushPayload buildPushObject_all_alias_alert(
			JPushData pushData, Map extraMap) {
		Message message = Message.newBuilder().setMsgContent(pushData.getContent())
				.setTitle(pushData.getTitle()).setContentType(pushData.getTag()).build();
		return PushPayload.newBuilder().setPlatform(Platform.all())
				.setAudience(Audience.registrationId(pushData.getAlias()))
//				.setNotification(Notification.alert(pushData.getContent()))// 
				.setMessage(message)// 
				.build();
	}
}
public class JPushData {
	
	private String title;  // 
	
	private String content;  // 
	
	private String tag;  // 
	
	
	private List alias;  //

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getTag() {
		return tag;
	}

	public void setTag(String tag) {
		this.tag = tag;
	}

	public List getAlias() {
		return alias;
	}

	public void setAlias(List alias) {
		this.alias = alias;
	}
	
}