我需要从android小部件开始使用android> 5.0的服务,但是此服务已实现到另一个项目中。Android 5.0(Lollipop)startService无需导入类
如果我使用的设备,采用Android < 4.4此代码的工作:
Intent intent = new Intent("com.service.example");
startService(intent);
我看到这篇文章: Service Must be explicit: Intent
和解决方案,应该是:
Intent serviceIntent = new Intent(context,MyService.class);
context.startService(serviceIntent);
那么,如何在不导入服务类的情况下启动服务(使用intent)呢?
https://stackoverflow.com/questions/35827703/how-to-make-an-implicit-intent-explicit/35827786#35827786 – CommonsWare
可能的重复的[在另一个包中没有意图过滤器启动服务](http:///stackoverflow.com/questions/18603381/start-service-in-another-package-without-intent-filter) – Master
类似但不重复 – Simo