Fatal Exception: android.app.RemoteServiceException: can't deliver broadcast at android.os.Handler.dispatchMessage

佐手、 提交于 2019-11-28 00:43:01

I was facing the same issue with my app, what I do is use LocalBroadcastManager instead of context. Android documents also suggest using LocalBroadcastManager for sending in-app broadcast receivers.

//register your receiver like this
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver,
          new IntentFilter("custom-event-name"));

// unregister  like this
LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);

// broadcastlike this
LocalBroadcastManager.getInstance(this).sendBroadcast(intent);

Hope this will help. Thanks! :)

I experienced the exact same thing, around the exact same time, with the same devices. The problem was ultimately related to the app I'm supporting, but I think Samsung pushed out some type of update that started triggering the problem. Before the latter part of Oct, the app never had this issue. It was driving me nuts because I couldn't figure out which broadcast was triggering the problem.

Based on user feedback, I finally narrowed it down and made the following changes:

1) I went through the app and made sure that all custom "action" strings used for Intents included the app's package name.

2) I switched from using Context::sendBroadcast() to LocalBroadcastManager::sendBroadcast().

You can see my full answer on a different post here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!