从Application对象

时间:2016-05-30 08:29:31

标签: android android-widget

我有一个重载的init进程,我希望在两个不同的地方运行,具体取决于应用程序的启动方式。 heavy-init在后台运行AsyncTask。

案例是:

  • 如果应用程序是从Widget(通过Intent)启动的,我需要在Application.onCreate中创建繁重的init
  • 在任何其他情况下,我需要在Activity.onStart
  • 中制作重型init

换句话说,我想知道在Application.onCreate中是否有一种方法可以检索触发的Intent。

感谢 法比奥

1 个答案:

答案 0 :(得分:0)

因为它在此链接中被拒绝:Android- How to check the type of Intent Filters Programmatically? 您可以使用意图的getAction()来了解启动活动的意图类型。