I'm trying to make a notification with MediaStyle without creating a custom notification myself.
so far I got everything to work but since some of my users use Arabic the contentTitle is aligned to the right and I'd like it to be to the left.
How would I do that without making a new custom notification?
Ended up using the RLT Unicode which worked great.
Related
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
Is it possible to build a custom notification that display HTML content ?
I saw that it's possible to build custom notification using RemoteViews, will it be possible to have WebView embedded in a RemoteViews, and pass it as a custom view to the notification ?
No, sadly this is impossible :(
Custom notifications can only contain RemoteViews which only can hold a certain subset of all views like Buttons, TextViews, etc.
Not sure if this is what you are asking for, but you should be able to style your notification with HTML tags, or add link to it. Here is the nice article on how to style notification with HTML: https://itnext.io/android-notification-styling-cc6b0bb86021
In short you should be able to do something like this:
val styleNotificationWithHtml = Html.fromHtml(yourNotification, FROM_HTML_MODE_LEGACY)
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.
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 :)
Is there a way to get the body text of a notification to scroll along the notification?
If this text is too long it just fades out at the border near the time. Is there a way to make it scroll slowly along so that someone could read it while in the notification drop down menu without having to either read it when it ticks along the status bar when it is received, but without going into the app?
I think this would be possible with a custom notification layout that housed XML with scrolling views, but i cannot use a custom layout, the notifications need to be created through the default notification creator.
Anyone know if this is possible?
Edit: im in no way affiliated with Onavo Lite, it was just a image i found to point out the text area i want to manipulate.
No, the default notification layout uses TextViews with a maximum size and no scrolling features.