【Android】开机启动 Service
来源:互联网 发布:协同oa平台软件 编辑:程序博客网 时间:2024/06/11 09:25
package com.lianli.JZX311;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
//开机广播
public class BootBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent service = new Intent(context,BackService.class);
context.startService(service);
Log.i("开机", "开机自动服务自动启动");
}
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lianli.JZX311"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<service
android:name="com.lianli.JZX311.BackService"
android:enabled="true" />
<receiver android:name="BootBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
<activity
android:name="com.lianli.JZX311.StartActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
0 0
- Android开机启动Service
- Android开机启动Service
- Android开机启动Service
- 【Android】开机启动 Service
- android开机启动Service
- Android 开机启动Service
- Android activity/service 开机启动
- 【Android】开机自启动Service
- 【Android】开机自启动Service
- 【Android】开机自启动Service .
- Android 开机启动的service
- Android Service 开机自启动
- 【Android】开机自启动Service
- android开机自启动service
- android开机自启动,service
- Android中开机启动service
- android 开机自启动:启动activity、service
- android应用开机自启动&service开机自启动
- MyEclipse 8.6安装jbpm插件 的具体步骤
- Java中的线程Thread总结
- 怎样在xcode里面使用Memory Leaks和Instruments教程
- 时间复杂度和空间复杂度详解
- AOP名词
- 【Android】开机启动 Service
- VS2012 编译报错:找不到编译动态表达式所需的一个或多个类型。是否缺少引用?
- 一道有趣的面试题————待解决的问题
- document.createDocumentFragment()的用法
- 王垠:程序员的心理疾病
- 设计模式C++实现(1)——工厂模式
- 《Effective C++》读书笔记之三 Item 3. Use const whenever possible
- Broadcast(4)
- (*(volatile unsigned char *)0x56000010)