언어 설정

Menu
Sites
Language
Tizen2.2 tizen.application.getCurrentApplication().exit() NOT trigger?

hi,

Encounter issues invoking window.tizen.application.getCurrentApplication().exit();  or tizen.application.getCurrentApplication().exit()  in RD-PQ test device with Tizen 2.2

The exit()    method is not fired, the line before console.log("[DEBUG] Page1 EXIT()!"); is triggered in debug mode and no errors displayed.

Do i need to add anything  in config.xml ? features? privileges ???   Need help to figure out what's going on....      

Code 

-------------------------------------------------------------------------------------------------------------------------------------------------------

            function init() 

            {

                console.log("document init!");

 

                document.addEventListener('tizenhwkey', function(e) { // assign hardware buttons click event handler

                    console.log("[DEBUG] Back key hit!");

                    if(e.keyName == 'back') { // if back button is clicked

                        if ($.mobile.activePage.attr('id') === 'page1') { 

                        //if ( location.hash === 'page1') { // if the main page is active

                            console.log("[DEBUG] Page1 EXIT()!");

                            window.tizen.application.getCurrentApplication().exit(); // close the application

                        } else { // if not main page is active

                            console.log("[DEBUG] mobile.back()! ("+location.hash+")("+$.mobile.activePage.attr('id')+")");

                            $.mobile.back(); // go to the previous page

                        }

                    }

                });

            };

            $(document).bind('pageinit', init); // assign the init function call to the page initialization

-------------------------------------------------------------------------------------------------------------------------------------------------------

My setup

OS : Mac OSX 10.7.5

TIzen SDK : 2.2

Device Image : 2.2

Thank you...

Br,

Peter

Responses

4 댓글
Matt Alonso

Can you try removing the "window." from the front of the call?  That is how I reference it and it works for me.
 

Peter Ong

Same outcome, tizen.application.getCurrentApplication().exit() did not fire in RD-PQ test device with Tizen 2.2.

I have reflashed the device twice, so no sure what todo next.....

 

Matt Alonso
Hey Peter, uber weird. I don't have access to my environment right now but I will put something together fussy thing in the morning. Sorry
konduri sai swathi

Hi,

Place the below code in main.js 

//Initialize function
var init = function () {
    // TODO:: Do your initialization job
	console.log("init() called");

	// add eventListener for tizenhwkey
	document.addEventListener( 'tizenhwkey', function(e) {
		if (e.keyName === 'back') {
			if ($.mobile.activePage.attr('id') === 'page1') {
				tizen.application.getCurrentApplication().exit();
			} else {
				history.back();
			}
		}
	});
};
$(document).bind('pageinit', init);