有没有办法在不使用清单文件中的 Intent-Filter 标签的情况下启动另一个包中定义的 Android 服务?由于某种原因,我无法更新包含该服务的应用程序的清单文件。
如果您知道确切的包名称和服务名称,您可以用它创建一个 Intent。不过,该服务仍然需要在其他清单中声明。
Intent intent = new Intent();
intent.setClassName("com.example.otherapplication", "com.example.otherapplication.ServiceName");
startService(intent);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)