ページの先頭行へ戻る
Interstage Mobile Application Server V1.3.0 アプリケーション開発ガイド
FUJITSU Software

6.6.1.2 messageOptionsを指定

共通メッセージ送信のリクエストボディに変数値"messageOptions"を指定することで、各プッシュサービスのオプションを指定できます。
指定可能な定義名は、6.6.1 共通メッセージ送信アプリケーションの開発を参照してください。

以下はmessageOptionsを指定した場合の例です。
HttpClientBuilder httpclient = HttpClientBuilder.create();

String b64_authval = "1234567890abcdefghijklmnop==";
String url = "​https://ホスト名:ポート/pushidmng/notifyCommon";

StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append(" \"message\": \"テストメッセージです。\",");
sb.append(" \"messageOptions\": {");
sb.append(" \"gcm_title\":\"タイトル006\",");
sb.append(" \"apns_action\":\"http://jp.fujitsu.com/\"");
sb.append(" },");
sb.append(" \"extData\": [");
sb.append(" \"apnsExtData001\",\"gcmExtData001\",\"fjpExtData001\"");
sb.append(" ]"); sb.append("}");

HttpPost httpPost = new HttpPost(url);
httpPost.setHeader("IMAPS-Authorization", "Basic " + b64_authval);
httpPost.setHeader("Content-Type", "application/json; charset=UTF-8");
httpPost.setEntity(new StringEntity(sb.toString(),"UTF-8"));

im_response = httpclient.build().execute(httpPost);
上記の例では、Apache HttpClientのOSSを使用しています。