【问题标题】:How to display full message of push notification in appcelerator如何在 appcelerator 中显示推送通知的完整消息
【发布时间】:2016-05-19 04:17:26
【问题描述】:

我的通知开发 (android) 有问题。通知消息未显示完整消息。如何让它可以像手机上的whatsapp通知一样扩展。

谢谢

example my current notification

【问题讨论】:

    标签: android push-notification google-cloud-messaging appcelerator appcelerator-titanium


    【解决方案1】:

    推送通知文本的长度是有限的,您无法绕过它。要显示完整消息,您可以将带有推送消息的全文作为数据发送。但请记住,推送消息数据的总体大小有限制。

    或者,如果您想像 whatsapp 一样进行操作,请将消息存储在您的数据库中,然后让应用程序从那里获取/同步消息。这样就不需要将完整的消息与推送消息一起传输了。

    【讨论】:

      【解决方案2】:

      您可以使用以下代码增加推送通知消息的大小

      String longmsg="";
      
      .setStyle(new Notification.BigTextStyle()
               .bigText(longmsg))
      

      【讨论】:

        【解决方案3】:

        对于本地通知/在应用通知中,Titanium.Android.Notificationstyle 有一个属性“样式”。 如果将 style 属性的值设置为“Titanium.Android.BigTextStyle”,则可以扩展本地通知。 style 属性不适用于来自服务器的通知。

        【讨论】:

          【解决方案4】:

          您将能够在 Titanium 5.4(计划于 7 月)中为此使用 BigTextStyle API:

          https://jira.appcelerator.org/browse/TIMOB-20066

          【讨论】:

          • 这适用于推送通知还是仅适用于本地通知?
          • 据我了解是推送通知。
          • 看来 appcelerator 对为推送通知实现此功能不感兴趣 jira.appcelerator.org/browse/…
          猜你喜欢
          • 2018-01-21
          • 1970-01-01
          • 2017-03-16
          • 1970-01-01
          • 1970-01-01
          • 2016-04-16
          • 2019-01-25
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多