android - Corona SDK 显示多行通知

标签 android lua push-notification notifications coronasdk

我在 Corona 中收到了一些通知。问题是,文本太大,我需要显示更大(多行)的通知,例如 Gmail 应用程序。这是通知现在的样子: enter image description here

这是我的代码:

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 )

知道怎么做吗?

最佳答案

通知默认不提供多行。

要使用多行,您必须在 Java 中使用 NotificationCompat.BigTextStyle() (sample) 或使用自定义或 native 自定义 View (example)。

不幸的是,我没有找到如何触摸默认 View 以覆盖

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

这里: https://docs.coronalabs.com/daily/plugin/notifications/scheduleNotification.html

在第二个链接中,您可以看到仅使用了以下属性:

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.

总而言之,目前还没有合适的方法。

关于android - Corona SDK 显示多行通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39431350/

相关文章:

parsing - Lua中如何解析一系列中间有空格的字符串

bash - 尝试通过 redis 开放端口攻击主机

react-native - RN OneSignal _open 事件

android - 在 back4app 中重复推送通知

android - 使用向上按钮时,不会调用 onRestoreInstanceState

java - 应用程序只是强制关闭并停止工作,为什么?

android - 当我们从另一个 Activity 返回时如何刷新 Activity 的数据?

Android 选择器改变颜色但不改变大小

redis - 尝试调用 'replicate_commands'字段(一个nil值)

node.js - mocha 中的全局泄漏错误