我的恢复/暂停应用程序有问题。现在,假设我们有一个我覆盖onBackPressed()
方法并为此方法重新定义的活动,如下所示:
@Override
public void onBackPressed() {
moveTaskToBack(true);
}
所以,它在后台运行没有任何问题。因此,为了恢复我的应用程序,我在onResume()
override 方法中声明了以下代码:
@Override
protected void onResume() {
Intent resume = new Intent(this, MainActivity.class);
if ((resume.getFlags() & Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0) {
resume.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
Logger.e(M_tag, "Resume Activity");
startActivity(resume);
return;
}
super.onResume();
}
最小化进程后,我可以成功恢复活动,但我面临的问题是,当我长按链接Internet Browser
并与我的应用程序共享链接时,它会恢复活动但不运行条件
if (getIntent().getAction().equals(Intent.ACTION_SEND))
我在onCreate()
覆盖方法中定义的,如下所示:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (getIntent().getAction.equals(Intent.ACTION_SEND))
Log.e("App", "In action send mode");
}
I've tested Intent.ACTION_SEND
action while no process in background, and it successfully runs the condition, but now, how can I force my applicatin to run ACTION_SEND
intent ?
Thanks in advance.