Languages

Menu
Sites
Language
I have developed tizen application i want to use hardware back button,once user click on back button it should be exit from app

Hi,

I have developed TIZEN web application ans I want hardware back button to be work.When user press on back button the it should be exit from application.

 

When user pesss on hardware back button it should exit from application.Please help me as soon as possible.

 

Thanks in advance

 

 

Thanks and regards

Mohit Kumar

Responses

9 Replies
Palitsyna

Hello,

put this code into init function:

//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") {
			try {
				tizen.application.getCurrentApplication().exit();
			} catch (error) {
				console.error("getCurrentApplication(): " + error.message);
			}
		}
	});
};

 

Seoghyun Kang

In addition, you need to add the following code.

 


 window.onload = function() {
     init();
 }

 

mohit kumar

Hi,

This is not working,please explain in details,so that i am able to implement.

 

 

thanks and regards

Mohit Kumar

 

mohit kumar

Hi,

Thank you.Happy TIZEN

 

Very Good TIZEN

 

 

 

mohit kumar

Hi,

when i click on hardware back button then it should be go to particular page.I have developed an application and i want when user press on back button then it display first page of my application.

 

When user press on back button then i want him to send on particular page,please help me as soon as possible.

 

 

Thanks in advance

thanks and regards

Mohit Kumar

 

mohit kumar

Hi,

when i click on hardware back button then it should be go to particular page.I have developed an application and i want when user press on back button then it display first page of my application.

 

When user press on back button then i want him to send on particular page,please help me as soon as possible.

 

 

Thanks in advance

thanks and regards

Mohit Kumar

Bert Vankeirsbilck

Hey,

perhaps it depends on the device you are using. I was working with a Samsung Gear S and found out that (surprisingly) the 'tizenhwkey' in code corresponds to a swipe down on the actual device.

 

 

Palitsyna

Hello,

try this code:

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") {
                window.location.href='firstPage.html';
	    }
	});
};
mohit kumar

Hi Palitsyna,

Thank you so much.It works fine.

 

Happy TIZEN

 

thanks and regards

 

Mohit Kumar