StartActivity在android系统广播接收器 [英] StartActivity in android broadcast receiver
本文介绍了StartActivity在android系统广播接收器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我注册的manifest.xml接收短信广播。
我如何开始新的活动在接收广播()方法。
有没有意图来设置或任何东西的任何标志?
I registered receiving SMS broadcast in manifest.xml. How can I start new Activity in receive() method of the broadcast. is there any flags of Intent to set or anything?
推荐答案
使用 FLAG_ACTIVITY_NEW_TASK 像这样
@Override
public void onReceive(Context context, Intent intent) {
Intent i = new Intent(context, AlarmDialog.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(i);
}
这篇关于StartActivity在android系统广播接收器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文