隐示意图启动service的优势

yundejia

关注

阅读 150

2022-05-26

既然显示意图能够简单明了的启动service,为何还要用较为复杂的隐示意图,显然隐示意图有着显示意图没有的功能。—在启动不同包下的service只能用隐示意图,在相同的包下都可以启动。
显示意图

  intent=new Intent(this,MyService.class);
startService(intent);

隐式启动





final Intent serviceIntent=new Intent();
serviceIntent.setAction("com.android.service");


精彩评论(0)

0 0 举报