【问题标题】:Android Global Service安卓全球服务
【发布时间】:2015-12-08 10:34:31
【问题描述】:

我想从另一个应用程序启动服务。

Logcat 错误是:

Unable to start service Intent { cmp=com.oic.launchertest.service/.DataSyncService } U=0: not found

使用服务从应用程序清单

<service
    android:name="com.oic.launchertest.service.DataSyncService"
    android:enabled="true"
    android:exported="true">
</service>

在另一个应用程序中,我想使用以下代码启动服务

Intent intent=new Intent();
intent.setComponent( new ComponentName("com.oic.launchertest.service", "com.oic.launchertest.service.DataSyncService"));
startService(intent);

我可能需要一些建议,什么会导致这个问题。

提前致谢。

【问题讨论】:

  • THISTHIS 的重复项
  • @DevendraSingh 这两个线程对我来说都没有帮助
  • 删除服务并重新创建新服务。或重启工作室。

标签: android android-intent service


【解决方案1】:

我确实通过以下解决方案解决了问题。我在评论中读到了这个,但再也找不到线程了......

更改服务的位置确实有帮助。

我把它改成

com.oic.launchertest.service.DataSyncService

com.oic.launchertest.launcher.DataSyncService

现在找到了服务。也许这是一些android命名的复杂性,因为我在包名中有服务?我没有任何线索。

【讨论】:

    猜你喜欢
    • 2012-03-31
    • 2013-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多