android-service
来源:互联网 发布:java第三方支付 编辑:程序博客网 时间:2024/06/06 15:42
1. 创建一个service:
public class MyService extends Service {}
2.在清单中申明service
<application>
<service android:name=".MyService" android:enabled="true" android:exported="true"> </service></application>3.调用service
Intent intent=new Intent(this,MyService.class);
this.startService(intent);
4.停止service
this.stopService(intent);或者 stopSelf
执行流程:
onCreate() //只执行一次
onStartCommand(Intent intent, int flags, int startId) //每次调用startService 执行onDestroy() //调用stoService 执行
http://blog.csdn.net/javazejian/article/details/52709857
0 0
- [android]service中再启service
- android service
- Android Service
- android service
- Android Service
- Android service
- android service
- Android Service
- Android Service
- Android service
- Android:Service
- Android Service
- [Android] Service
- android service
- android service
- android service
- android service
- Android Service
- 并查集
- 邻接矩阵
- 三星掌门人李在镕首轮审判将于3月9日举行
- 析构函数
- 数据结构实验之链表五:单链表的拆分
- android-service
- 腾讯云服务器--django安装及基本配置
- 5-20 查找整数 (10分)
- python中矩阵相加函数sum()
- 联想十六亿再卖楼 经验来看:卖楼确实能提亮财报
- CentOS 7 防火墙 firewall-cmd
- win7系统注意
- 5-19 选择法排序 (20分)
- 数据库连接 jndi