イベント・ソース・ベースの通知からのプッシュ通知のマイグレーション

improve this page | report issue

概説

IBM Mobile Foundation v8.0 から、イベント・ソース・ベースのモデルはサポートされず、プッシュ通知機能は全面的にプッシュ・サービス・モデルによって使用可能になっています。 以前のバージョンの MobileFirst における既存のイベント・ソース・ベースのアプリケーションを v8.0 に移行する場合は、それらのアプリケーションを新しいプッシュ・サービス・モデルにマイグレーションする必要があります。

マイグレーション時には、これは、使用する API を別のものに変更するということではなく、むしろ、使用するモデル/アプローチを別のものに変更するということである点に留意してください。

例えば、イベント・ソース・ベースのモデルでは、通知を特定のセグメントに送信するためにモバイル・アプリケーション・ユーザーをセグメント化する場合、各セグメントを固有のイベント・ソースとしてモデル化します。 プッシュ・サービス・モデルでは、同じことを実現するために、セグメントを表すタグを定義し、ユーザーが各タグをサブスクライブするようにします。 タグ・ベースの通知は、イベント・ソース・ベースの通知を置き換えるものです。

ジャンプ先


次の表に、2 つのモデル間の比較を示します。

ユーザー要件 イベント・ソース・モデル プッシュ・サービス・モデル
アプリケーションでプッシュ通知を使用可能にするには
  • イベント・ソース・アダプターを作成し、その中で EventSource を作成します。
  • プッシュ資格情報を使用してアプリケーションを構成またはセットアップします。
プッシュ資格情報を使用してアプリケーションを構成またはセットアップします。
モバイル・クライアント・アプリケーションでプッシュ通知を使用可能にするには
  • WLClient を作成します。
  • MobileFirst Server に接続します。
  • プッシュ・クライアントのインスタンスを取得します。
  • イベント・ソースにサブスクライブします。
  • プッシュ・クライアントのインスタンスを生成します。
  • プッシュ・クライアントを初期化します。
  • モバイル・デバイスを登録します。
モバイル・クライアント・アプリケーションで特定のタグに基づいた通知を使用可能にするには サポートされません。 対象のタグ (タグ名を使用) をサブスクライブします。
モバイル・クライアント・アプリケーションで通知を受け取って処理するには リスナー実装を登録します。 リスナー実装を登録します。
プッシュ通知をモバイル・クライアント・アプリケーションに送信するには
  • WL.Server API を内部的に呼び出してプッシュ通知を送信する、アダプター・プロシージャーを実装します。
  • WL サーバー API は、以下のように通知を送信する手段を提供します。
    • ユーザー別
    • デバイス別
    • ブロードキャスト (すべてのデバイス)
  • その後、バックエンド・サーバー・アプリケーションは、アダプター・プロシージャーを呼び出して、アプリケーション・ロジックの一部としてプッシュ通知をトリガーできます。
  • バックエンド・サーバー・アプリケーションは、メッセージ REST API を直接呼び出すことができます。 ただし、そのようなアプリケーションは、MobileFirst Server に機密クライアントとして登録し、有効な OAuth アクセス・トークンを取得し、それを REST API の許可ヘッダーで渡す必要があります。
  • REST API は、以下のように通知を送信するオプションを備えています。
    • ユーザー別
    • デバイス別
    • プラットフォーム別
    • タグ別
    • ブロードキャスト (すべてのデバイス)
定期的な期間 (ポーリング間隔) でプッシュ通知をトリガーするには イベント・ソース・アダプター内にプッシュ通知を送信する関数を実装し、これを createEventSource 関数呼び出しの一部として実装します。 サポートされません。
フックを名前、URL、およびイベント・タイプで登録するには プッシュ通知をサブスクライブまたはアンサブスクライブするデバイスのパスに、フックを実装します。 サポートされません。

マイグレーション・シナリオ

Mobile Foundation v8.0 以降、イベント・ソース・ベースのモデルはサポートされなくなり、プッシュ通知機能は全面的にプッシュ・サービス・モデルによって Mobile Foundation で使用可能になります。このモデルは、イベント・ソース・モデルよりもシンプルでアジャイルな代替モデルです。

以前のバージョンの IBM MobileFirst Platform Foundation における既存のイベント・ソース・ベースのアプリケーションは、v8.0 の新しいプッシュ・サービス・モデルにマイグレーションする必要があります。

ジャンプ先のセクション

ハイブリッド・アプリケーション

マイグレーション・シナリオ例では、単一のイベント・ソースまたは複数のイベント・ソース、ブロードキャスト通知またはユニキャスト通知、あるいはタグ通知を使用するアプリケーションを扱っています。

シナリオ 1: アプリケーションで単一のイベント・ソースを使用する既存のアプリケーション

以前のバージョンの MobileFirst では、イベント・ソース・ベースのモデルを使用したプッシュのみがサポートされていたため、アプリケーションは単一のイベント・ソースを使用していました。

クライアント

V8.0.0 にこれをマイグレーションするには、このモデルをユニキャスト通知に変換します。

  1. 以下のように、アプリケーションで MobileFirst プッシュ・クライアント・インスタンスを初期化し、成功コールバックで、通知を受け取る必要があるコールバック・メソッドを登録します。

    MFPPush.initialize(function(successResponse){
    MFPPush.registerNotificationsCallback(notificationReceived); },
    function(failureResponse){alert("Failed to initialize");    
                               }  
    );
    
  2. 通知コールバック・メソッドを実装します。

    var notificationReceived = function(message) {
         alert(JSON.stringify(message));
    };
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPush.registerDevice(function(successResponse) {
         alert("Successfully registered");
         },
       function(failureResponse) {
         alert("Failed to register");
         }
    );
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPush.unregisterDevice(function(successResponse) {
         alert("Successfully unregistered");
         },
       function(failureResponse) {
         alert("Failed to unregister");
         }
    );
    
  5. WL.Client.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    MFPPush.isPushSupported (function(successResponse) {
         alert(successResponse);
        },
        function(failureResponse) {
            alert("Failed to get the push suport status");
        }
    );
    
  6. サブスクライブ対象のイベント・ソースがないため、以下の WL.Client.Push API を削除し、通知コールバックを登録します。

    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • onReadyToSubscribe()
サーバー
  1. アダプターで以下の WL.Server API を削除します (使用されている場合)。
    • notifyAllDevices()
    • notifyDevice()
    • notifyDeviceSubscription()
    • createEventSource()
  2. 同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。
    1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

      Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

    2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
    3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
    4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 2: アプリケーションで複数のイベント・ソースを使用する既存のアプリケーション

複数のイベント・ソースを使用するアプリケーションでは、サブスクリプションに基づいてユーザーをセグメント化する必要があります。

クライアント

これは、対象トピックに基づいてユーザー/デバイスをセグメント化するタグにマップされます。 これをマイグレーションするために、このモデルをタグ・ベースの通知に変換できます。

  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化し、成功コールバックで、通知を受け取る必要があるコールバック・メソッドを登録します。

    MFPPush.initialize(function(successResponse){
         MFPPush.registerNotificationsCallback(notificationReceived);              					},
         function(failureResponse){
             alert("Failed to initialize");
         }
    );
    
  2. 通知コールバック・メソッドを実装します。

    var notificationReceived = function(message) {
         alert(JSON.stringify(message));
    };
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPush.registerDevice(function(successResponse) {
         alert("Successfully registered");
         },
       function(failureResponse) {
         alert("Failed to register");
         }
    );
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPush.unregisterDevice(function(successResponse) {
         alert("Successfully unregistered");
         },
       function(failureResponse) {
         alert("Failed to unregister");
         }
    );
    
  5. WL.Client.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    MFPPush.isPushSupported (function(successResponse) {
         alert(successResponse);
        },
        function(failureResponse) {
         alert("Failed to get the push suport status");
        }
    );
    
  6. サブスクライブ対象のイベント・ソースがないため、以下の WL.Client.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • onReadyToSubscribe()
  7. タグにサブスクライブします。

    var tags = ['sample-tag1','sample-tag2'];
    MFPPush.subscribe(tags, function(successResponse) {
     	alert("Successfully subscribed");
         },
       function(failureResponse) {
     	alert("Failed to subscribe");
         }
    );
    
  8. (オプション) タグからアンサブスクライブします。

    MFPPush.unsubscribe(tags, function(successResponse) {
         alert("Successfully unsubscribed");
         },
       function(failureResponse) {
         alert("Failed to unsubscribe");
         }
    );
    
サーバー

アダプターで以下の WL.Server API (使用されている場合) を削除します。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 3: アプリケーションでブロードキャスト/ユニキャスト通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化し、成功コールバックで、通知を受け取る必要があるコールバック・メソッドを登録します。

    MFPPush.initialize(function(successResponse){
         MFPPush.registerNotificationsCallback(notificationReceived);              					},
         function(failureResponse){
             alert("Failed to initialize");
         }
    );
    
  2. 通知コールバック・メソッドを実装します。

    var notificationReceived = function(message) {
         alert(JSON.stringify(message));
    };
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPush.registerDevice(function(successResponse) {
         alert("Successfully registered");
         },
       function(failureResponse) {
         alert("Failed to register");
         }
    );
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPush.unregisterDevice(function(successResponse) {
         alert("Successfully unregistered");
         },
       function(failureResponse) {
         alert("Failed to unregister");
         }
    );
    
  5. WL.Client.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    MFPPush.isPushSupported (function(successResponse) {
         alert(successResponse);
         },
       function(failureResponse) {
         alert("Failed to get the push suport status");
         }
    );
    
  6. 以下の WL.Client.Push API を削除します。

    • onReadyToSubscribe()
    • onMessage()
サーバー

アダプターで WL.Server.sendMessage() (使用されている場合) を削除します。
同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 4: アプリケーションでタグ通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化し、成功コールバックで、通知を受け取る必要があるコールバック・メソッドを登録します。

    MFPPush.initialize(function(successResponse){
         MFPPush.registerNotificationsCallback(notificationReceived);              					},
         function(failureResponse){
             alert("Failed to initialize");
         }
    );
    
  2. 通知コールバック・メソッドを実装します。

    var notificationReceived = function(message) {
         alert(JSON.stringify(message));
    };
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPush.registerDevice(function(successResponse) {
         alert("Successfully registered");
         },
       function(failureResponse) {
         alert("Failed to register");
         }
    );
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPush.unregisterDevice(function(successResponse) {
         alert("Successfully unregistered");
         },
       function(failureResponse) {
         alert("Failed to unregister");
         }
    );
    
  5. WL.Client.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    MFPPush.isPushSupported (function(successResponse) {
         alert(successResponse);
        },
        function(failureResponse) {
         alert("Failed to get the push suport status");
        }
    );
    
  6. 以下の WL.Client.Push API を削除します。
    • subscribeTag()
    • unsubscribeTag()
    • isTagSubscribed()
    • onReadyToSubscribe()
    • onMessage()
  7. 以下のように、タグにサブスクライブします。

    var tags = ['sample-tag1','sample-tag2'];
    MFPPush.subscribe(tags, function(successResponse) {
         alert("Successfully subscribed");
         },
       function(failureResponse) {
         alert("Failed to subscribe");
         }
    );
    
  8. (オプション) 以下のように、タグからアンサブスクライブします。

    MFPPush.unsubscribe(tags, function(successResponse) {
         alert("Successfully unsubscribed");
         },
       function(failureResponse) {
         alert("Failed to unsubscribe");
         }
    );
    
サーバー

アダプターで WL.Server.sendMessage() (使用されている場合) を削除します。
同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

ネイティブ Android アプリケーション

マイグレーション・シナリオ例では、単一のイベント・ソースまたは複数のイベント・ソース、ブロードキャスト通知またはユニキャスト通知、あるいはタグ通知を使用するアプリケーションを扱っています。

シナリオ 1: アプリケーションで単一のイベント・ソースを使用する既存のアプリケーション

以前のバージョンの MobileFirst では、イベント・ソース・ベースのモデルを使用したプッシュのみがサポートされていたため、アプリケーションは単一のイベント・ソースを使用していました。

クライアント

v8.0 にこれをマイグレーションするには、このモデルをユニキャスト通知に変換します。

  1. アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.getInstance();
         push.initialize(_this);
    
  2. インターフェース MFPPushNotificationListener を実装し、onReceive() を定義します。

    @Override
    public void onReceive(MFPSimplePushNotification message) {
         Log.i("Push Notifications", message.getAlert());
    }
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    push.registerDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to register");
         }
         @Override
         public void onSuccess(String arg0) {
            Log.i("Push Notifications", "Registered successfully");
    
         }
    });
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    push.unregisterDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to unregister");
    
         }
         @Override
         public void onSuccess(String arg0) {
              Log.i("Push Notifications", "Unregistered successfully");
         }
    });
    
  5. WLClient.Push.isPushSupported() (使用されている場合) を削除し、push.isPushSupported(); を使用します。
  6. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • WLOnReadyToSubscribeListener および WLNotificationListener 実装
サーバー

アダプターで以下の WL.Server API (使用されている場合) を削除します。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 2: アプリケーションで複数のイベント・ソースを使用する既存のアプリケーション

複数のイベント・ソースを使用するアプリケーションでは、サブスクリプションに基づいてユーザーをセグメント化する必要があります。

クライアント

これは、対象トピックに基づいてユーザー/デバイスをセグメント化するタグにマップされます。 Mobile Foundation V8.0.0 にこれをマイグレーションするには、このモデルをタグ・ベースの通知に変換します。

  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.getInstance();
         push.initialize(_this);
    
  2. インターフェース MFPPushNotificationListener を実装し、onReceive() を定義します。

    @Override
    public void onReceive(MFPSimplePushNotification message) {
         Log.i("Push Notifications", message.getAlert());
    }
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    push.registerDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to register");
         }
         @Override
         public void onSuccess(String arg0) {
             Log.i("Push Notifications", "Registered successfully");
         }
    });
    
  4. (オプション) 次のように、モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    push.unregisterDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to unregister");
    
         }
         @Override
         public void onSuccess(String arg0) {
              Log.i("Push Notifications", "Unregistered successfully");
         }
    });
    
  5. WLClient.Push.isPushSupported() (使用されている場合) を削除し、push.isPushSupported(); を使用します。
  6. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
  7. WLOnReadyToSubscribeListener および WLNotificationListener の実装
  8. 以下のように、タグにサブスクライブします。

    String[] tags = new String[2];
    tags[0] ="sample-tag1";
    tags[1] ="sample-tag2";
    push.subscribe(tags, new MFPPushResponseListener<String[]>(){
    
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Failed to subscribe");
         }
    
         @Override
         public void onSuccess(String[] arg0) {
             Log.i( "Subscribed successfully");
         }
    });
    
  9. (オプション) 以下のように、タグからアンサブスクライブします。

    String[] tags = new String[2];
    tags[0] ="sample-tag1";
    tags[1] ="sample-tag2";
    push.unsubscribe(tags, new MFPPushResponseListener<String[]>(){
    
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to unsubscribe");
         }
    
         @Override
         public void onSuccess(String[] arg0) {
             Log.i("Push Notifications", "Unsubscribed successfully");
         }
    });
    
サーバー

アダプターで以下の WL.Server API (使用されている場合) を削除します。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 3: アプリケーションでブロードキャスト/ユニキャスト通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.getInstance();
         push.initialize(_this);
    
  2. インターフェース MFPPushNotificationListener を実装し、onReceive() を定義します。

    @Override
    public void onReceive(MFPSimplePushNotification message) {
         Log.i("Push Notifications", message.getAlert());
    }
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    push.registerDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to register");
         }
         @Override
         public void onSuccess(String arg0) {
            Log.i("Push Notifications", "Registered successfully");
    
         }
    });
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    push.unregisterDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to unregister");
    
         }
         @Override
         public void onSuccess(String arg0) {
              Log.i("Push Notifications", "Unregistered successfully");
         }
    });
    
  5. WLClient.Push.isPushSupported() (使用されている場合) を削除し、push.isPushSupported(); を使用します。
  6. 以下の WLClient.Push API を削除します。
    • registerEventSourceCallback()
    • WLOnReadyToSubscribeListener および WLNotificationListener の実装
サーバー

アダプターで WL.Server.sendMessage() API を削除します (使用されている場合)。

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 4: アプリケーションでタグ通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.getInstance();
         push.initialize(_this);
    
  2. インターフェース MFPPushNotificationListener を実装し、onReceive() を定義します。

    @Override
    public void onReceive(MFPSimplePushNotification message) {
         Log.i("Push Notifications", message.getAlert());
    }
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    push.registerDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to register");
         }
         @Override
         public void onSuccess(String arg0) {
             Log.i("Push Notifications", "Registered successfully");
         }
    });
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    push.unregisterDevice(new MFPPushResponseListener<String>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to unregister");
    
         }
         @Override
         public void onSuccess(String arg0) {
              Log.i("Push Notifications", "Unregistered successfully");
         }
    });
    
  5. WLClient.Push.isPushSupported() (使用されている場合) を削除し、push.isPushSupported(); を使用します。
  6. 以下の WLClient.Push API を削除します。
    • subscribeTag()
    • unsubscribeTag()
    • isTagSubscribed()
    • WLOnReadyToSubscribeListener および WLNotificationListener の実装
  7. 以下のように、タグにサブスクライブします。

    String[] tags = new String[2];
    tags[0] ="sample-tag1";
    tags[1] ="sample-tag2";
    push.subscribe(tags, new MFPPushResponseListener<String[]>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Failed to subscribe");
         }
    
         @Override
         public void onSuccess(String[] arg0) {
             Log.i( "Subscribed successfully");
         }
    });
    
  8. (オプション) 以下のように、タグからアンサブスクライブします。

    String[] tags = new String[2];
    tags[0] ="sample-tag1";
    tags[1] ="sample-tag2";
    push.unsubscribe(tags, new MFPPushResponseListener<String[]>(){
         @Override
         public void onFailure(MFPPushException arg0) {
             Log.i("Push Notifications", "Failed to unsubscribe");
         }
    
         @Override
         public void onSuccess(String[] arg0) {
             Log.i("Push Notifications", "Unsubscribed successfully");
         }
    });
    
サーバー

アダプターで WL.Server.sendMessage() (使用されている場合) を削除します。

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

ネイティブ iOS アプリケーション

マイグレーション・シナリオ例では、単一のイベント・ソースまたは複数のイベント・ソース、ブロードキャスト通知またはユニキャスト通知、あるいはタグ通知を使用するアプリケーションを扱っています。

シナリオ 1: アプリケーションで単一のイベント・ソースを使用する既存のアプリケーション

以前のバージョンの MobileFirst では、イベント・ソース・ベースのモデルを使用したプッシュのみがサポートされていたため、アプリケーションは単一のイベント・ソースを使用していました。

クライアント

v8.0 にこれをマイグレーションするには、このモデルをユニキャスト通知に変換します。

  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    [[MFPPush sharedInstance] initialize];
    
  2. didReceiveRemoteNotification() で通知処理を実装します。
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    [[MFPPush sharedInstance] registerDevice:^(WLResponse *response, NSError *error) {
         if(error){
     	   NSLog(@"Failed to register");
         } else {
             NSLog(@"Successfullyregistered");
         }
    }];
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    [MFPPush sharedInstance] unregisterDevice:^(WLResponse *response, NSError *error) {
         if(error){
            NSLog(@"Failed to unregister");
         } else {
            NSLog(@"Successfully unregistered");
         }
    }];
    
  5. WLClient.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    [[MFPPush sharedInstance] isPushSupported]
    
  6. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • WLOnReadyToSubscribeListener 実装
  7. didRegisterForRemoteNotificationsWithDeviceTokensendDeviceToken() を呼び出します。

    [[MFPPush sharedInstance] sendDeviceToken:deviceToken];
    
サーバー

アダプターで以下の WL.Server API を削除します (使用されている場合)。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 2: アプリケーションで複数のイベント・ソースを使用する既存のアプリケーション

複数のイベント・ソースを使用するアプリケーションでは、サブスクリプションに基づいてユーザーをセグメント化する必要があります。

クライアント

これは、対象トピックに基づいてユーザー/デバイスをセグメント化するタグにマップされます。 MobileFirst V8.0.0 にこれをマイグレーションするには、このモデルをタグ・ベースの通知に変換します。

  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    [[MFPPush sharedInstance] initialize];
    
  2. didReceiveRemoteNotification() で通知処理を実装します。
  3. 次のように、モバイル・デバイスをプッシュ通知サービスに登録します。

    [[MFPPush sharedInstance] registerDevice:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to register");
         }else{
         	NSLog(@"Successfullyregistered");
         }
    }];
    
  4. (オプション) 次のように、モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    [MFPPush sharedInstance] unregisterDevice:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to unregister");
         }else{
         	NSLog(@"Successfully unregistered");
         }
    }];
    
  5. WLClient.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    [[MFPPush sharedInstance] isPushSupported]
    
  6. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • WLOnReadyToSubscribeListener 実装
  7. didRegisterForRemoteNotificationsWithDeviceTokensendDeviceToken() を呼び出します。
  8. 以下のように、タグにサブスクライブします。

    NSMutableArray *tags = [[NSMutableArray alloc]init];
    [tags addObject:@"sample-tag1"];
    [tags addObject:@"sample-tag2"];
    [MFPPush sharedInstance] subscribe:tags completionHandler:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to unregister");
         }else{
         	NSLog(@"Successfully unregistered");
         }
    }];
    
  9. (オプション) 以下のように、タグからアンサブスクライブします。

    NSMutableArray *tags = [[NSMutableArray alloc]init];
    [tags addObject:@"sample-tag1"];
    [tags addObject:@"sample-tag2"];
    [MFPPush sharedInstance] unsubscribe:tags completionHandler:^(WLResponse *response, NSError *error) {
         if(error){
            NSLog(@"Failed to unregister");
         }else{
            NSLog(@"Successfully unregistered");
         }
    }];
    
サーバー

:{: #server-ios-2 } アダプターで WL.Server (使用されている場合) を削除します。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 3: アプリケーションでブロードキャスト/ユニキャスト通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    [[MFPPush sharedInstance] initialize];
    
  2. didReceiveRemoteNotification() で通知処理を実装します。
  3. 次のように、モバイル・デバイスをプッシュ通知サービスに登録します。

    [[MFPPush sharedInstance] registerDevice:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to register");
         }else{
         	NSLog(@"Successfullyregistered");
         }
    }];
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    [MFPPush sharedInstance] unregisterDevice:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to unregister");
         }else{
         	NSLog(@"Successfully unregistered");
         }
    }];
    
  5. WLClient.Push.isPushSupported() を削除し (使用されている場合)、以下を使用します。

    [[MFPPush sharedInstance] isPushSupported]
    
  6. 以下の WLClient.Push API を削除します。
    • registerEventSourceCallback()
    • WLOnReadyToSubscribeListener 実装
サーバー

アダプターで WL.Server.sendMessage (使用されている場合) を削除します。

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

シナリオ 4: アプリケーションでタグ通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    [[MFPPush sharedInstance] initialize];
    
  2. didReceiveRemoteNotification() で通知処理を実装します。
  3. 次のように、モバイル・デバイスをプッシュ通知サービスに登録します。

    [[MFPPush sharedInstance] registerDevice:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to register");
         }else{
         	NSLog(@"Successfullyregistered");
         }
    }];
    
  4. (オプション) 次のように、モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    [MFPPush sharedInstance] unregisterDevice:^(WLResponse *response, NSError *error) {
         if(error){
            NSLog(@"Failed to unregister");
         }else{
            NSLog(@"Successfully unregistered");
         }
    }];
    
  5. WLClient.Push.isPushSupported() を削除し (使用されている場合)、[[MFPPush sharedInstance] isPushSupported] を使用します。
  6. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribeTag()
    • unsubscribeTag()
    • isTagSubscribed()
    • WLOnReadyToSubscribeListener 実装
  7. didRegisterForRemoteNotificationsWithDeviceTokensendDeviceToken() を呼び出します。
  8. 以下のように、タグにサブスクライブします。

    NSMutableArray *tags = [[NSMutableArray alloc]init];
    [tags addObject:@"sample-tag1"];
    [tags addObject:@"sample-tag2"];
    [MFPPush sharedInstance] subscribe:tags completionHandler:^(WLResponse *response, NSError *error) {
         if(error){
            NSLog(@"Failed to unregister");
         }else{
            NSLog(@"Successfully unregistered");
        }
    }];
    
  9. (オプション) 以下のように、タグからアンサブスクライブします。

    NSMutableArray *tags = [[NSMutableArray alloc]init];
    [tags addObject:@"sample-tag1"];
    [tags addObject:@"sample-tag2"];
    [MFPPush sharedInstance] unsubscribe:tags completionHandler:^(WLResponse *response, NSError *error) {
         if(error){
         	NSLog(@"Failed to unregister");
         }else{
         	NSLog(@"Successfully unregistered");
         }
    }];
    
サーバー

アダプターで WL.Server.sendMessage を削除します (使用されている場合)。

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console を使用して資格情報をセットアップします。 『プッシュ通知設定の構成 (Configuring push notification settings)』を参照してください。

    Update GCM settings (PUT) REST API (Android アプリケーションの場合) または Update APNs settings (PUT) REST API (iOS アプリケーションの場合) を使用して、資格情報をセットアップすることもできます。

  2. 「スコープ・エレメントのマッピング (Scope Elements Mapping)」でスコープ push.mobileclient を追加します。
  3. プッシュ通知をサブスクライバーに送信できるようにするタグを作成します。 プッシュ通知のためのタグの定義を参照してください。
  4. 以下の方法のいずれかを使用して通知を送信できます。

ネイティブ Windows ユニバーサル・アプリケーション

マイグレーション・シナリオ例では、単一のイベント・ソースまたは複数のイベント・ソース、ブロードキャスト通知またはユニキャスト通知、あるいはタグ通知を使用するアプリケーションを扱っています。

シナリオ 1: アプリケーションで単一のイベント・ソースを使用する既存のアプリケーション

v8.0 にこれをマイグレーションするには、このモデルをユニキャスト通知に変換します。

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.GetInstance();
    push.Initialize();
    Implement the interface MFPPushNotificationListener and define onReceive().
    class Pushlistener : MFPPushNotificationListener
    {
         public void onReceive(String properties, String payload)
         {
                 Debug.WriteLine("Push Notifications\n properties:" + properties + "\n payload:" + payload);
         }
    }
    
  2. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPushMessageResponse Response = await push.RegisterDevice(null);
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Registered successfully");
    } 
    else
    {
         Debug.WriteLine("Push Notifications Failed to register");
    }
    
  3. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPushMessageResponse Response = await push.UnregisterDevice();
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Failed to unregister");
    }
    else
    {
         Debug.WriteLine("Push Notifications Unregistered successfully");
    }
    
  4. WLClient.Push.IsPushSupported() (使用されている場合) を削除し、push.IsPushSupported(); を使用します。
  5. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • WLOnReadyToSubscribeListener および WLNotificationListener 実装
サーバー

アダプターで以下の WL.Server API (使用されている場合) を削除します。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console の「プッシュ設定」ページで WNS 資格情報をセットアップするか、WNS Settings REST API を使用します。
  2. スコープ push.mobileclient を、MobileFirst Operations Console の「セキュリティー」タブにある「スコープ・エレメントのマッピング」セクションに追加します。
  3. また、Push Message (POST) REST API を使用し、userId/deviceId を指定することで、メッセージを送信することもできます。

シナリオ 2: アプリケーションで複数のイベント・ソースを使用する既存のアプリケーション

複数のイベント・ソースを使用するアプリケーションでは、サブスクリプションに基づいてユーザーをセグメント化する必要があります。

クライアント

これは、対象トピックに基づいてユーザー/デバイスをセグメント化するタグにマップされます。 MobileFirst V8.0.0 にこれをマイグレーションするには、このモデルをタグ・ベースの通知に変換します。

  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.GetInstance();
    push.Initialize();
    Implement the interface MFPPushNotificationListener and define onReceive().
    class Pushlistener : MFPPushNotificationListener
    {
         public void onReceive(String properties, String payload)
         {
                 Debug.WriteLine("Push Notifications\n properties:" + properties + "\n payload:" + payload);
         }
    }
    
  2. モバイル・デバイスを IMFPUSH サービスに登録します。

    MFPPushMessageResponse Response = await push.RegisterDevice(null);
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Registered successfully");
    } 
    else
    {
         Debug.WriteLine("Push Notifications Failed to register");
    }
    
  3. (オプション) 以下のように、モバイル・デバイスを IMFPUSH サービスから登録抹消します。

    MFPPushMessageResponse Response = await push.UnregisterDevice();
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Failed to unregister");
    }
    else
    {
         Debug.WriteLine("Push Notifications Unregistered successfully");
    }
    
  4. WLClient.Push.IsPushSupported() (使用されている場合) を削除し、push.IsPushSupported(); を使用します。
  5. サブスクライブ対象のイベント・ソースがないため、以下の WLClient.Push API を削除し、通知コールバックを登録します。
    • registerEventSourceCallback()
    • subscribe()
    • unsubscribe()
    • isSubscribed()
    • WLOnReadyToSubscribeListener および WLNotificationListener 実装
  6. 以下のように、タグにサブスクライブします。

    String[] Tag = { "sample-tag1", "sample-tag2" };
    MFPPushMessageResponse Response = await push.Subscribe(Tag);
    if (Response.Success == true)
    {
         Debug.WriteLine("Subscribed successfully");
    }
    else
    {
         Debug.WriteLine("Failed to subscribe");
    }
    
  7. (オプション) 以下のように、タグからアンサブスクライブします。

    String[] Tag = { "sample-tag1", "sample-tag2" };
    MFPPushMessageResponse Response = await push.Unsubscribe(Tag);
    if (Response.Success == true)
    {
         Debug.WriteLine("Unsubscribed successfully");
    }
    else
    {
         Debug.WriteLine("Failed to unsubscribe");
    }
    
サーバー

アダプターで以下の WL.Server API (使用されている場合) を削除します。

  • notifyAllDevices()
  • notifyDevice()
  • notifyDeviceSubscription()
  • createEventSource()

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console の「プッシュ設定」ページで WNS 資格情報をセットアップするか、WNS Settings REST API を使用します。
  2. スコープ push.mobileclient を、MobileFirst Operations Console の「セキュリティー」タブにある「スコープ・エレメントのマッピング」セクションに追加します。
  3. MobileFirst Operations Console の「タグ」ページでプッシュ・タグを作成します。
  4. また、Push Message (POST) REST API を使用し、ターゲットとして userId/deviceId/tagNames を指定することで、通知を送信することもできます。

シナリオ 3: アプリケーションでブロードキャスト/ユニキャスト通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.GetInstance();
    push.Initialize();
    Implement the interface MFPPushNotificationListener and define onReceive().
    class Pushlistener : MFPPushNotificationListener
    {
         public void onReceive(String properties, String payload)
         {
                 Debug.WriteLine("Push Notifications\n properties:" + properties + "\n payload:" + payload);
         }
    }
    
  2. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPushMessageResponse Response = await push.RegisterDevice(null);
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Registered successfully");
    } 
    else
    {
         Debug.WriteLine("Push Notifications Failed to register");
    }
    
  3. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPushMessageResponse Response = await push.UnregisterDevice();
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Failed to unregister");
    }
    else
    {
         Debug.WriteLine("Push Notifications Unregistered successfully");
    }
    
  4. WLClient.Push.isPushSupported() (使用されている場合) を削除し、push.IsPushSupported(); を使用します。
  5. 以下の WLClient.Push API を削除します。
    • registerEventSourceCallback()
    • WLOnReadyToSubscribeListener および WLNotificationListener 実装
サーバー

アダプターで WL.Server.sendMessage() (使用されている場合) を削除します。

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console の「プッシュ設定」ページで WNS 資格情報をセットアップするか、WNS Settings REST API を使用します。
  2. スコープ push.mobileclient を、MobileFirst Operations Console の「セキュリティー」タブにある「スコープ・エレメントのマッピング」セクションに追加します。
  3. MobileFirst Operations Console の「タグ」ページでプッシュ・タグを作成します。
  4. また、Push Message (POST) REST API を使用し、ターゲットとして userId/deviceId/tagNames を指定することで、通知を送信することもできます。

シナリオ 4: アプリケーションでタグ通知を使用する既存のアプリケーション

クライアント
  1. 以下のように、アプリケーションで MFPPush クライアント・インスタンスを初期化します。

    MFPPush push = MFPPush.GetInstance();
    push.Initialize();
    
  2. インターフェース MFPPushNotificationListener を実装し、onReceive() を定義します。

    class Pushlistener : MFPPushNotificationListener
    {
         public void onReceive(String properties, String payload)
         {
                 Debug.WriteLine("Push Notifications\n properties:" + properties + "\n payload:" + payload);
         }
    }
    
  3. モバイル・デバイスをプッシュ通知サービスに登録します。

    MFPPushMessageResponse Response = await push.RegisterDevice(null);
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Registered successfully");
    } 
    else
    {
         Debug.WriteLine("Push Notifications Failed to register");
    }
    
  4. (オプション) モバイル・デバイスをプッシュ通知サービスから登録抹消します。

    MFPPushMessageResponse Response = await push.UnregisterDevice();
    if (Response.Success == true)
    {
         Debug.WriteLine("Push Notifications Failed to unregister");
    }
    else
    {
         Debug.WriteLine("Push Notifications Unregistered successfully");
    }
    
  5. WLClient.Push.IsPushSupported() (使用されている場合) を削除し、push.IsPushSupported(); を使用します。
  6. 以下の WLClient.Push API を削除します。
    • subscribeTag()
    • unsubscribeTag()
    • isTagSubscribed()
    • WLOnReadyToSubscribeListener および WLNotificationListener 実装
  7. 以下のように、タグにサブスクライブします。

    String[] Tag = { "sample-tag1", "sample-tag2" };
    MFPPushMessageResponse Response = await push.Subscribe(Tag);
    if (Response.Success == true)
    {
         Debug.WriteLine("Subscribed successfully");
    }
    else
    {
         Debug.WriteLine("Failed to subscribe");
    }
    
  8. (オプション) 以下のように、タグからアンサブスクライブします。

    String[] Tag = { "sample-tag1", "sample-tag2" };
    MFPPushMessageResponse Response = await push.Unsubscribe(Tag);
    if (Response.Success == true)
    {
         Debug.WriteLine("Unsubscribed successfully");
    }
    else
    {
         Debug.WriteLine("Failed to unsubscribe");
    }
    
サーバー

アダプターで WL.Server.sendMessage() (使用されている場合) を削除します。

同じイベント・ソースを使用していた各アプリケーションに対して、以下のステップを実行します。

  1. MobileFirst Operations Console の「プッシュ設定」ページで WNS 資格情報をセットアップするか、WNS Settings REST API を使用します。
  2. スコープ push.mobileclient を、MobileFirst Operations Console の「セキュリティー」タブにある「スコープ・エレメントのマッピング」セクションに追加します。
  3. MobileFirst Operations Console の「タグ」ページでプッシュ・タグを作成します。
  4. また、Push Message (POST) REST API を使用し、ターゲットとして userId/deviceId/tagNames を指定することで、通知を送信することもできます。

マイグレーション・ツール

マイグレーション・ツールは、MobileFirst Platform Foundation 7.1 のプッシュ・データ (デバイス、ユーザーのサブスクリプション、資格情報、およびタグ) を Mobile Foundation 8.0 にマイグレーションする際に役立ちます。
マイグレーション・ツールは、以下の機能を使用してこのプロセスを簡素化します。

  1. デバイス、資格情報、タグ、およびユーザー・サブスクリプションを、アプリケーションごとに、MobileFirst Platform Foundation 7.1 データベースから読み取ります。
  2. このデータを、それぞれのアプリケーション用の Mobile Foundation 8.0 データベース内にある、それぞれの表にコピーします。
  3. v8.0 アプリケーションでの環境にかかわらず、v7.1 の全環境の全プッシュ・データをマイグレーションします。

マイグレーション・ツールによってユーザー・サブスクリプション関連、アプリケーション環境関連、およびデバイス関連のデータが変更されることは一切ありません。

マイグレーション・ツールを使用する前に、以下の情報を知っておくことが重要です。

  1. Java バージョン 1.6 以上が必要です。
  2. MobileFirst Server 7.1 と MobileFirst Server 8.0 の両方がセットアップされ、使用できる状態になっていることを確認します。
  3. MobileFirst Server 7.1 と MobileFirst Server 8.0 の両方のバックアップをとります。
  4. 最新バージョンのアプリケーションを MobileFirst Server 8.0 に登録します。
    • アプリケーションの表示名は、MobileFirst Platform Foundation 7.1 内でのそのアプリケーションと一致している必要があります。
    • PacakgeName/BundleID を覚えておき、同じ値をアプリケーションに対して指定します。
    • アプリケーションが MobileFirst Server 8.0 に登録されていない場合、マイグレーションは成功しません。
  5. アプリケーションの各環境に応じて、スコープ・エレメントのマッピングを指定します。 スコープのマッピングについてもっとよく知る

手順

  1. 下記の GitHub リポジトリーからマイグレーション・ツールをダウンロードします。
  2. ツールをダウンロードしたら、migration.properties ファイルに以下の詳細を指定します。

    説明 サンプル値
    w.db.type 対象とするデータベースのタイプ pw.db.type = db2 possible values DB2,Oracle,MySql,Derby
    pw.db.url MobileFirst Platform Foundation 7.1 Worklight データベースの URL jdbc:mysql://localhost:3306/WRKLGHT
    pw.db.adminurl MobileFirst Platform Foundation 7.1 Admin データベースの URL jdbc:mysql://localhost:3306/ADMIN
    pw.db.username MobileFirst Platform Foundation 7.1 Worklight データベースのユーザー名 pw.db.username=root
    pw.db.password MobileFirst Platform Foundation 7.1 Worklight データベースのパスワード pw.db.password=root
    pw.db.adminusername MobileFirst Platform Foundation 7.1 Admin データベースのユーザー名 pw.db.adminusername=root
    pw.db.adminpassword MobileFirst Platform Foundation 7.1 Admin データベースのパスワード pw.db.adminpassword=root
    pw.db.urlTarget MFP 8.0 データベースの URL jdbc:mysql://localhost:3306/MFPDATA
    pw.db.usernameTarget MFP 8.0 データベースのユーザー名 pw.db.usernameTarget=root
    pw.db.passwordTarget MFP 8.0 データベースのパスワード pw.db.passwordTarget=root
    pw.db.schema MobileFirst Platform Foundation 7.1 Worklight データベースのスキーマ WRKLGT
    pw.db.adminschema MobileFirst Platform Foundation 7.1 Admin データベースのスキーマ WLADMIN
    pw.db.targetschema Mobile Foundation 8.0 Worklight データベースのスキーマ MFPDATA
    runtime MobileFirst Platform Foundation 7.1 のランタイム名 runtime=worklight
    applicationId MobileFirst Platform Foundation 7.1 に登録されているアプリケーションの、コンマ (,) 区切りのリストを指定します。 HybridTestApp,NativeiOSTestApp
    targetApplicationId Mobile Foundation 8.0 に登録されているアプリケーションの、コンマ (,) 区切りのリストを指定します。 com.HybridTestApp,com.NativeiOSTestApp
    • applicationIDtargetApplicationId の両方の値が、正しい順序で指定されていることを確認します。 マッピングは、1 対 1 (つまり n 対 n) の方式で行われます。すなわち、applicationId リスト内の最初のアプリケーションのデータが、targetApplicationId リスト内の最初のアプリケーションにマイグレーションされます。
    • targetApplicationId リストには、アプリケーションの packageName/BundleId を指定します。 つまり、MobileFirst Platform Foundation 7.1 の TestApp1 ならば、targetApplicationId は com.TestApp1 となります (TestApp1 の packageName/BundleId)。 これは、MobileFirst Platform Foundation 7.1 では applicationId はアプリケーション名であるのに対し、MobileFirst Server 8.0 ではこれは、アプリケーションの環境に基づいた packageName/BundleId/packageIdentityName であるためです。
  3. 以下のコマンドを使用してツールを実行します。

    java -jar mfp-push-data-migration.jar path-to-migration.properties
    
    • ツールの .jar ファイルとこのプロパティー・ファイルが別々の場所に配置されている場合は、path-to-migration.propertiesmigration.properties のパスで置き換えます。 そうでない場合は、コマンドからパスを削除します。

    *必要なライブラリーが含まれた lib フォルダーは、ツールの .jar ファイルと同じ場所に配置してください。

Inclusive terminology note: The Mobile First Platform team is making changes to support the IBM® initiative to replace racially biased and other discriminatory language in our code and content with more inclusive language. While IBM values the use of inclusive language, terms that are outside of IBM's direct influence are sometimes required for the sake of maintaining user understanding. As other industry leaders join IBM in embracing the use of inclusive language, IBM will continue to update the documentation to reflect those changes.
Last modified on May 13, 2020