Another notification update question

Post your questions and help other users.

Moderator: Martin

Post Reply
Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Another notification update question

Post by Lucy » 10 Dec 2019 08:41

Is there a way i can display my widget as icon on notifications?
I have my own signil bar (4 x bars)...

Code: Select all


global_signal_strength_level = signal_strength_level + "%";
//the signal strength in a value from 0 to 4 like the bars on a standard Android device
global_signal_strength_asu = signal_strength_asu;
//the signal strength in ASU (0-31)
global_lte_dbm = lte_dbm;
//the LTE RSRP value in dBm (-1 for unavailable)
global_is_gsm = is_gsm;
//true when GSM
global_gsm_signal_strength = gsm_signal_strength;
//the GSM signal strength (0-31, 99 for unknown, -1 for unavailable)
global_gsm_bit_error_rate = gsm_bit_error_rate;
//the GSM bit error rate (0-7, 99 for unknown, -1 for unavailable)

status = newMapFromValues(
0, "noservice",
1, "poor",
2, "fair",
3, "good",
4, "fullservice");
global_signal_strength_level = status[signal_strength_level];

if (global_signal_strength_level == "noservice"){
setWidgetElementProperty("Signil_strength_bar", "Bar_4", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_3", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_2", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_1", "visible", true);}
else if (global_signal_strength_level == "poor"){
setWidgetElementProperty("Signil_strength_bar", "Bar_4", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_3", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_2", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_1", "visible", true);}
if (global_signal_strength_level == "fair"){
setWidgetElementProperty("Signil_strength_bar", "Bar_4", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_3", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_2", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_1", "visible", true);}
else if (global_signal_strength_level == "good"){
setWidgetElementProperty("Signil_strength_bar", "Bar_4", "visible", false);
setWidgetElementProperty("Signil_strength_bar", "Bar_3", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_2", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_1", "visible", true);}
else if (global_signal_strength_level == "fullservice"){
setWidgetElementProperty("Signil_strength_bar", "Bar_4", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_3", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_2", "visible", true);
setWidgetElementProperty("Signil_strength_bar", "Bar_1", "visible", true);}


I was hoping to use it on a notification!

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

Re: Another notification update question

Post by Desmanto » 10 Dec 2019 18:11

Not yet, we still don't have widget support in the notification. But you can use icon/picture in the Large Icon. Use action Save Widget to Image File, and then use that png file as the Large Icon. You should see the small thumbnail of the widget at the notification.

However the result is quite small and you have to keep saving the widget to image, causing continous write. While all apps keep writing at certain point, I think the solution just not optimal.

The other way is to use java and it is quite advanced and might be scary. viewtopic.php?f=5&t=7944&hilit=notifica ... age#p24150
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.

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Another notification update question

Post by Lucy » 12 Dec 2019 07:36

Ok... i took all you said in consideration however...
I came up with another solution.
I simply replace my profile notification icon periodically depending on my weather vars. So my weather icon on notification is always up to date.
Screenshot_20191212-183342.jpg
Screenshot_20191212-183342.jpg (575.55 KiB) Viewed 10202 times
It works along side my weather flow. And uses minimal resources

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

Re: Another notification update question

Post by Desmanto » 12 Dec 2019 18:04

That can work too. Just one additional thing, it is better to design multiple branch in parallel model, rather series. See this : viewtopic.php?f=5&t=6882
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.

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Another notification update question

Post by Lucy » 12 Dec 2019 21:53

😂 yeah i got many multiple choice flows in that style. And the post is totally correct about execution speed and so were you with using that style on a general basis. I just get lazy sometimes🤦‍♀️ thanks hunny

Lucy
Posts: 225
Joined: 10 Aug 2019 11:24

Re: Another notification update question

Post by Lucy » 12 Dec 2019 22:14

Optimized for maximum efficiency 😊🤙
Screenshot_20191213-091337.jpg
Screenshot_20191213-091337.jpg (465.48 KiB) Viewed 10177 times

Post Reply