Corona sdk display multi line notification
Asked Answered
M

1

8

I have some notifications in Corona. The problem is, the text is too big, and I would need to show bigger (multi line) notifications, like the Gmail app, for example. Here is what the notifications look like now: enter image description here

Here is my code:

local notificationOptions =
{
  alert = text,
  badge = 2,
  sound = "alarm.caf",
  custom = { foo = "bar" }
}

 local notification = notifications.scheduleNotification( nextScheduleTime +  ( day + math.floor(day/7)) * 24 * 60 * 60, notificationOptions )

Any idea how to do this?

Maquis answered 10/9, 2016 at 23:3 Comment(3)
have you tried adding a newline character \n and see what happens?Proprietary
yes, nothing happens, unfortunately.Maquis
try using \n in your text that possibly creates a new lineChopping
A
-1

The notifications by default are not provide multilines.

To use several lines, you have to NotificationCompat.BigTextStyle() in Java (sample) or use your custom or native custom View (example).

Unfortunately, I've not found how you can touch the default view in order to override

Manual: https://docs.coronalabs.com/daily/guide/events/appNotification/index.html#TOC

and here: https://docs.coronalabs.com/daily/plugin/notifications/scheduleNotification.html

in the second link you can see that only this properties are used:

alert (optional) String. The notification message to be displayed to the user. If the application is not currently running, a system alert will display this message. badge (optional) Number. The badge number to be displayed on the application icon when the scheduled notification triggers. This replaces the last badge number that was applied. Set to 0 to omit the badge number. This option is not supported on Android. sound (optional) String. Name of the sound file in the system.ResourceDirectory to be played when the scheduled notification triggers. This sound is only played if the app is not currently in the foreground. On iOS, there are limitations on the kinds of sound that can be played (consult Apple's documentation for more details). custom (optional) Table. A table that will be delivered with the notification event. This allows you to pass custom information with the notification.

In conclusion, there is no proper way to do it nowadays.

Angelenaangeleno answered 16/9, 2016 at 13:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.