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

Feature Request: Show full Glucose Reading in Notification bar #222

Closed
micro17 opened this issue Nov 30, 2017 · 55 comments
Closed

Feature Request: Show full Glucose Reading in Notification bar #222

micro17 opened this issue Nov 30, 2017 · 55 comments
Assignees

Comments

@micro17
Copy link

micro17 commented Nov 30, 2017

Hi,

first I want to thank all contributors for this great app! Makes my life with Type 1 a lot easier.

Hope its OK to request a feature this way.

I have an application named AccuBattery which always shows the battey percentage as an Notification bar Icon. I would love to see this implemented with the current BG Reading.

Thanks Max

screenshot_20171130-122221_li 2

@gitanO0
Copy link

gitanO0 commented Dec 1, 2017

+1

@AdrianLxM
Copy link
Contributor

When I last looked at it, google removed the possibility to add text there (at least for non-system apps) - and also the possibility to add dynamically rendered icons. Too many apps where pushing advertisement there, without the possibility for the user to know what app it was :/
Newer versions of Android might get (have gotten) the possibility to do that again?

What apps then usually did was exchanging the icon. Having a range from 40 to 400, this would mean more than 360 icons for mg/dl alone. Additionally those for mmol/l.

@jamorham
Copy link
Collaborator

jamorham commented Dec 1, 2017

Even if it is possible to dynamically render the icon I believe its going to be limited to a tiny space and getting 3 digits in there is going to pretty difficult and for it to be readable.

@gitanO0
Copy link

gitanO0 commented Dec 1, 2017

What about some sort of middle ground... perhaps three or four icons: red: low, green: in range, yellow: high... or some such thing.

@micro17
Copy link
Author

micro17 commented Dec 2, 2017

Great to see that my suggetion receives attention.Thanks for this!

Im running the Pixel 2 XL with Android Oreo. Im not sure how AccuBattery implements this feature as im not really an expert in that regard...

Perhaps ill photoshop a mockup to see if 3 digits would be feasible. But Im hopeful that it would fit the space as accubattery uses 2 digits + the circle.

The color solution depends on the android version youre running. From my experience Android Oreo converts every notification with colored icons to b/w.

@gitanO0
Copy link

gitanO0 commented Dec 4, 2017

Well... I guess the takeaway here is that "more information is better". Currently the status bar icon of a static xdrip symbol brings very little to no "information" value. There are certainly tons of apps, such as this weather app I use that successfully show dynamic info in that space... such as the current temp (which in "f" can range from -xx to +xxx temps). So, it certainly is possible. The heartache seems to be on the implementation side... all the work to make icons with each BG value. So, the bottom line is... is the value gained by having a dynamic status bar icon greater than the work involved? I'd certainly volunteer my time in the grunt work of creating those BG png files. We'd be looking at what... Maybe an "L" symbol for 40 and lower... then 41 -> 300 or so? Then an "H" for high?

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Dec 6, 2017

Hi there,

my guess is that a dynamic xdrip symbol will also bring that information on an always on display wich ist a feature i'd really like.
To bring the BG-Level on the AOD it would maybe also possible use to the static note, wich you can put on the AOD. If this is a string, wich is somewhere found in the systems settings, it should be possible to dynamize it. Or maybe, similar to gitanO0s request, changing the color of the AOD Clock should be easely done and should work for all AOD generations, i guess.

@TheDonDan
Copy link

+1

@Klaus3d3
Copy link
Contributor

Hi there, i think this should'nt be any problem at all with since Marshmallow seems to accept Text as Icon. I made myself an app with Tasker and autonotification to show the value in the notification bar and on AOD. So it should'nt be any problem to do this directly from XDrip+.
See: https://www.google.de/amp/s/amp.reddit.com/r/tasker/comments/4sarl0/dev_autonotification_updates_full_status_bar_icon/

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Feb 8, 2018

@jamorham
@AdrianLxM

from api 23 + i had luck with this code for a 2 -3 character long String as notification icon.
The Textsize will be dynamicly changed to fit into the icon.

String text ="99";

    public void ClickButton (View view) {
    Paint paint = new Paint();
    Integer width = (int) getResources().getDimension(android.R.dimen.notification_large_icon_width);
    Integer height = (int) getResources().getDimension(android.R.dimen.notification_large_icon_height);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(Color.WHITE);
    paint.setAntiAlias(true);
    paint.setTypeface(Typeface.MONOSPACE);
    paint.setTextAlign(Paint.Align.LEFT);
    paint.setTextSize(16);
    Rect bounds = new Rect();
    paint.getTextBounds(text, 0, text.length(), bounds);
    float textsize = 16 * width / bounds.width();
    paint.setTextSize(textsize);
    Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ALPHA_8);
    Canvas c = new Canvas(bitmap);
    c.drawText(text, 0, height-paint.descent(), paint);
    Notification.Builder mBuilder =
            new Notification.Builder(this)
                    .setSmallIcon(Icon.createWithBitmap(bitmap))
                    .setContentTitle(Integer.toString(width))
                    .setContentText(Float.toString(textsize))
                    .setOngoing(false);

    int mNotificationId = 001;
    NotificationManager mNotifyMgr = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    mNotifyMgr.notify(mNotificationId, mBuilder.build());

}

}

I'm not a coder at all, so integrating this into xdrip+ is way to complex for me.

@jamorham
Copy link
Collaborator

@Klaus3d3 this is very helpful thank you

@gitanO0
Copy link

gitanO0 commented Mar 1, 2018

Wow, just saw this feature request has been updated. Is this going to make it into a future release? I just got a phone with "always on display" which always shows the little xdrip+ "drop" symbol on my always-on screen, which is totally useless. Would be SSSSOOOOO great if instead of that, the icon/symbol was the actual glucose reading and even another step further... the glucose reading and a small up or down arrow (or no arrow if flat) next to it showing the trend. But I know that may be a stretch.

@jamorham jamorham self-assigned this Mar 6, 2018
@jamorham
Copy link
Collaborator

jamorham commented Mar 7, 2018

Can anyone who is interested in this feature please chime in with phone model, and android version and whether it supports always on display? There are complexities with making this work correctly.

@micro17
Copy link
Author

micro17 commented Mar 7, 2018

Pixel 2 XL, Stock Andoid 8.1.0 + always on display here.

@gitanO0
Copy link

gitanO0 commented Mar 7, 2018

Same for me: Pixel 2 XL, Stock Andoid 8.1.0 + always on display here.

@gitanO0
Copy link

gitanO0 commented Mar 7, 2018

As far as I can tell, the "drop" icon showing up on the always on display is the same icon that shows up in the status bar/notification area. I'm guessing it's the same deal so if you get it working for status bar area then always on display should honor that as well.

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 7, 2018

Samsung A3 2017 Android 6.0.1

@jamorham
Copy link
Collaborator

jamorham commented Mar 7, 2018

Okay, please download the March 7th Nightly to test this out!

Go to Settings -> Display Settings and at the very bottom go to Number Icon in Notification Area and tap it.

Now on the next screen First tap the Run Number Icon Test. One of the test phones I tried this on failed and it completely crashes the whole of android. I've added various provisions to work-around this but before enabling it you need to test if it works on your phone.

Some Android black magic was also needed to get this working on Samsung who have decided to do things a bit differently too. Hopefully there will be a good range of compatibility now.

If that works then go back in to the Settings and now enable Number Icon Tested and Show Number Icon and you should see it show up when the next reading comes in.

On the Galaxy A3 on Android 7.x this correctly shows on the always on display.

Please let me know if this works for you or not. If it doesn't work please let me know what happened, eg if the test worked but you never saw anything or if the test crashed. If it doesn't work please also let me know the data source you are using, G4, G5 etc?

https://github.com/NightscoutFoundation/xDrip/wiki/How-to-get-the-Nightlies-on-Automatic-Update

@gitanO0
Copy link

gitanO0 commented Mar 7, 2018

It lives!!!

@micro17
Copy link
Author

micro17 commented Mar 7, 2018

For me the 123 test works fine + beautiful yay!!
but it wont show the real number when activated

have a Pixel 2 XL + 8.1 plus a G5

@gitan Which system are you running?

@gitanO0
Copy link

gitanO0 commented Mar 7, 2018

same as you... verizon.
hmm... did you enable both settings in that settings area? Wait for next reading to show up?

@TheDonDan
Copy link

Using the App on an BQ Aquaris X with Stock 7.1.1.
The 123 test works and the reading is showen in the status bar!
Very nice, thank you!

@micro17
Copy link
Author

micro17 commented Mar 7, 2018

Now its working! Took some time but now its showing my lovely blood level all day and everywhere. (except full screen games) But thats alright. Who wants to look after the level while gaming :D

Thats so great @jamorham! Thank you very much. This will change a lot for me and others with this lovely disease ;)

screenshot_20180307-212029 3625

@jamorham
Copy link
Collaborator

jamorham commented Mar 7, 2018

Ok we should get some more people testing it to confirm and I maybe could do something snazzy in the future like use the top and bottom pixels of the graphic with a line like _ is falling slowly __ is falling fast

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 7, 2018

Works great an my Galaxy A3 2017 with 6.0.1

Thanks for your great work.

Now the icon shows 46...something's wrong, i need to eat.. :-D

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 7, 2018

The number on aod disapear when a second notification comes up due to notification grouping. e. g. a warning.
I stil don't if i like this or not.
At least you see that there is a second notification when the numbers are gone.

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 7, 2018

How is it with values in mmol/l above 10?
Does e. g. “10.9“ fit into the icon?

@micro17
Copy link
Author

micro17 commented Mar 7, 2018

Nexus 5X on 7.1.1 without AOD is working fine too

@WanaGo
Copy link

WanaGo commented Mar 7, 2018

Samsung Galaxy S6 Edge Plus - SM-G928I, Android 7.0
Passed Test
Readings showing correctly in mmol/L - success.
Thank you

Unsure what its like > 10.0, I seldom get that high but I will report back if I do

@swissalpine
Copy link

Test passed, 123 shown.
Show number icon enabled.
But nothing to see.
Xiaomi Remo 4x, LineageOS 14.1

@gitanO0
Copy link

gitanO0 commented Mar 7, 2018

swissalpine, did you wait for the next reading? I think it has to go through a full data refresh before you'll see the number.

@swissalpine
Copy link

Yes. Tried many things, restart and so on, nothing.

@izywizy
Copy link

izywizy commented Mar 7, 2018

Working fine on my Oneplus 5 Android 8.0, although the font could do with increasing a point or two to match the time and other stuff on the notification bar on the 5 inch screen.

... and thanks very much for this fantastic app, using it with Libre/Blucon.

screenshot_20180307-221259

@gitanO0
Copy link

gitanO0 commented Mar 7, 2018

I'll agree with izywizy. Would be great, if possible to bump that font size up a hair. It's much smaller on my device than the other status bar texts.
screenshot_20180307-154850

@gitanO0
Copy link

gitanO0 commented Mar 8, 2018

Ok so I rebooted my device and the number is now reverted to the drop icon. Not sure how to get it back.

@gitanO0
Copy link

gitanO0 commented Mar 8, 2018

After about 15 minutes or so the icon changed back to the bg number. Odd.

@TecMunky
Copy link

TecMunky commented Mar 8, 2018

Pixel 2 XL -- works great
Also, this is a great feature - love it.
I also got a toast message.
Android 8.1.0 - February 2018 Security Patch

@TecMunky
Copy link

TecMunky commented Mar 8, 2018

Jelly Pro
Number Test passed - and showed up in notifications
-But Glucose Number does not appear in notification area.-

Wait - I just looked at it, and it is there - maybe it needed a reading first.

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 8, 2018

@ gitan00 i think ghe text size is variable depending on how many digits your reading has. 99 has bigger font size then 100.

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 8, 2018

@gitanO0 i had the same here. Numbers were gone after restart and reapear after 15 minutes.
So i had a look into the code...it's a Feature. :-):

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
// in case the graphic crashes the system-ui we wont do it immediately after reboot so the
// user has a chance to disable the feature

if (SystemClock.uptimeMillis() > Constants.MINUTE_IN_MS * 15) {
if (NumberGraphic.numberIconEnabled()) {
if ((dg != null) && (!dg.isStale())) {
final Bitmap icon_bitmap = NumberGraphic.getBitmap(dg.unitized);
if (icon_bitmap != null) b.setSmallIcon(Icon.createWithBitmap(icon_bitmap));
}
}
}
}

@jamorham
Copy link
Collaborator

jamorham commented Mar 8, 2018

I might be able to increase the font a tiny bit but it runs the risk of getting truncated. It has to fit in the same size box as for example the NFC or Wifi icons on your screenshots.

@jamorham
Copy link
Collaborator

jamorham commented Mar 8, 2018

@Klaus3d3 thats right otherwise its possible for the user to potentially soft-brick their phone if they enable the feature despite the test failing.

@Klaus3d3
Copy link
Contributor

Klaus3d3 commented Mar 8, 2018

it maybe possible to increase the text size by using a narrower font, but i guess ist already at its limits to show a 4 digit number.
See it as a Motivation to keep your Glucose Level under 100. ;-)

@boysim
Copy link

boysim commented Mar 8, 2018

works great on ZTE axon on lineage 14.1 and blucon as datasource!

@gitanO0
Copy link

gitanO0 commented Mar 8, 2018

Ah, ok. We just need to know that for the first 15 minutes, we'll get the drop symbol for safety reasons. Makes sense.

@old-square-eyes
Copy link

old-square-eyes commented Mar 9, 2018

Working well on S8, stock Nougat. Thanks for implementing this. Have wanted it for a long time! Will allow for BG value while navigating.

As for font size, a taller font might be more legible. At least for mmol/L which has a thinner set of characters.

Great work. Very useful.

@gregtcm
Copy link

gregtcm commented Mar 10, 2018

Wow! Thank you @jamorham. Just tested on a Galaxy S7 with an SW3 collecting from a Dexcom G5 and it is working well

Initial reaction ... I think an option to show the background color of in-range, high, or low would be extremely helpful, too. Would this be hard to add?

Thanks again for this great feature.

@TecMunky
Copy link

Maybe it would be better to use a tall narrow font, so numbers over 99 don't look so small

@cybernissart
Copy link

Reached the roof for testing purpose :)
Police used is probably too thin for letter display.
screenshot_20180313-090710

@Klaus3d3
Copy link
Contributor

For High and Low cases i would reduce the Text to HI and LO and maybe ER in case of missed readings, to keep the text readable.

@pmcdougal
Copy link

Not working on my S8 Oreo sadly. Test worked and showed the number but the actual results don't show. Tried restarting and reenabling.

Would any system settings/font settings prevent it from working?

@pmcdougal
Copy link

Ah well it's all fixed! The force English font setting was preventing it from working. As soon as I disabled that the numerical data showed.

@themotoden
Copy link

Xiaomi Redmi 3S NOT working...( Test is not passed.
Android 6.0.1 MIUI Global 9.2.2.0 (MALMIEK)

@Navid200
Copy link
Collaborator

Navid200 commented Feb 6, 2021

@micro17 Unless this still has not been addressed, would you please close the issue? Thanks

@Navid200
Copy link
Collaborator

Closing due to inactivity

jamorham added a commit that referenced this issue May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests