finish on UnityPlayerActivity kills the entire application

I have an Android project in which I have one Unity activity integrated in it. I’m running into an issue when i call finish() from within unity activity to return the main activity. It causes the entire process to be killed (it sends signal 9 – SIGKILL).

This is how I call the java method that handles the back button from Unity C# code:

void Update ()
                if (Input.GetKeyDown (KeyCode.Escape)) {
                    AndroidJavaClass jc = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
                    AndroidJavaObject jo = jc.GetStatic<AndroidJavaObject> ("currentActivity");
                    jo.Call ("goBack");

And I call finish from the Unity activity once I export my project as an Android project:

void goBack(){

Finaly this code solved the problem:

public void goBack() {
    Runnable action = new Runnable() {
        public void run() {

You can Use System.exit(0) instead of finish();