【发布时间】:2014-07-30 08:30:16
【问题描述】:
我正在使用显式意图将消息从我的 App1 传递到我的另一个应用 App2。
它与以下代码很好地配合使用:
Intent intent = new Intent();
intent.setComponent(new ComponentName("mypkg","mypkg.myactivity"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("Key1", "MyCustomValue1");
startActivity(intent);
但是,我想通过 Intent 发送后续消息(在发送初始 Intent 之后),但是一旦 App2 启动并发送后续 Intent,App2 中的 onCreate() 就不会再次被命中。那么,我怎样才能得到它,以便我可以向 App2 发送多个意图并在 App2 中捕获每个意图?
(是的,我知道这里的服务会更好,但是这种设计超出了这个问题的范围。)
【问题讨论】: