Android activity/service 开机后自动运行实现
2010-02-28 23:14:00 来源:WEB开发网}
}
当然,我们还要改配置文件,需要注意的是,在manifest.xml中需要加上
当然,我们还要改配置文件,需要注意的是,在manifest.xml中需要加上
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.service.prac"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<receiver android:name=".BootReceiver"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</receiver>
<activity android:name=".FirstRun">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
</manifest>
更多精彩
赞助商链接