- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我使用服务来显示通知。在一些罕见的设备上(每天 50 000 名中的 3 名用户),我遇到以下崩溃(可以在 Google Play 开发者控制台中看到;仅在 Android 4.x 设备上):
android.app.RemoteServiceException:
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5327)
at java.lang.reflect.Method.invokeNative(Native Method:0)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method:0)
我的通知是用这样的代码发出的(旧式通知,在 Android 6+ 中已弃用,但仍然有效;错误出现在 Android 4.x 上,代码未弃用):
Notification notification = new Notification(icon, "Custom Notification", when);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
RemoteViews contentView = new RemoteViews(getPackageName(), R.layout.custom_notification);
contentView.setImageViewResource(R.id.notifWeatherImageView, WeatherRowTools.getImageForWeatherCode(weatherCodeString));
....some stuff here...
notification.contentView = contentView;
notification.contentIntent = contentIntent;
notification.flags |= Notification.FLAG_AUTO_CANCEL;
notification.defaults = 0;
mNotificationManager.notify(1, notification);
关于如何解决这个问题有什么想法吗?
非常感谢!!!
最佳答案
我在我的构建中看到了类似的问题 - 只有 Kitkat 设备大量抛出这些问题 - Android 操作系统版本:4.4.4、4.4.2、4.2.2、4.0.4
我们通过更改 Notification 使用的 drawable 解决了类似的问题。
.addAction(R.drawable.ic_forward_black_24dp, VIEW_ACTION, pendingIntentView);
我们停止使用 vector 资源并开始使用图像资源。
R.drawable.ic_forward_black_24dp 不再使用 xml 文件( vector 资源),我们现在使用 png 文件(图像资源)。
关于java - android.app.RemoteServiceException : at android. app.ActivityThread$H.handleMessage 发送通知时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44266510/
我正在查看 NServiceBus v3.3.0.0,在我们的 MessageHandler 中它调用外部 WCF 服务。 如果 WCF 服务被同步调用并且该服务抛出异常,NServiceBus 会完
我有一个试图获取用户位置的线程。 当接收到位置时,“handler.sendMessage(msg)”被调用,并返回 true,但 handleMessage 永远不会被调用。 logcat 中没有错
我正在帮助我的 friend 开发一个 Android 应用程序,我不明白为什么我无法获取 Handle 函数,handleMessage() 被调用。我目前正在尝试通过蓝牙进行通信,我有一个处理写入
当我们在主 UI 线程中实例化一个 Handler 对象时(对于这个例子,假设我正在使用匿名内部类)。 Handler h = new Handler () { @override p
我有一个在单独进程中运行的服务。该服务在 onCreate() 方法中生成一个新线程。此线程将消息发送回服务。 如果我手动启动应用程序,一切正常 - 消息由我服务中的 Handler 接收。但在我的测
我正在编写一个程序,我在其中拍照,然后想将照片存储到 SD 卡中,最后尝试调整现有图像的大小(然后用旧图像覆盖)。 我的代码几乎在所有设备上都能正常工作,但只在三星设备上遇到这个问题。 当我捕捉图像时
我试图理解这个版本的 Message.obtain() http://developer.android.com/reference/android/os/Message.html#obtain%28
应该是这样的: Handler handler = new Handler() { @Override public void handleMessage(Message msg)
为什么 handleMessage 在我使用后台线程循环器创建处理程序时在 ui 线程中运行?此循环程序不属于 ui 线程,但 alertdialog 显示正确且没有崩溃,但应给出错误。 如果问题不清
我有一项服务可以从 Internet 接收命令并启动后台线程。该线程从服务传递一个处理程序(服务被绑定(bind)并传递给处理程序)并向处理程序发送消息以拍照。我坚持执行处理程序。 static Ha
我在 Eclipse 中使用向导将 JAX-WS 处理程序添加到我的项目中。它实现了 SOAPHandler。 然后,在 Project Explorer 中的 JAX-WS Web Services
此代码 fragment 在 CircleView 扩展 View 类中 private Handler handler = new Handler() { @Override pub
本文整理了Java中org.springframework.web.socket.WebSocketHandler.handleMessage()方法的一些代码示例,展示了WebSocketHandl
我有一个带有 Android.os.Handler 的 Activity ,用于与 openGL 线程通信。我想从 opengl 线程获取消息并根据消息数据在 Activity 中绘制一些 GUI,所
我正在尝试掌握 Android 中的多线程。我的目标是将数据从主线程发送到工作线程。 我在其 onCreate 中有一个包含以下代码的主要 Activity - protected void onCr
我正在尝试通过客户端访问 SOAP 请求和响应,以便计算每个调用的执行时间。我已经实现了 SOAPHandler要实现这一点,但 handleMessage方法没有被调用(断点没有被命中或没有日志被记
我的 Spring Boot 应用程序中有一个使用 Web 套接字的严重错误。随机发生的情况是,在我的 MyWebSocketHandler 类中,在 afterConnectionClosed 之后
我有一个扩展 android.os.Handler 的类。此处理程序的一个实例被传递给 Messenger 的构造函数。来自 getBinder 的 Messenger 的 IBinder 作为我服务
每隔几天,我都会收到一份应用程序崩溃报告,其中包含以下堆栈跟踪或其小变体(根据不同的 android 版本具有不同的行号) java.lang.NullPointerException at WebV
我使用 traceView,我看到 android.view.ViewRoot.handleMessage 76.4%这是什么意思?以及如何在我的源代码中找到这个错误? 最佳答案 这可能没问题。该值显
我是一名优秀的程序员,十分优秀!