语言

Menu
Sites
Language
Web app with hw key

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.   

响应

4 回复
Raghavendra Reddy Shiva

Due to security concerns, Tizen doesn't allow to access tizen device api in the hosted web application. So is the reason, the "exit" method isn't working for you in you hosted JS file.

Refer below post for some suggestions,

https://developer.tizen.org/forums/web-application-development/hosted-webapps-and-hardware-back-button

Marco Buettner

remove at "activePage" the follow "()"

Alex Dem

Hi,
It is just fyi for the future:
Maybe you could use [Native] app based on Web control (see WebViewer example) and control all transitions (between local and hosted on server pages) and hw keys processing. Web part could be located inside ./data folder. Inside this folder web part could have structure of usual Tizen Web application.
Alexey.

gui reif

Any solution?