Android全球服务

时间:2015-12-08 10:34:32

标签: android android-intent service

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

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);

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

提前致谢。

1 个答案:

答案 0 :(得分:0)

我用以下解决方案解决了问题。我在评论中读到了这个内容,但不能再找到该帖子了......

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

我从

改变了它
com.oic.launchertest.service.DataSyncService

com.oic.launchertest.launcher.DataSyncService

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