Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between swipe kill the app and force stop related to Application class

Tags:

android

I have an application that implements the Application class.

consider the following 2 scenarios:

A) open the application -> press home -> long-press home to see recent apps. -> swipe kill the application. in this case, the Application class onCreate function will be called without any interaction.

B)open the application -> press home -> long press on the app -> viw app info -> click on force stop. in this case, the Application class onCreate function will NOT be called.

My questions are:

1 - what is the difference between the two scenarios related to the Application life cycle.

2- Why when I swipe kill the app the Application onCreate method gets called?

P.S I already read this question and it doesn't answer my question.

UPDATE:

I noticed that this behavior in scenario A is not the same for all devices. for example, it happens on a Samsung phone but not on a Pixel phone. maybe it's up to the manufacturer?

picture for scenario A: enter image description here picture for scenario B: enter image description here

like image 388
Remon Shehatta Avatar asked Sep 07 '25 08:09

Remon Shehatta


1 Answers

  • When you swipe the app, you kill only activity components. If there are any background services, they will continue working.

  • When you force stop the app from app menu, you switch off all services working background. For example you will not receive push notifications after this action.

like image 57
Nursultan Almakhanov Avatar answered Sep 09 '25 21:09

Nursultan Almakhanov