service的隐式启动和显示启动
16lz
2021-12-04
隐式启动
<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");
显示启动
final Intent serviceIntent=new Intent(this,service.class);
startService(serviceIntent);
如果在同一个包中。两者都可以用。在不同包时。只能用隐式启动
<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");
显示启动
final Intent serviceIntent=new Intent(this,service.class);
startService(serviceIntent);
如果在同一个包中。两者都可以用。在不同包时。只能用隐式启动
更多相关文章
- android 启动流程
- Android应用程序组件Content Provider的启动过程源代码分析(3)
- Android应用程序组件Content Provider的启动过程源代码分析(5)
- android启动另一应用
- Mono for Android(安卓)显示远程图片
- android 9.0 startService启动Servcie的过程分析
- Android之SurfaceView实现视频播放
- Android下多页显示技巧
- mac 下启动Android(安卓)Studio 时出现 Android(安卓)Studio was