既然显示意图能够简单明了的启动service,为何还要用较为复杂的隐示意图,显然隐示意图有着显示意图没有的功能。—在启动不同包下的service只能用隐示意图,在相同的包下都可以启动。
显示意图
intent=new Intent(this,MyService.class);
startService(intent);
隐式启动
<service Android:name=".service">
<intent-filer>
<action android:name="com.android.service"/>
<intent-filer>
</service>
final Intent serviceIntent=new Intent();
serviceIntent.setAction("com.android.service");