Binding to a service from another app

徘徊边缘 提交于 2019-11-30 11:35:30

Your ComponentName is incorrectly constructed. When passing in the class name is must be fully qualified like so:

intentForMcuService.setComponent(new ComponentName("com.admetric.modemwatcher",
        "com.admetric.modemwatcher.ModemWatcherService"));

Another thing, if you are referencing a Service outside the boundaries of the application, it's probably best not to use ComponentName to reference it, even if it does work correctly. A more common approach would be to create a custom ACTION string for your Intent and have the Service filter that action.

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