How to resume Android Activity programmatically from background

后端 未结 6 1875
情深已故
情深已故 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 09:02

    David Wasser answer helped to solve my problem.

    My Activity is running in a foreground Service so I had to call startActivity() method from that Service context.

    Intent intent = new Intent(context, MainActivity.class);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mServiceContext.startActivity(intent);
    

提交回复
热议问题