Web app with hw key

Web app with hw key

BY 11 Dec 2013 Web Application Development

Hello, 

My app is rejected due to the hardware key problem like below;

The application is not terminated or the previous page does not appear when the BACK key is pressed. Ref: Please build your application on the latest SDK as possible.

My app has original web site so that we just call and display it on Tizen.

We made it display without web browser on webapp. Unfortunately, i cannot use hardware key like back, menu button on my webapp. 

I can just use them by hosted web site .js file. Hareware key buttons can work by means of js file on hosed web stie. I can move privious page with HW back key and show menu pages with menu button on Tizen phone. But I could not close my app with this operation.  

I tried to close my app like this way:

document.addEventListener('tizenhwkey', function(e) {
var activePage = $.mobile.activePage().attr('id'); // read current page
switch(e.keyName)
{
	case 'back':
		switch(activePage)
		{
			case 'page1':
				tizen.application.getCurrentApplication().exit();
				break;
			default:
				parent.history.back();
				break;
		}
		break;
	case 'menu':
		switch(activePage)
		{
			case 'page2':
				console.log('you are on '+activePage);
				break;
			default:
				//TODO: Do something
				break;
		}
	break;
}});

But I cannot use this feature on my app. It doesnt’ work.

How can i solve this problem? Please let me know. 

Thanks in advance.   

Written by