Read full text of Android Notifications? - android

I'm looking for a way to read the full text of a notification, because notifications with large amount of text are getting cropped:
Is it possible to force notification bar to expand to fit the text?
Of maybe there is a way to access the log of them somewhere?
I've seen people asking how to display notification with longer texts without any luck:
Android multiline notifications / notifications with longer text
Isn't there really no way to even read them without getting to the app that triggered them?

Hey i have been searching around too and found forums with people saying you have to use the trackball or arrows to highlight it and longpressing doesnt work. But after a while i got fed up and was about to give up and decided to try a long press one more time and it works!!! Lol you have to longpress and hold for a good 5 seconds

Try this,
Notification notification = new Notification.Builder(currentContext)
.setSmallIcon(R.drawable.ic_launcher)
.setStyle(
new Notification.BigTextStyle()
.bigText(
"Your lengthy text here")
.setBigContentTitle("Your title!!!")
.setSummaryText("Wonderful summary here"))
.setAutoCancel(true).setContentIntent(pendingIntent).build();
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_LIGHTS;
notificationManager.notify(NOTIFICATION_ID, notification);
Above code that I've used, shows entire text without truncating.
I've used it in apps with minimum sdk 4.4.2 and works fine.

I haven't done it, but I believe if you specify a RemoveViews when creating your notification, you can specify the view to use when displaying the notification. You may be able to use that to make one that expands beyond the current default size.
See
http://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification

It seems there is a limit for height of custom notification views. This answer says the limit is 65 sp. Worst part is the offical documentation did not mentioned it anywhere.

https://stackoverflow.com/a/29364414/1025379
sbn.getNotification().extras.getCharSequence(Notification.EXTRA_TEXT).toString();

Related

How to create a custom big android notification that will not decrease after showing?

I try to show notification on new versions like so
Notification example
I tried to set these styles and priority, but the notification is first shown in full, then it decreases by about 2 increments. How to make sure that it does not decrease?
BigTextStyle, BigPictureStyle, MediaStyle, PRIORITY_MAX

Android notification: always expanded + rectangular

This weather app has an interesting notification type:
It's always expanded. Always.
There's no decoration/borders
It doesn't have rounded edges
Despite a lot of trying I failed to find out how to create such a notification. Does anybody know how it's called or could link to the relevant documentation or sample?
Here are 2 SO posts that may help you:
Is possible set Expanded Notification as default in Big Text Notifications?
Custom notification layout gives unnecessary margin
To set a notification as expanded in defualt you can do this
.setStyle(new NotificationCompat.BigTextStyle().bigText(th_alert))
to the notification
and for the next 2 queries you can implement a custom notification and then remove all the styles and add your own

Why notification badge in Android O does not show when setGroupSummary is set?

I was wondering and checked most of the questions here, and did some research on why this is happening, because how I set my badge is based on Android Developer Site
I encountered that my badge does not show when I have set the
builder.setGroupSummary(true); I also did a lot of debugging checking if I have done anything wrong within my code but whenever I remove this line of code, the badge shows up again.
First, create a separate group notification and set the group summary flag true and it becomes the parent notification that bundles other notifications with the same group key within itself. Like this:
setgroup() in notification not working

How to display Android push notification with no title/time on 3 lines

I have seen some apps for which push notifications only display the app icon on the left and the message content on the right, with no title nor time. Also the message content takes the entire space and can occupy up to 3 lines.
.
When I don't supply any title nor text, my message still appears below where the title and time should be. It can only occupy one line and ends up showing only the beginning, with some ellipsis at the end.
I already looked at BigView and BigTextStyle, but it doesn't look like it's what I want, as even if I don't supply a title nor time, the notification message doesn't move up. Also I don't want the user to have to expand the notification to see the whole text.
Is there any simple way to achieve what I want? Or do I have to create a custom layout? I'm using Phonegap and have very limited Android knowledge.
Here is the code I'm currently using: https://github.com/phonegap-build/PushPlugin/blob/master/src/android/com/plugin/gcm/GCMIntentService.java (see the createNotification method).
I wasn't able to find any easy way to do that, like tweaking existing objects. I guess it always requires creating a CustomNotification, which I did: I created a RemoteViews to display things exactly the way I wanted.

how to show a number upon an icon on android statusbar

I want to show an icon on status bar when receive some messages.
The icon represent the number of unread message, so I want to draw some text, such as 2 on the icon.
I tried two solutions but both failed.
set number field (in notification class) as 2 , it seemed this is not supported after android 3.0
set remoteviews on statusbar, using framelayout in remoteViews, but failed.
statusbar only show icon, do not show overlayed text.
How can I implement this feature on android 4.1.2?
thanks in advance.
Use RemoteView in notification. Refer this Link
You should go for BadgeView. It gives you notifications that resemble facebook like numbers
You can't do it generally (as you discovered, support for badging the small icon with a number was dropped in Honeycomb since in most cases it made the underlying icon hard to see and understand).
If you feel you must do this, I'd suggest generating 10 or so images with the number embedded into the graphic. For the last one you'd do something like "*" or "9+" to indicate that there are too many updates to be enumerated in such a tight space :)

Categories

Resources