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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
use FLAG_ACTIVITY_NEW_TASK like this
@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);
}