Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less intrusive notification #30

Closed
jkaberg opened this issue Dec 4, 2018 · 9 comments
Closed

Less intrusive notification #30

jkaberg opened this issue Dec 4, 2018 · 9 comments
Labels
question Further information is requested
Milestone

Comments

@jkaberg
Copy link

jkaberg commented Dec 4, 2018

IMO the current notification is way to intrusive for its purpose (to keep the app "online"), I know other apps make use of another type of smaller ("system"?) notification which is only shown when you pull down the notification drawer (and otherwise is hidden on lock screen etc.)

Would it be feasible to migrate to this?

@jkaberg
Copy link
Author

jkaberg commented Dec 4, 2018

I think this is it? https://developer.android.com/guide/components/services#Foreground

The maps notification in this image;

@jmattheis
Copy link
Member

jmattheis commented Dec 4, 2018

AFAIK, it isn't possible to configure this in app code. When IMPORTANCE_MIN is used, Android changes it to a notification with a higher importance:

Min notification importance: only shows in the shade, below the fold. This should not be used with Service.startForeground since a foreground service is supposed to be something the user cares about so it does not make semantic sense to mark its notification as minimum importance. If you do this as of Android version O, the system will show a higher-priority notification about your app running in the background.

https://developer.android.com/reference/android/app/NotificationManager.html#IMPORTANCE_MIN

You can however configure it manually.

  • Settings -> Apps -> Gotify
  • Click Notifications
  • Click on Gotify foreground notification
  • Select different "Behavior" or "Importance" (depends on your android version) which uses a minimized notification
  • Restart Gotify

@jmattheis jmattheis added the question Further information is requested label Dec 4, 2018
@jkaberg
Copy link
Author

jkaberg commented Dec 4, 2018

@jmattheis you sure? I use Tasker daily and the notification is minimized like you now showed me how to do by default 😄

If possible (and it seem's so), in my opinion "minimized"/low priority should be default. Otherwise when I lift up my phone I always think there's a new push message when it's only the Gotify service notification

I got stock Samsung S8 and for me it was changing importance to low

@jmattheis
Copy link
Member

I agree, that the status-notification should be minimized, if you know a way how to do it feel free to write it here (:.

I'm pretty sure because it is written in the official android docs.
I did the following change and the foreground notification still wasn't minimized (I'm using android pie). (this was expected, see #30 (comment))

diff --git a/app/src/main/java/com/github/gotify/NotificationSupport.java b/app/src/main/java/com/github/gotify/NotificationSupport.java
index fdd34df..a792d42 100644
--- a/app/src/main/java/com/github/gotify/NotificationSupport.java
+++ b/app/src/main/java/com/github/gotify/NotificationSupport.java
@@ -30,17 +30,17 @@ public class NotificationSupport {
             NotificationChannel foreground =
                     new NotificationChannel(
                             Channel.FOREGROUND,
                             "Gotify foreground notification",
-                            NotificationManager.IMPORTANCE_LOW);
+                            NotificationManager.IMPORTANCE_MIN);                                                                                                               

Messages with priority < 1 are minimized and use this channel:

NotificationChannel messagesImportanceMin =
new NotificationChannel(
Channel.MESSAGES_IMPORTANCE_MIN,
"Min priority messages (<1)",
NotificationManager.IMPORTANCE_MIN);

Are you sure that Tasker is using a foreground service?

@schwma
Copy link
Contributor

schwma commented Dec 12, 2018

I also have a stock Samsung Galaxy S8 running Oreo (8.0.0) and changing IMPORTANCE_LOW to IMPORTANCE_MIN actually did make the foreground notification less intrusive. But only after completely reinstalling Gotify. I had the same problem when making my other notification changes since Android saves the notification settings across updates. Did you try uninstalling Gotify before testing your changes @jmattheis ?

@jmattheis
Copy link
Member

@schwma Jup, I did, tho I have Android Pie (9.0.0) so maybe it does work for android 8.

@jkaberg
Copy link
Author

jkaberg commented Dec 13, 2018

@jmattheis So obviously I'm no android dev, but I'm asking myself; how does Whatsapp, Signal etc do this? They don't even have an notification?

@ialokim
Copy link
Contributor

ialokim commented Dec 16, 2018

Please see #33 for an attempt to restrict the notification on older devices.

So obviously I'm no android dev, but I'm asking myself; how does Whatsapp, Signal etc do this? They don't even have an notification?

@jkaberg They are using Firebase Cloud Messaging and because this is integrated in the so-called and always preinstalled "Google Play Services" and Android is developed by Google, they do allow their own foreground service to be run without notification.

Messenger (and many other apps btw) then only have to send a request to the Google servers, and they will wake up the user's phone to display the notification.

@jmattheis jmattheis added this to the 2.0.4 milestone Dec 22, 2018
@jmattheis
Copy link
Member

I'm closing this for now. AFAIK it is not possible to make the foreground notification less intrusive as it is now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Development

No branches or pull requests

4 participants