语言

Menu
Sites
Language
device back button event
My app is getting rejected due to the following reason- 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. Please help me how to resolve this issue. Sidharth

响应

6 回复
Sidharth Thapar

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. 

Sidharth Thapar

When the BACK key is pressed, the application must be terminated or the previous page must appear.
If your application provides only programatical navigation function but doesn''t support H/W BACK key for
application concept, please leave the reason on the ''Comments to Validation Team'' why it doesn''t support
H/W BACK key at the next submission. Tizen Validation Team will refer to it and validate your application.

Marco Buettner

I dont know where is there problem?

You have to add Hardware-Button-Support or leave a comment why you don't support this feature.

To implement the hw-support you have to add the follow code

document.addListener('tizenhwkey', function(button) {

switch(e.keyName)

        {

            case 'back':

                switch($.mobile.activePage)

                {

                    case 'one': // use your first page or another page where the application should close if the use press back

                            tizen.application.getCurrentApplication().exit();

                        break;

                    default: // if no case available, the back button returns back to previous page

                        $.mobile.back();

                }

                break;

            case 'menu':

                // TODO: write a code for pressing menu button

                break;


        }
});

Also you have to active hwkey support on your config.xml file on "tizen" tab.

Hint: You need Tizen 2.2 or higher to use the code above

Alex Wormuth

Where does this code go? I tried putting it in a <script> tag for index.html and it didn't work.

Marco Buettner

If you copy only the code in the box above than the listener is missing

the cofrrect whole code looks like this

document.addListener('tizenhwkey', function(button) {

switch(e.keyName)

        {

            case 'back':

                switch($.mobile.activePage)

                {

                    case 'one': // use your first page or another page where the application should close if the use press back

                            tizen.application.getCurrentApplication().exit();

                        break;

                    default: // if no case available, the back button returns back to previous page

                        $.mobile.back();

                }

                break;

            case 'menu':

                // TODO: write a code for pressing menu button

                break;


        }
});
Sidharth Thapar

Thanks a lot for your guidance