PushNotificationService class
Documents added by Alaa, enjoy ^-^: There are 3 major things to consider when dealing with push notification :
- Creating the notification
- Hanldle notification click
- App status (foreground/background and killed(Terminated))
Creating the notification:
- When the app is killed or in background state, creating the notification is handled through the back-end services. When the app is in the foreground, we have full control of the notification. so in this case we build the notification from scratch.
Handle notification click:
- When the app is killed, there is a function called getInitialMessage which returns the remoteMessage in case we receive a notification otherwise returns null. It can be called at any point of the application (Preferred to be after defining GetMaterialApp so that we can go to any screen without getting any errors)
- When the app is in the background, there is a function called onMessageOpenedApp which is called when user clicks on the notification. It returns the remoteMessage.
- When the app is in the foreground, there is a function flutterLocalNotificationsPlugin, is passes a future function called onSelectNotification which is called when user clicks on the notification.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
androidNotificationChannel(
) → dynamic -
enableIOSNotifications(
) → dynamic -
getUnReadCount(
) → dynamic -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openPage(
String contentId) → void -
registerNotificationListeners(
) → dynamic -
setupInteractedMessage(
) → Future< void> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited