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.

Requirements

  • 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.

Add Code

Follow this procedure to code support for push notifications if your application does not use the AWApplication class.

  1. Override the registerForPushNotifications() method in the PushNotificationContext class and call GCMManager.registerForPushNotifications(getApplicationContext());.

    A call to registerForPushNotifications() initiates the GCM registration process.

  2. Override getSenderID() and return your application's corresponding sender ID.
  3. To intercept GCM registration and GCM push notification events, use the callbacks in IPushNotificationReceiver.

  4. 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().

  5. 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.