android service初步使用

来源:互联网 发布:编程资料百度云 编辑:程序博客网 时间:2024/05/18 01:50

创建service


重载函数,在启动服务之后启动

@Overridepublic int onStartCommand(Intent intent, int flags, int startId) {    return super.onStartCommand(intent, flags, startId);}
开始一个服务

startService(new Intent(MainActivity.this,MyService.class));


0 0