- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
当我通过 Firebase 控制台发送消息并且我的应用程序在后台或终止一切正常时,通知显示,但是当我的应用程序在前台然后我发送消息时,我得到
我用安卓8.0的模拟器
此外,当出现系统 UI 错误时,我的消息会与我发送到那里的所有内容一起记录下来,日志中只有这个错误,没有任何相关内容。
我的代码在这里:
public class MyFirebaseMessagingService extends FirebaseMessagingService {
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Log.d("FirebaseMessage", "FROM: " + remoteMessage.getFrom());
if(remoteMessage.getData().size() > 0) {
Log.d("FirebaseMessage", "Message Data: " + remoteMessage.getData());
}
if(remoteMessage.getNotification() != null) {
Log.d("Firebae Message", "Message body: " +remoteMessage.getNotification().getBody());
sendNotification(remoteMessage.getNotification().getBody());
}
}
private void sendNotification(String body) {
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String CHANNEL_ID = "test_channel";
CharSequence name = "testChannel";
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel mChannel = new NotificationChannel(CHANNEL_ID, name, importance);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this,CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("[TEST] Message")
.setContentText(body)
.setAutoCancel(true)
.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.createNotificationChannel(mChannel);
notificationManager.notify(0, notificationBuilder.build());
}
}
}
编辑:这就是崩溃后出现在日志中的内容:
05-04 17:42:40.889 7028-7102/com.example.wiktor.notesapptesting D/FirebaseMessage: FROM: 632610386607
05-04 17:42:40.896 7028-7102/com.example.wiktor.notesapptesting D/Firebae Message: Message body: test
05-04 17:42:40.919 7028-7055/com.example.wiktor.notesapptesting D/FA: Logging event (FE): notification_receive(_nr), Bundle[{firebase_event_origin(_o)=fcm, firebase_screen_class(_sc)=PlusUsersMainActivity, firebase_screen_id(_si)=4052769648448254679, message_device_time(_ndt)=0, message_time(_nmt)=1525455768, message_id(_nmid)=3256029686705242789}]
05-04 17:42:40.982 7028-7055/com.example.wiktor.notesapptesting V/FA: Connecting to remote service
05-04 17:42:41.021 7028-7055/com.example.wiktor.notesapptesting D/FA: Logging event (FE): notification_foreground(_nf), Bundle[{firebase_event_origin(_o)=fcm, firebase_screen_class(_sc)=PlusUsersMainActivity, firebase_screen_id(_si)=4052769648448254679, message_device_time(_ndt)=0, message_time(_nmt)=1525455768, message_id(_nmid)=3256029686705242789}]
05-04 17:42:41.081 7028-7055/com.example.wiktor.notesapptesting V/FA: Connection attempt already in progress
05-04 17:42:41.081 7028-7055/com.example.wiktor.notesapptesting D/FA: Connected to remote service
05-04 17:42:41.082 7028-7055/com.example.wiktor.notesapptesting V/FA: Processing queued up service tasks: 2
05-04 17:42:43.142 7028-7033/com.example.wiktor.notesapptesting I/zygote: Do partial code cache collection, code=124KB, data=66KB
After code cache collection, code=124KB, data=66KB
Increasing code cache capacity to 512KB
05-04 17:42:46.155 7028-7055/com.example.wiktor.notesapptesting V/FA: Inactivity, disconnecting from the service
最佳答案
好的,我找到了解决方案。
所以,问题出在这行代码 .setSmallIcon(R.mipmap.ic_launcher)
我真的不知道为什么,但是当我把它改成别的东西时,在我的例子中是drawable
icon .setSmallIcon(R.drawable.friend_main_icon)
有效,应用程序不再崩溃。
关于android - Firebase 云消息系统用户界面已停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50180254/
我正在阅读 Youtube 上的 Kubernetes 教程,发现以下 UI 演示了 Kubernetes 集群的 pod 和服务安排。如何在我的 Kubernetes 设置中安装此 UI? 最佳答案
这只是一个快速的(我希望)。 我最近访问了 jquery ui 对话框页面,查看在对话框中使用表单 http://jqueryui.com/dialog/#modal-form我注意到一些我以前没有见
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
我想用 Java 为一个程序创建一个用户界面,让用户能够构建一棵节点树,每个节点执行一项特定的任务。该程序的界面与 Softimage Ice 非常相似,您可以通过单击 http://vimeo.co
下面是我在 SwiftUI 中创建 View 的代码。我要定位我的 欢迎按钮 到屏幕底部,如下所示。 struct welcomeViewControllerView: View { va
我目前有一个文本编辑器,我希望能够像这样在笔记应用程序中添加文本格式: 我试过 UITextView.allowsEditingTextAttributes = true但它似乎没有用。 任何想法将不
我不知道如何使用HDFS连接我的网站(我什至不确定是否有可能)。 我的网站基于PHP。我想存储有人点击我的网站的区域,如何将我的PHP与HDFS连接起来? 是否涉及任何插件?如果我希望这些信息被实时存
我正在寻找用 javascript 编程的新方法。我的目标是创建像 GMail 这样的 javascript 应用程序。我试过 GWT,但它接缝太复杂,而且代码也不时尚。 我发现 MVC 模式是一种很
我有多个渐变作为我的应用程序的主题。当渐变(存储在变量中)是特定的时,我想要一个 bool 值变为真。但是,我不断收到错误消息: "Binary operator '==' cannot be app
我有一个有很多类别的测验应用程序: 类别 1 列出第 1 项 列出第 2 项 类别 3 第 4 类 第 5 类 列出第 1 项 列出第 2 项 列出第 3 项 所以类别要么是指一般的不可选择的类别,即
如果我单击仅搜索“2018”的搜索按钮,但如果我在搜索“2018 歌曲”的电脑上按回车按钮,我想搜索“2018”,如果我在电脑上按回车按钮,我怎么能使用 Autocomplete | jQuery U
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求我们推荐或查找工具、库或最喜欢的场外资源的问题对于 Stack Overflow 来说是偏离主题的,
我正在尝试为患有轻度认知障碍的祖母创建一个安卓平板电脑应用程序。该应用程序的功能之一是智能调度程序/提醒。例如:该应用程序会说“您服用红色药丸了吗?”是或否。如果没有或没有回复,则会向我的手机发送一条
有没有办法确保我的 Android UI 在不同手机上按预期显示? 最佳答案 遍历 developers guide on supporting multiple screens .它为您提供有关该主
我正在为 iPad 和 iPhone 创建一个通用应用程序。我有一个 UITextField,我希望用户在其中输入歌曲的名称或在他们的 iTunes 库中找到的任何声音媒体文件。我的问题不是关于查询图
这个问题在这里已经有了答案: Making a Chess Game with jQuery UI. I have used Draggable, but i need to make them n
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
我想从选择器中获取所选项目以更新 Firebase 数据库中的一些数据,但是当我使用 onTapGesture 时不起作用 注意:选择器中的项目是字符串 我的代码: Picke
我需要我的应用程序在启动时配置后端,这是执行此操作的函数: // Initializes Amplify final func configureAmplify() async { do {
我有这个 Web 应用程序,其中一个模块使用了过多的 ui:include。 前任。 页面 1.0 包括 --> page1.1 包括页面 2.0 包括 --> 页面 2.1 页面 1.0 包括 --
我是一名优秀的程序员,十分优秀!