ACTIVITY开机自动运行
来源:互联网 发布:单片机hex文件 编辑:程序博客网 时间:2024/04/27 06:45
"android.intent.action.BOOT_COMPLETED" 为开机自动运行INTENT
onReceive(Context arg0, Intent arg1)
中添加
if (arg1.getAction().equals(ACTION)) {
Intent splash=new Intent
(arg0,Splash.class);
splash.addFlags
(Intent.FLAG_ACTIVITY_NEW_TASK);
arg0.startActivity(splash);
配置文件加上接收信息即可
<receiver android:name=".BootBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
权限
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses
-permission>
------------BootBroadcastReceiver .java
package youbanwang.co.cc;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class BootBroadcastReceiver extends BroadcastReceiver {
final static String ACTION =
"android.intent.action.BOOT_COMPLETED";
@Override
public void onReceive(Context arg0, Intent arg1) {
// TODO Auto-generated method stub
if (arg1.getAction().equals(ACTION)) {
Intent splash=new Intent
(arg0,Splash.class);
splash.addFlags
(Intent.FLAG_ACTIVITY_NEW_TASK);
arg0.startActivity(splash);
}
}
}
--------manifest.xml
<activity
android:name="net.youmi.android.appoffers.YoumiOffersActivity"
android:configChanges="keyboard|keyboardHidden|orientation"/>
<receiver android:name=".BootBroadcastReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
<uses-permission
android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses
-permission>
- ACTIVITY开机自动运行
- android activity/service开机后自动运行
- android activity/service开机后自动运行
- android activity/service开机后自动运行
- android activity/service开机后自动运行 (转)
- 开机自动运行
- 开机自动运行
- 程序开机自动运行
- 开机自动运行程序代码
- 开机自动运行
- 开机自动运行
- linux 开机自动运行
- WinCE 开机自动运行
- 开机自动运行程序
- 开机自动运行
- 开机自动运行程序
- redmine 开机自动运行
- 开机自动运行代码
- iPhone开发判断邮箱格式是否合法
- The JavaScript Code Quality Tool
- Oracle的锁表与解锁
- java环境变量设置
- java的SHA在计算时中文的密码不同
- ACTIVITY开机自动运行
- 原型的构建与设计
- java ActiveMQ 配置
- iOS: Present modal view with smaller size in iPad
- 试图破解zend的授权验证
- cts测试之SystemFeaturesTest
- 高级编程语言的分类
- Qt关闭程序简单分析
- ABAP—COLLECT的用法