How to disable exit functionality on press of android device back button in phonegap app?

I have a sample phonegapp application which plays an audio stream(i.e- kalimba.mp3) in background of the app. Playing audio in background is working fine. when I press device home button application is getting minimized but audio playing continues but when I press device back button, the application is getting terminated and so as the background audio.

I have added this line, for not exiting the app on click on back button in my .java file

super.setBooleanProperty("keepRunning", true);

But application is still getting terminated. I want my application be still running when I press back button or home button in my android device and play the audio stream until I close the app from task manager. How to do it?

I am using Android V4.0.0.

here is my code

 <html>
      <head>
        <title>Media Example</title>

        <script type="text/javascript" charset="utf-8" src="cordova.js"></script>

        <script type="text/javascript" charset="utf-8">

        // Wait for Cordova to load
        //
        document.addEventListener("deviceready", onDeviceReady, false);

        // Cordova is ready
        //
        function onDeviceReady() {
            playAudio("/android_asset/www/Kalimba.mp3");
        }

        // Audio player
        //
        var my_media = null;
        var mediaTimer = null;

        // Play audio
        //
        function playAudio(src) {
            // Create Media object from src
            my_media = new Media(src, onSuccess, onError);

            // Play audio
            my_media.play();

            // Update my_media position every second
            if (mediaTimer == null) {
                mediaTimer = setInterval(function() {
                    // get my_media position
                    my_media.getCurrentPosition(
                        // success callback
                        function(position) {
                            if (position > -1) {
                                setAudioPosition((position) + " sec");
                            }
                        },
                        // error callback
                        function(e) {
                            console.log("Error getting pos=" + e);
                            setAudioPosition("Error: " + e);
                        }
                    );
                }, 1000);
            }
        }

        // Pause audio
        // 
        function pauseAudio() {
            if (my_media) {
                my_media.pause();
            }
        }

        // Stop audio
        // 
        function stopAudio() {
            if (my_media) {
                my_media.stop();
            }
            clearInterval(mediaTimer);
            mediaTimer = null;
        }

        // onSuccess Callback
        //
        function onSuccess() {
            console.log("playAudio():Audio Success");
        }

        // onError Callback 
        //
        function onError(error) {
            alert('code: '    + error.code    + 'n' + 
                  'message: ' + error.message + 'n');
        }

        // Set audio position
        // 
        function setAudioPosition(position) {
            document.getElementById('audio_position').innerHTML = position;
        }

        function disalert(){
        alert("extra functionality is working fine");

        }

        </script>
      </head>
      <body>
        <a href="#" class="btn large" onclick="playAudio('/android_asset/www/Kalimba.mp3');">Play Audio</a>
        <a href="#" class="btn large" onclick="pauseAudio();">Pause Playing Audio</a>
        <a href="#" class="btn large" onclick="stopAudio();">Stop Playing Audio</a>
        <p id="audio_position"></p>
        <button onclick="disalert();">click to interupt</button>
      </body>
    </html>

Answer

//Deviceready function
document.addEventListener('deviceready', function() {

    document.addEventListener("backbutton", go_back, false);

}, false);


//Function for back button function
function go_back(){
}