For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Scenario 1: Existing applications using single event source in their application
Applications have used single event source over the earlier versions of MobileFirst as it supported push only through event source-based model.
Client
To migrate this in V8.0.0, convert this model to Unicast notification.
- Initialize the MobileFirst push client instance in your application and in the success callback register the callback method that should receive the notification.
MFPPush.initialize(function(successResponse){ MFPPush.registerNotificationsCallback(notificationReceived); }, function(failureResponse){alert("Failed to initialize); } );
- Implement the notification callback method.
var notificationReceived = function(message) { alert(JSON.stringify(message)); };
- Register the mobile device with the push notification service.
MFPPush.registerDevice(function(successResponse) { alert("Successfully registered"); }, function(failureResponse) { alert("Failed to register"); } );
- (Optional) Un-register the mobile device from the push notification service.
MFPPush.unregisterDevice(function(successResponse) { alert("Successfully unregistered"); }, function(failureResponse) { alert("Failed to unregister"); } );
- Remove WL.Client.Push.isPushSupported() (if used) and use.
MFPPush.isPushSupported (function(successResponse) { alert(successResponse); }, function(failureResponse) { alert("Failed to get the push suport status"); } );
- Remove the following WL.Client.Push APIs, since there will be no event source to subscribe to and register notification callbacks.
- registerEventSourceCallback()
- subscribe()
- unsubscribe()
- isSubscribed()
- onReadyToSubscribe()
Server
- Remove the following WL.Server APIs (if used), in your adapter:
- notifyAllDevices()
- notifyDevice()
- notifyDeviceSubscription()
- createEventSource()
Complete the following steps for every application that was using the same event source:
- Set up the credentials by using the MobileFirst Operations Console. See Configure push notification settings.
We can also set up the credentials by using Update GCM settings (PUT) REST API, for Android applications or Update APNs settings (PUT) REST API, for iOS applications.
- Add the scope push.mobileclient in Scope Elements Mapping.
- Create tags to enable push notifications to be sent to subscribers. See Create tags for push notification.
- We can use either of the following methods to send notifications:
- The MobileFirst Operations Console. See Sending push notifications to subscribers.
- The Push Message (POST) REST API with userId/deviceId.
Parent topic: Hybrid applications