Search code examples
javaandroidexit-codesystem.exit

Does Android care about exit status code passed to System.exit(...)?


If I kill an Android app with System.exit(...), does it matter what status code I pass? I couldn't find any documentation on whether Android just ignores it or whether certain ones lead to any error messages for example or have any other meaning.


Solution

  • This is the exit code returned by the process when it finishes; Android however does not care, but know that the error code should never be higher then 255.

    Here is a list of standard exit codes - some process may use their own codes.

    0    Clean Exit
    1    General Error Catchall
    2    Misuse of shell builtins
    126  Command invoked execution error
    127  Command not found
    128  Invalid exit argument?
    130  Termination by Control-C
    255  Exit status unknown