question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

notification clear when app close from home btn in android

See original GitHub issue

notification clear when app close from home btn in android

  • Plugin version: 0.9.0-beta.2
  • Platform: Android
  • OS version: 7.1.1
  • Device manufacturer / model: Motorola - G5 s plus
  • Cordova version (cordova -v): 8.0.0
  • Cordova platform version (cordova platform ls): 6.3.0* Plugin config

Expected Behavior

LocalNotification should be not close when app close by home button in android

Tell us what happens instead

Loacl notification close whn app close

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:11

github_iconTop GitHub Comments

4reactions
lokkeshjayacommented, Feb 27, 2019

This behavior might be seen when you use local notification plugin in combination with phonegap-push plugin. phonegap-plugin-push by default clear all pending notifications when the app go in pause. To fix this behavior, just set the clearNotifications to “false”:

var push = PushNotification.init({ android: { clearNotifications:"false" } });

1reaction
hordesalikcommented, Sep 17, 2018

@rwillett yes, maybe when the app is starting it works so, but notification get removed once app getting to the background mode. That’s the main problem.

BTW, I tested in iOS and it works as expected. When I preseed “home”, application got into background and notification still present in notifications area. Then I locked and unlocked iOS - notification still there. I closed and re-ran application - notification has not been removed. It still visible in notifications area until user manually remove it.

For Android, once application lose focus - all notifications are getting removed.

UPD: Tested with autoClear: false - nothing changed I consulted with Android developer and he confirmed - this is not default behaviour and sent me a link with quotes

A notification is a message that Android displays outside your app’s UI to provide the user with reminders, communication from other people, or other timely information from your app.

A notification remains visible in the notification drawer until dismissed by the app or the user.

link2

Notifications provide short, timely, and relevant information about your app when it’s not in use.

So in current implementation for android 8 notification are quite useless.

Also in example there is a notification on locked screen, but currently if I will lock screen - notification will disappear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control notifications on Android - Google Support
Use notifications · To clear one notification, swipe it left or right. · To clear all notifications, scroll to the bottom of your...
Read more >
How to get rid of a permanent notification on Android
To remove a persistent notification on Android as fast as possible, first, press-and-hold on it. Alternatively, swipe the notification left or ...
Read more >
Cancel notification after application is closed from background
Notification can be canceled if we canceled it in onTaskRemoved() method,do mNotificationManager.cancel(NOTIFICATION_ID) in that ...
Read more >
Tasks and the back stack - Android Developers
The user uses the Home button or gesture, then starts a new app from the app launcher. When the Home screen appears, Task...
Read more >
View and respond to notifications on iPad - Apple Support
Handle a notification you receive while using another app: Pull it down to view it, then swipe up to dismiss it. Clear notifications:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found