notification_when_app_is_killed 0.0.2 copy "notification_when_app_is_killed: ^0.0.2" to clipboard
notification_when_app_is_killed: ^0.0.2 copied to clipboard

Push notification with title and description when the app is killed.

Notification When App Is Killed #

Push notification with title and description when the app is killed.

Credit to gdelataillade

iOS Anroid

Getting Started #

iOS #

You will need notification permission so add this to your ios/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)

    target.build_configurations.each do |config|
       config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
        '$(inherited)',
        # dart: PermissionGroup.notification
        'PERMISSION_NOTIFICATIONS=1',
      ]
    end
  end
end

How to use #

setNotificationOnKillService: #

final _notificationWhenAppIsKilledPlugin = NotificationWhenAppIsKilled();

await _notificationWhenAppIsKilledPlugin.setNotificationOnKillService(
  ArgsForKillNotification(
      title: 'The app is killed',
      description:
          'You can see this notification when the app is killed'),
)

cancelNotificationOnKill: #

final _notificationWhenAppIsKilledPlugin = NotificationWhenAppIsKilled();

await _notificationWhenAppIsKilledPlugin
              .cancelNotificationOnKillService()
)

Credit #

Tahnks to gdelataillade, most of this code is his. Checkout his article in Medium: https://medium.com/@gdelataillade/displaying-a-notification-when-your-flutter-app-is-killed-4ef25cc3f193

Notes #

Checking this package and the onKill notification will only work under release and not under dabug

7
likes
0
pub points
67%
popularity

Publisher

unverified uploader

Push notification with title and description when the app is killed.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, permission_handler, plugin_platform_interface

More

Packages that depend on notification_when_app_is_killed