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 MFPPush client instance in your application.
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); } }
- Register the mobile device with the push notification service.
MFPPushMessageResponse Response = await push.RegisterDevice(null); if (Response.Success == true) { Debug.WriteLine("Push Notifications Registered successfully"); } else { Debug.WriteLine("Push Notifications Failed to register"); }
- (Optional) Un-register the mobile device from the push notification service.
MFPPushMessageResponse Response = await push.UnregisterDevice(); if (Response.Success == true) { Debug.WriteLine("Push Notifications Failed to unregister"); } else { Debug.WriteLine("Push Notifications Unregistered successfully"); }
- Remove WLClient.Push.IsPushSupported() (if used) and use push.IsPushSupported();.
- Remove the following WLClient.Push APIs since there will be no event source to subscribe to and register notification callbacks:
- registerEventSourceCallback()
- subscribe()
- unsubscribe()
- isSubscribed()
- WLOnReadyToSubscribeListener and WLNotificationListener implementation
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 WNS credentials in the Push Settings page of MobileFirst Operations Console or use WNS Settings REST API.
- Add the scope push.mobileclient in Map Scope Elements to security checks section in the Security tab of MobileFirst Operations Console.
- We can also use the Push Message (POST) REST API with userId/deviceId, to send message.
Parent topic: Native Windows Universal applications