-2

How can i get when kil processing app . For Example This Image

When One customer going to kill my app . i want to learn this state so when app killing. onDestroy method doesn't working. I need alternative for it.

public class LoginActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);

}

@Override
protected void onDestroy() {
    super.onDestroy();
    Log.e("Activity","destroy");
}

}

Zarma Mokana
  • 71
  • 2
  • 10
  • Possible duplicate of [How to handle code when app is killed by swiping in android?](http://stackoverflow.com/questions/19568315/how-to-handle-code-when-app-is-killed-by-swiping-in-android) – Morrison Chang Jul 13 '16 at 21:35

1 Answers1

0

You can'd do this. The last lifecycle call which gets called last is the onPause. Nothing else is garanted.

As mentioned here: https://stackoverflow.com/a/16013646/5842844

When a user or the system force stops your application, the entire process is simply killed. There is no callback made to inform you that this has happened.

When the user uninstalls the app, at first the process is killed, then your apk file and data directory are deleted, along with the records in Package Manager that tell other apps which intent filters you've registered for.

Community
  • 1
  • 1
jbarat
  • 2,382
  • 21
  • 23