1. Download our Official Android App: Forums for Android!

Killing android app Programitically

Discussion in 'Android Development' started by Rohit Manohar, Sep 6, 2017.

  1. Rohit Manohar

    Rohit Manohar Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Sep 6, 2017

    Sep 6, 2017
    2
    0
    5
    Male
    How can I Kill my android application programmitically , when it got any crash.
    Following commands are not working in Uncaght Excetion Handler.

    1)System.exit(0);
    2)int p = android.os.Process.myPid();
    android.os.Process.killProcess(p);

    Can anyone help for finding correct solution for this problem.
    [​IMG]
     

    Attached Files:


    Advertisement

  2. LV426

    LV426 I say we take off and nuke this place from orbit
    Moderator
    Rank:
     #11
    Points:
    1,988
    Posts:
    7,462
    Joined:
    Oct 16, 2015

    Oct 16, 2015
    7,462
    10,750
    1,988
    Male
    Software developer
    South West of England
    What you have to realise is that your app is not a self-contained process. It's a thread of execution within the Android app container.
    Are you aware of the Activity lifecycle? Have a look at this -

    https://developer.android.com/guide/components/activities/activity-lifecycle.html

    It turns out that someone else asked the question, and the short answer is that you can call finish() to terminate the application -

    https://stackoverflow.com/questions/6330200/how-to-quit-android-application-programmatically
     
    Inferior Being likes this.
  3. Rohit Manohar

    Rohit Manohar Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Sep 6, 2017

    Sep 6, 2017
    2
    0
    5
    Male
    When my application crashes , I m handling it in UnCaught Exception handler and from their I am sending that crash log to my mail id but after that it comes back to the previous activity where we can see the font of text changed but it doesnt do any thing after that.
     

    Attached Files:

Share This Page

Loading...