Allow disabling the "Synchronizing X account" notification on pre Oreo version
There's this pesky foreground service notification that never goes away. I know it's not possible to remove it (else the service will not run for long and will be killed by Android), and if you mask it, you'll not see the email notification anymore (that's a shame).
I've thought about this and I think I've a solution for this. Typically, I've made some code that allow another application to display a notification that's received from a broadcast intent (the intent contains the complete information to show the notifications). This only requires a small change in SimpleEmail (broadcast an intent when a new mail is available)
With this in mind, the solution becomes:
Without notifier app
- Nothing changes, a permanent, painful notification is shown and pollute the notification list
With notifier app
- The user hides "SimpleEmail" notification (hiding does not prevent the service from running, but prevent any other notification to be shown)
- In SimpleEmail, the user sets a preference to allow for broadcasting new mail information
- Upon new email, SimpleEmail broadcasts the "new email" intent to the notifier app (containing: Title / Desc / Icon / Intent to receive when clicked (called returnIntent) )
- Android wakes the notifier app, and the notifier app display the notification. Since it's a different app, the notification for new mail is not hidden
- When the user clicks the notification, the returnIntent is broadcast
- SimpleEmail receives it and start the mail activity
Would you be ok if I add the changes listed above to SimpleEmail ? BTW, the notifier app will be open source with MIT license, since this behavior is also useful for any other "foreground service" app.