How to resume Android Activity programmatically from background

后端 未结 6 1876
情深已故
情深已故 2020-11-30 08:25

Situation:

  1. Let\'s say I have currently working launched application Activity A.
  2. After some time I am pressing \"Home\" button. Application A goes to b
6条回答
  •  囚心锁ツ
    2020-11-30 08:47

    In order to bring your app to the foreground, you must call startActivity() from another context (either a Service or a BroadcastReceiver). Just calling startActivity() from within an Activity won't bring your app to the foreground.

    You don't need the ACTION and CATEGORY in your Intent, but you do need to set Intent.FLAG_ACTIVITY_NEW_TASK.

提交回复
热议问题