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)
Related
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.
I want to show notification with big picture(BigPictureStyle) and big text(BigTextStyle). How can I do it?
Setstyle only allows either BigPictureStyle or BigTextStyle. If you need a non-standard notification style, you may have to use a custom notification layout.
See Change Notification Layout and How to make an image fit a custom 256dp Big Picture Notification in Android? on using a custom notification layout. For multi-line long text use android:inputType="textMultiLine" for the TextView. The latter answer contains an example of custom big picture.
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.
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.
i want to create message box which must be seen on current screen(Ex i am playing song or creating message on that screen also that message must got pop-up/seen)like notification..
so.please help me to achieve this.....
Thanks in Advance--
You can use a Toast to accomplish what you wish, it will be visible over the activity/screen and can be styled with a custom layout.
You may also want to read the Android Developer documentation on Notifying the User for other alternatives & common methods of notification on Android.
I agree that a normal android notification would be better. IF you do want to do this though, take a look at the "Creating a Custom Dialog" section here:
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog