Modify Notification Channel

Post your questions and help other users.

Moderator: Martin

Post Reply
vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Modify Notification Channel

Post by vertigo » 07 Apr 2019 17:47

I've been using AM for a while now and love it, and was waiting the past few months for this feature so I could hopefully replace AutoNotification (AN) and have fewer apps on my phone, but now that I'm finally getting around to trying it out, I'm a bit confused.

First of all, I want to say it seems like it should be under the "Notification" tag (could be there and system; that's the beauty of tags vs folders), since that just makes much more sense. Also, I was expecting maybe a separate section for configuring it, accessible via the slide-out menu, which seems like it would be quicker and easier than making a separate flow for each one, but until I play around with it more I can't say if that would be better or not. But I wanted to mention it just in case others, including Martin, agree.

Here are my main questions regarding the use of this feature:

1) What's the deal exactly with the companion device? Why is it needed, and does that mean notifications will only be managed if it's available, e.g. only at home if I use my home router? AN has no such requirement.
2) I'm concerned about the statement that it's not officially supported and might not work on all devices, as well as something I read here on the forums about the likely possibility of future Android updates removing the ability for it to function. As far as I'm aware, AN has no such warnings, which makes me wonder if it uses a different method or if it just doesn't warn users despite having the same potential issues. Can someone provide some clarification on this? I'd hate to get everything set up only to have it break in the not too distant future (I realize that's always a risk, but it seems to be a bigger one with AM).

It's very possible I'll have more questions once I start playing around with this more, but those are the ones I'm mainly concerned about. I'm just wondering if I'd be better off continuing to use AN, but I already have AM paid for and installed, so if I can avoid buying another app and having it installed and taking up space, I'd prefer that.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Modify Notification Channel

Post by Martin » 10 Apr 2019 20:03

Hi,

You are right, the action should be available under tag Notification too. I'll change it in the next update.

1) I have no idea why Android requires that an app has an associated companion app. It's just a requirement from Android, otherwise the system does not allow an app to modify notification channels. AN also requires that a companion device is registered.
2) The official documentation mentions that apps should not be able to modify notification channels so Google might remove this capability in the future when they see that many apps start to use this companion device workaround. This is just a gut feeling of me so other developers might be more confident that the feature remains available in the future. Honestly Google lately removes so many features from Android that I should probably show this warning in every action ;) . It's always possible that other apps find other mechanisms to achieve the same functionality but in this case I'm fairly confident that AN uses the same mechanism.

Regards,
Martin

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Modify Notification Channel

Post by vertigo » 14 Apr 2019 19:27

Interesting. I don't remember setting a campanion device for AN, but sure enough, I uninstalled and reinstalled it to check, and it asked me to do so. I set my Wi-Fi as the companion for AM then, after setting it up, turned off Wi-Fi and rebooted the phone, and everything was still as configured, so that alleviates that concern (of having it only work while at home).

It's definitely nice to have my status bar clean and organized again, and I'm glad AM added this, though I have to say setting it up was much more involved and time-consuming than it was in AN. One thing I did to make it easier, though I'm not sure if it's ideal (and please tell me if I should change it to prevent issues), is that I did it all in one flow with several different triggers, and just put all the notification modifications in a straight line from the trigger box. This means it will try to modify/remove notifications that might not even be there, or that are already where they belong, but so far it doesn't seem to cause any issues. A couple suggestions to maybe make things a bit easier: make it so multiple notifications can be added at once to a trigger, instead of having to keep going through all the steps to add each one, and allow multiple notification channel IDs to be configured in one action, instead of having to do a separate action for each one (though at least this is easy with copy/paste, though that would be easier if an object could be pasted more than once without having to paste, press back, long-press, paste, go back, and so forth). Another thing that made it take a bit longer was the loading time of the app list, something I mentioned to you before and I think you were going to try and improve (I say this not to rush you, but just to mention it's still an issue in case you did make changes). It would take several seconds to load every time, even if I had just loaded it a few seconds before when setting up a trigger (I'd set a trigger for a notification from an app then set one or more actions for modification of that app's notifications). At least now that everything is set up it's not something I'll have to mess with much more, just the occasional tweak to add a new notification to the list.

One thing I'd really like to see changed is to have more levels, but I suspect this is an Android limitation that AM can't do anything about. I don't even know what the difference is between maximum and urgent, but both are useless for ongoing notifications, since they cause a constant toast pop-up, leaving only high and medium for notifications to be sorted while still appearing on the collapsed status bar. I wish there were at least three different priorities for that, or better yet infinite with numerical assignments. I've also noticed that every now and then a couple notifications will toggle back and forth, despite being at different priorities, but it doesn't happen often and it's certainly much better than before.

The only real problem I've noticed is that it seems unable to remove Android system notifications. I had AN set to remove the "Tap to disable USB debugging" notification, but no matter what I've tried (various filter selections and text, including no text, all "android" notifications, i.e. no filters, and the filters with no package selected, i.e. all apps), it doesn't clear that notification or the one for how to handle the USB connection (i.e. charging, file transfer, etc)--not that I want that one removed, but I thought maybe it would be when removing filters.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: Modify Notification Channel

Post by Martin » 15 Apr 2019 15:33

Levels (importance?) is defined by Android. There's no way for an app to add more levels to a channel. Optimizing the app list in on the todo list. Unfortunately I have other items on the list that are more important for now.
I could try to make Modify Notification Channel work for multiple channels of an app at once.

Ongoing notifications that can't be removed by swiping manually on the notification can not be removed by Automagic either. You could try to see if action Snooze Notification on Statusbar works to "remove" the notification for a week or two.

Regards,
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Modify Notification Channel

Post by Desmanto » 16 Apr 2019 02:58

@vertigo : I have actually tried to post the answer yesterday, but can't, because of the server migration. Fortunately I always keep copy of my post before posting it. The new look is a bit weird now, but I will get used to it soon :)

I give numbering to identify each topic.
1. Straight line element
Do you mean
Multiple triggers from multiple notification
Modify/Remove notif A
Modify/Remove notif B
Modify/Remove notif C
...
Modify/Remove notif J

If that so, it is not efficient, as each action will create additional logging in the system, although the notification doesn't exists and it doesn't do anything. Better check the notification first using condition notification on statusbar.

But that again is not efficient from the point of view of consecutive check. Better use : multiple parallel expression to split the triggers and branch accordingly. Look at my thread : viewtopic.php?f=5&t=6882
If you look on some of my flow sharing in my index, I always use this parallel expression to split multiple triggers. In your case, the expression will be something like :

Code: Select all

trigger == "Notification on Statusbar Displayed: android Content Title matches regex .* using battery"
Match the name of the trigger to the one you use. The one in this code is my trigger to check for android system notification for "xxx is using battery".

2. Adding multiple trigger
For adding multiple similar triggers, I also thinking about creating a flowception to do that. But I don't use it often, so I digress. Maybe Martin can think about some way to duplicate the trigger but with different naming.

3. Copying elements
For copying one element to multiple (example 10), I just copy one, then select the original one again (so now 2 selected), copy, pasted become 4. Select 1, 2 again, copy again, paste now become 8 and so on. Still not efficient, but at least save you some taps for element copies more than 10.

4. Loading apps
Yeah, it is quite long to load up the list of apps. That's why I regularly uninstall useless/non-used apps. As more apps means longer loading. I wish Automagic can cached the list of the app. And only when we can't find the app or the app has been uninstalled, we can tap additional button "refresh", which will invoke the list of apps again from package manager (longer loading).

6. Android System Notification
For ongoing system notification, you can't remove that (as have answered by Martin). You can only snooze it, this is default behaviour since Oreo 8.1. The trigger must be Notification on Statusbar Displayed, and paired with action Snooze Notification on Statusbar, put duration 99999d (essentially sometime in the far future). This will hide the notification, making it behave just like removing it. I use the same trigger+action to remove "Automagic is using battery" notification.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

vertigo
Posts: 147
Joined: 28 Oct 2018 00:28

Re: Modify Notification Channel

Post by vertigo » 16 Apr 2019 03:50

Hi again Desmanto :) Thanks for your reply. I am in fact doing it in series, where I have several "notification on statusbar displayed" triggers that, no matter which one activates the flow, causes it to go through and set all possible notifications to the desired priority or removing them. Your example in that thread is essentially like using a case statement instead of multiple nested if/then statements, which is generally more efficient, not to mention cleaner. I didn't really think it would make a difference, or at least not much of one, for something like this, and in this case a serial approach is cleaner, but I may have to rethink it. I say this both due to your testing in that thread and because I had an issue earlier with the flow. My phone was being extremely laggy, and after a while of this I got a notification from AM that it had emergency stopped the flow. Checking the log, it was running very frequently. I'm not sure what the problem is, so I'll post the flow and log here for you and Martin to take a look.

With regard to loading the app list, I suggested a similar approach to Martin a while back, where AM would refresh and cache the list in the background upon launch so it would be ready if needed, and it would only be refreshed manually if, like you said, the desired app isn't there. I have no doubt he'll figure out a good solution, whether something like this or something else, when he has time to work on it. But I also understand there's only so much he can do and other things are more important, and so it may be a while. It's certainly not a critical issue, but rather a low to medium priority, so it'll happen when it happens. :)

As for removing the system notification, I hadn't gotten around to it yet, and I was worried it wouldn't work that well since manually snoozing a notification maxes out at 2h, but I just tested it with it set for 10d and the notification went away, and I can only assume it would stay gone for 10d if I left the phone plugged into the computer that long, so I'm definitely happy about that. I am wondering, though, why the snooze notification action can't be configured as to which notification, like the modify or remove notification actions can. Because of this, each one requires its own flow.

Also, you don't need to use AM to remove the apps using battery notification. That can be disabled in settings > notifications (Android app).
Attachments
log_mail.txt
(49.3 KiB) Downloaded 687 times
flow_Notification_Modifications_20190415_234646.xml
(21.04 KiB) Downloaded 793 times

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Modify Notification Channel

Post by Desmanto » 20 Apr 2019 05:08

Instead of creating notification one by one, why don't just select multiple apps in single trigger only.

Notification on Statusbar Displayed: com.abcOrganizer,com.apalon.weatherlive, com.digibites.accubattery,com.google.android.keep,com.gsamlabs.bbm.pro,com.handmark.expressweather,com.mobeedom.android.jinaFS,com.urbandroid.lux
This leave the flow only contain 2 triggers. (the other one is the USB debugging).

Then after that, you can split the notification based on the app name or package name (better, as it is unique identifier), using expression

Code: Select all

package_name == com.abcOrganizer
After this expression, put the action modify notif channel for com.abcOrganizer only. Put all other app and expression in parallel, as you have seen in my other thread.

The last expression is to check the USB debugging one

Code: Select all

notification_text == "Tap to disable USB debugging"
Please change the variable or the text to suit what found in your phone (it may have different label or variable)

So now, your flow will spread horizontally, each action is protected by expression. If you need new app to modify the notif channel, simply add the app in the notification on Statusbar Displayed. Add new expression branch and add the action modify notif channel for that app.


For emergency stop (AES), Automagic limits it to default 60 execution per minute. Your flow now has 19 actions. So every execution (triggered by any of these notification) will execute 19 elements. 4 times execution will already hit this limit. You need to increase this if you hit the limit frequently.

The advantage of the parallel expression method is you protect all action being executed. Using parallel expression method, each execution will still execute all expressions. In this case you have 9 expression. Expression run much faster than executing each modify/remove notif. Then additional 1-2 actions after the expression (depends which branch it goes thru). So each execution only have 10-11 elements execution, it will only hit the AES after 6 executions. You can still increase it, but you don't need as high as the serial method.


For app loading, yes, just wait and see. Not a big deal actually.

Snooze notification probably was a quick hack that Martin added at the time it was introduced in Oreo 8.1. If you follow the issue at the time, it was added just several days after it was announced. So maybe Martin hasn't updated it yet to support snoozing certain notification. Maybe it will updated later.

I still prefer to snooze the notification (specificly for Automagic and GMD Gesture only) instead of disabling the whole notification from android system. Because if I disabled it, if there is other app gone rogue, I can't know it anymore. Using snooze, I only whitelist 2 apps, not all.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply