you could try to do 

Process proc = Runtime.getRuntime ().exec ( "su" );


if that throws an exception or proc is null then they don't have root

How can you detect if the device is rooted in the app?
I have a webview from my website working very well in my app. What I'm trying to do now is asking users when they hit Android Back Button if they really want to leave the app.
I'm using the InAppBrowser plugin. Here's my code.

document.addEventListener("deviceready", onDeviceReady, false);

        // Cordova is ready
        function onDeviceReady() {
            navigator.splashscreen.show();
            var ref = window.open("http://m.estadao.com.br", "_self", "location=no");

            ref.addEventListener('loadstop', function(){
                ref.executeScript({
                    code:  
                        document.addEventListener("backbutton", onBackKeyDown, false);
                        function onBackKeyDown() {
                            navigator.notification.confirm(
                                "Tem certeza que deseja sair?",
                                function(buttonIndex){
                                    confirmExit(buttonIndex);
                                },
                                "Aviso",
                                "Ok, Cancel"
                            );
                        }
                        function confirmExit(stat){
                            if (stat == "1"){
                                navigator.app.exitApp();
                            } else {
                                window.open("http://m.estadao.com.br", "_self", "location=no", "zoom=no");
                            }
                        };
                });
            });
        }


And here is the link of plugin
http://cordova.apache.org/docs/en/2.7.0/cordova_inappbrowser_inappbrowser.md.html#executeScript

Any idea what can i do to make it work ? Thanks!
