Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom notification maximum height?

I am trying to make a custom notification and it always ends up being pretty small (about the size of most notifications). I can see that Netflix and Youtube display much larger notifications which look custom (they might be big view) when casting to a chromecast device. How are they making them that large?

Thanks.

EDIT: Marked it as answered because of the comment pointing out bigContentView

like image 571
casolorz Avatar asked Jan 09 '14 23:01

casolorz


People also ask

What is the limit of notification?

A basic notification includes a title, some text, an icon, and a link. A title can contain up to 65 characters, a description is generally limited to 240 characters. However, some portions of these texts can be lost due to browser features.

What is Customised notification?

Create custom layout for the content area DecoratedCustomViewStyle to your notification. This API allows you to provide a custom layout for the content area normally occupied by the title and text content, while still using system decorations for the notification icon, timestamp, sub-text, and action buttons.

What is high priority notification in Android?

High priority messages on Android are meant for time sensitive, user visible content, and should result in user-facing notifications. If FCM detects a pattern in which messages do not result in user-facing notifications, your messages may be deprioritized to normal priority.


1 Answers

You seem to already know... You're probably talking about big view style notifications. Google has specific training documentation as well as a technical guide for that. Here's some example code from there:

// Constructs the Builder object.
NotificationCompat.Builder builder =
        new NotificationCompat.Builder(this)
        .setSmallIcon(R.drawable.ic_stat_notification)
        .setContentTitle(getString(R.string.notification))
        .setContentText(getString(R.string.ping))
        .setDefaults(Notification.DEFAULT_ALL) // requires VIBRATE permission
        /*
         * Sets the big view "big text" style and supplies the
         * text (the user's reminder message) that will be displayed
         * in the detail area of the expanded notification.
         * These calls are ignored by the support library for
         * pre-4.1 devices.
         */
        .setStyle(new NotificationCompat.BigTextStyle()
                .bigText(msg))
        .addAction (R.drawable.ic_stat_dismiss,
                getString(R.string.dismiss), piDismiss)
        .addAction (R.drawable.ic_stat_snooze,
                getString(R.string.snooze), piSnooze);

Note the call to setStyle.

like image 87
kabuko Avatar answered Oct 06 '22 19:10

kabuko