Skip to content

Commit 88559d5

Browse files
committed
Update migration guide with new notification events naming
1 parent bbeb09d commit 88559d5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

MIGRATION_GUIDE.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,12 @@ The notification namespace is accessible via `OneSignal.notifications` (in Kotli
265265
| `fun removeNotification(id: Int)` | `void removeNotification(int id)` | *Cancels a single OneSignal notification based on its Android notification integer ID. Use instead of Android's [android.app.NotificationManager.cancel], otherwise the notification will be restored when your app is restarted.* |
266266
| `fun removeGroupedNotifications(group: String)` | `void removeGroupedNotifications(String group)` | *Cancels a group of OneSignal notifications with the provided group key. Grouping notifications is a OneSignal concept, there is no [android.app.NotificationManager] equivalent.* |
267267
| `fun clearAllNotifications()` | `void clearAllNotifications()` | *Removes all OneSignal notifications from the Notification Shade. If you just use [android.app.NotificationManager.cancelAll], OneSignal notifications will be restored when your app is restarted.* |
268-
| `fun addPermissionChangedHandler(handler: IPermissionChangedHandler)` | `void addPermissionChangedHandler(IPermissionChangedHandler handler)` | *The [IPermissionChangedHandler.onPermissionChanged] method will be fired on the passed-in object when a notification permission setting changes. This happens when the user enables or disables notifications for your app from the system settings outside of your app. Disable detection is supported on Android 4.4+* |
269-
| `fun removePermissionChangedHandler(handler: IPermissionChangedHandler)` | `void removePermissionChangedHandler(IPermissionChangedHandler handler)` | *Remove a push permission handler that has been previously added.* |
270-
| `fun setNotificationWillShowInForegroundHandler(handler: INotificationWillShowInForegroundHandler?)` | `void setNotificationWillShowInForegroundHandler(INotificationWillShowInForegroundHandler handler)` | *Sets the handler to run before displaying a notification while the app is in focus. Use this handler to read notification data or decide if the notification should show or not.*<br><br>***Note:*** *this runs after the Notification Service Extension [IRemoteNotificationReceivedHandler] has been called (if one exists), which has the following differences:*<br><br><br>1. *The [IRemoteNotificationReceivedHandler] is configured within your `AndroidManifest.xml`.*<br>2. *The [IRemoteNotificationReceivedHandler] will be called regardless of the state of your app, while [INotificationWillShowInForegroundHandler] is *only* called when your app is in focus.*<br>3. *The [IRemoteNotificationReceivedHandler] can make changes to the notification, while [INotificationWillShowInForegroundHandler] can only indicate not to show it.* |
271-
| `fun setNotificationClickHandler(handler: INotificationClickHandler?)` | `void setNotificationClickHandler(INotificationClickHandler handler)` | *Sets a handler that will run whenever a notification is clicked on by the user.* |
272-
268+
| `fun addPermissionObserver(observer: IPermissionObserver)` | `void addPermissionObserver(IPermissionObserver observer)` | *The [IPermissionObserver.onNotificationPermissionChange] method will be fired on the passed-in object when a notification permission setting changes. This happens when the user enables or disables notifications for your app from the system settings outside of your app. Disable detection is supported on Android 4.4+* |
269+
| `fun removePermissionObserver(observer: IPermissionObserver)` | `void removePermissionObserver(IPermissionObserver observer)` | *Remove a push permission observer that has been previously added.* |
270+
| `fun addForegroundLifecycleListener(listener: INotificationLifecycleListener)` | `void addForegroundLifecycleListener(INotificationLifecycleListener listener)` | *Adds a listener to run before whenever a notification lifecycle event occurs.* |
271+
| `fun removeForegroundLifecycleListener(listener: INotificationLifecycleListener)` | `void removeForegroundLifecycleListener(INotificationLifecycleListener listener)` | *Removes a notification lifecycle listener that has previously been added.* |
272+
| `fun addClickListener(listener: INotificationClickListener)` | `void addClickListener(INotificationClickListener listener)` | *Adds a listener that will run whenever a notification is clicked on by the user.* |
273+
| `fun removeClickListener(listener: INotificationClickListener)` | `void removeClickListener(INotificationClickListener listener)` | *Removes a click listener that has previously been added.* |
273274

274275
**Location Namespace**
275276
The location namespace is accessible via `OneSignal.location` (in Kotlin) or `OneSignal.getLocation()` (in Java) and provide access to location-scoped functionality.

0 commit comments

Comments
 (0)