你需要的是一个service,需要开机启动。
解决方案 »
- Android 中出现这样的警告 Exported service does not require permission
- android读取各类文件
- 请教一个有关assets的奇怪问题
- android密码屏保
- 关于AutoCompleteTextView 为什么必须输入两个字符才能出现补全提示?
- C#做服务端 android做客户端 通讯
- 帮看看这两个UI的效果,如何实现呢?
- android listView item 布局
- Android pull解析这种格式不一致的xml怎么做
- 求助:android提取系统settings代码怎么单步调试?
- 能改android系统图标吗?还有删除或修改任务栏图片 比如修改电池的图片
- 有谁知道Android中Email程序提供的Provider有哪些?
public class BootBroadcastReceiver extends BroadcastReceiver{ private static String ACTION="android.intent.action.BOOT_COMPLETED"; @Override
public void onReceive(Context ctx,Intent intent){
if(ACTION.equals(intent.getAction())){
Intent soundPoolIntent=new Intent(ctx,SoundPoolActivity.class);
soundPoolIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(soundPoolIntent);
}
}
}
这样就启动了,要注册:
<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"/>
(主activity设置为不可见, AndroidManifest.xml中注释掉
<category android:name="android.intent.category.LAUNCHER" />)
2. BroadcastReceiver监听短信消息,收到短信启动 ui intent