从ThreadPool线程调用SendBroadcast阻塞调用

时间:2012-06-25 13:42:34

标签: android android-intent

我有一个来自服务中的线程池的线程做了很多事情。最后,它将一些数据插入提供程序并发送广播以通知GUI有关新数据的信息。

通常会发送和接收1-3个广播,然后不再接收广播。当我查看线程堆栈跟踪时,所有这些都位于sendBroadcast中的系统方法中。

来自永不返回线程的Stacktrace:

  

BinderProxy.transact(int,Parcel,Parcel,int)行:不可用[native method]
  ActivityManagerProxy.getProviderMimeType(Uri)行:3296
  ContextImpl $ ApplicationContentResolver(ContentResolver).getType(Uri)line:231
  Intent.resolveType(ContentResolver)行:3754
  Intent.resolveTypeIfNeeded(ContentResolver)行:3776
  ContextImpl.sendBroadcast(Intent)行:969
  Application(ContextWrapper).sendBroadcast(Intent)行:301

Reciver注册:

<receiver android:name=".gui.MeasurementReceiver">
  <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:scheme="content" android:host="compy.product.providers.measurement"/>
  </intent-filter>
</receiver>

广播发送:

context.sendBroadcast(new Intent(android.content.Intent.ACTION_VIEW).
                      setData(Uri.withAppendedPath(compy.content.Intent.URI_channel, ""+id )));

现在,对于真正有趣的部分,上面的工作在带有ICS的Galaxy Nexus和Galaxy Note pre ICS上没有任何问题。但是在Galaxy Note,Galaxy SII和Galaxy SIII上用ICS描述的方式失败了。

在关于Galaxy Nexus的相关说明中,提供者可以启动一次或两次。在有问题的手机上,所有查询都会启动。我们也没有找到任何这种行为的原因。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

好的,事实证明这很简单......

我们在Mainfest文件中双重注册了ContentProvider ......

因此,如果您有疯狂的错误,请检查您的清单。我不知道为什么会破坏广播。

更多信息(编辑):

在尝试对提供程序执行操作的大多数情况下,在LogCat中对此问题的告诉尾部是“正在加载提供程序'您的类名'”。这似乎是一个非常罕见的消息。我们在网上只发现了一些对它的引用。

所以最后的相关说明是最重要的......

相关问题