To use push notifications in your application and Workspace ONE UEM, code the support of push notifications in the AWFramework module in the application class.
Use the PushNotificationContext Interface
The AWFramework module provides an abstract AWApplication class that runs the PushNotificationContext with default behaviors. Your application can override some of the methods to intercept callbacks for additional actions or if it does not use the AWApplication class.
- Code the sender ID from GCM into the application class for push notifications to work.
- Add the API server key from GCM to the Workspace ONE UEM console when the admin uploads the application.
Follow this procedure to code support for push notifications if your application does not use the AWApplication class.
Override the registerForPushNotifications() method in the PushNotificationContext class and call
A call to registerForPushNotifications() initiates the GCM registration process.
- Override getSenderID() and return your application's corresponding sender ID.
To intercept GCM registration and GCM push notification events, use the callbacks in IPushNotificationReceiver.
If your application sends other push notifications besides those for Workspace ONE UEM, override AWPushNotificationReceiver implementation and call super.
For details about specific Workspace ONE UEM actions, review AWPushNotificationReceiver. Actions include uploading the registration token and checking for secure messages in the console.
If the application class overrides AWApplication and does not use push notifications for anything else, do not override getPushNotificationReceiver().
To code that the application received a notification and to not use AWApplication's default behavior, override onSecureMessageReceived(String message) with the desired behavior.
The default behavior is to display a notification in the notification bar with a Workspace ONE UEM icon.