The Tizen platform supports hardware keys for user interactions. All Tizen devices provide the Menu and Back hardware keys. The hardware keys are used instead of displaying buttons on the header and footer of the application screen.

To provide a full user experience for your application users, you must handle hardware key presses to ensure predictable and reliable navigation in your application. The Tizen Web UI framework is based on jQuery and jQueryMobile, which means that you can use the jQuery on() method to bind an event handler on the hardware key event, as shown in the following code snippets:

  • Binding an event callback on the Menu key:
    <!--HTML code-->
    <div data-role="popup" id="popup1" class="ui-ctxpopup-optionmenu">
       <ul data-role="listview">
          <li><a href="#">Settings</a></li>
          <li><a href="#">Add to contact</a></li>
          <li><a href="#">Call log</a></li>
          <li><a href="#">Music</a></li>
       </ul>
    </div>
    /* JavaScript code */
    $(window).on("tizenhwkey", function(e) 
    {
       if (e.originalEvent.keyName === "menu") 
       {
          $("#popup1").popup("open");
       }
    }
  • Binding an event callback on the Back key:
    /* JavaScript code */
    $(window).on("tizenhwkey", function(ev) 
    {
       if (ev.originalEvent.keyName === "back") 
       {
          /* Call window.history.back() to go to previous browser window */
          /* or add script to add another behavior */
       }
    }


'Developer > Tizen' 카테고리의 다른 글

Tizen Application Package Manager  (0) 2013.12.15
Native Application Medel  (0) 2013.12.15
Tizen Push Service  (0) 2013.12.06
Tizen Architecture  (0) 2013.12.05
Tizen Web Application  (0) 2013.12.05
Posted by No names
,