端末に結びついた登録IDの拡張データを更新します。
プッシュクライアント設定ファイル(push.properties)にあらかじめ設定した値よりも、本処理で設定した値が優先されます。
PushManager pm = new PushManager(context); ... Properties props = PushProperties.getInstance(this);props.setProperty(PushDefine. KEY_EXTENSION_DATA, "xxxx"); try {pm.init(); // init()実行時にIMAPSサーバと通信を行なうので、 } catch (PushException e) { //拡張データを変更する場合もinit()を呼び出す必要があります。 e.printStackTrace(); }
GcmRegister gcm = GcmRegister gcm = GcmRegister.getInstance(this); ... Properties props = PushProperties.getInstance(this);props.setProperty(PushDefine. KEY_EXTENSION_DATA, "xxxx");gcm.register(); // regist()実行時にIMAPSサーバと通信を行なうので、//拡張データを変更する場合もregist()を呼び出す必要があります。 ...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ... if( [application isKindOfClass:[FJPApplication class]] ) { [((FJPApplication*)application) setExtData:@"xxxx"]; } // 本関数を実行後にプッシュ部品のFJPAppDelegateクラス内でIMAPSサーバと通信を行なうので、 // 拡張データを更新する場合も再度呼び出す必要がある [[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; ...
var nullopt = {}; FJPHandler.init("FJ", nullopt, function(result) { // プッシュを受信可能な状態になった後の処理 }, function(result) { // エラー発生時のコールバック } );
動的に値を変更したい場合は、FJPHandler.initの引数optionsに、拡張データをJSON形式で指定してください。
var jsonText = '{"ext_data":"Extension String"}'; FJPHandler.init("FJ",JSON.parse(jsonText ), function(result) { // プッシュを受信可能な状態になった後の処理 }, function(result) { // エラー発生時のコールバック } );