如何更改GCM推送通知的样式 [英] How can I change the style of a GCM Push Notification

查看:88
本文介绍了如何更改GCM推送通知的样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我的应用收到的GCM推送通知的样式从标准的单行通知更改为多行通知.

I'd like to change style of the GCM Push Notifications my app is receiving from the standard single line notification to a multi-line notification.

Java世界的解决方案似乎是在创建通知时将通知的样式设置为 BigTextStyle .

The solution from the Java world seems to be to set the style of the notification to BigTextStyle when it gets created.

我找到了一种针对本地通知的解决方案,该解决方案涉及对 Androidapi.JNI.Support.pas System.Android.Notification.pas 的黑客攻击, NotificationBuilder 的样式设置为 BigTextStyle .

I've found a solution for Local Notifications that involves hacking Androidapi.JNI.Support.pas and System.Android.Notification.pas so that NotificationBuilder has it's style set to BigTextStyle.

我没有看到任何类似于GCM推送通知的Notification Builder的内容.我想念什么?

I don't see anything analogous to Notification Builder for GCM Push Notifications. What am I missing?

在这种情况下,该应用是使用带有Delphi 10(西雅图)的F​​iremonkey为Android构建的.

In this case the app is being built for Android using Firemonkey with Delphi 10 (Seattle).

推荐答案

所以答案是,如果要执行此操作,则必须更改与应用程序一起部署的 FMX.jar

So the answer is, if you want to do this you would have to alter the FMX.jar that's being deployed with the app.

您必须更改 com.embarcadero.rtl.notifications.NotificationPublisher 类的 buildNotification 方法.

FMX.jar的源代码未随RAD studio等分发;因此,您的选择是反编译 FMX.jar .

Source code for the FMX.jar is not distributed with RAD studio, etc. ; so your option is to decompile FMX.jar.

答案将为您提供有关如何修改 buildNotification 的立足点.实际上,您将在 return 之前添加以下内容.

This answer will give you a foothold on how to modify buildNotification. Effectively you'll add the following before the return.

mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(myVeryLongGCMMessage));

这篇关于如何更改GCM推送通知的样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆