Unable to terminate the app by BACK key (*No exit menu in the app)

I tried many times to submit my app to Samsung but I always get rejected because the back button or exit button of the watch doesn't work.

My app is a multiple page in one single HTML, as explained in the Tizen Documentation.

I don't know if it's a problem with the code within the app.js file where a problem with the multiple page in one single HTML file.

App.js file:

( function () {

    window.addEventListener( 'tizenhwkey', function( ev ) {
        if( ev.keyName === "back" ) {
            var page = document.getElementsByClassName( 'ui-page-active' )[0],
                pageid = page ? : "";
            if( pageid === "main" ) {
                try {
                } catch (ignore) {
            } else {
    } );
} () );

index.html file:

<!DOCTYPE html>

    <meta name="viewport" content="width=device-width,user-scalable=no">
    <link rel="stylesheet" href="lib/tau/wearable/theme/default/tau.min.css">
    <link rel="stylesheet" media="all and (-tizen-geometric-shape: circle)" href="lib/tau/wearable/theme/default/">
    <!-- load theme file for your application -->
    <link rel="stylesheet" href="css/style.css">


    <div class="ui-page ui-page-active" id="main">
            <h2 class="ui-title">BR Stocks</h2>

        <div class="ui-content content-padding">
            <ul class="ui-listview">
                <li><a href="#two" id="first-button" onclick="link(event);" ticker_id="BVSP">BVSP</a></li>
                <li><a href="#two" id="IBOV" onclick="link(event);" ticker_id="IBOV">IBOV</a></li>
                <li><a href="#two" id="ABEV3" onclick="link(event);" ticker_id="ABEV3">ABEV3</a></li>
                <li><a href="#two" id="AZUL4" onclick="link(event);" ticker_id="AZUL4">AZUL4</a></li>
                <li><a href="#two" id="BTOW3" onclick="link(event);" ticker_id="BTOW3">BTOW3</a></li>

        <div class="ui-page" id="two">
      <span id='ABEV3'>START</span>
        <h2 class="ui-title" id="title">Loading...</h2>
      <div class="ui-content">
        <div id="container">
          <pre><span id="ticker"></span></pre>
          <pre><span id="price"></span></pre>
          <pre><span id="pctChange"></span></pre>
          <a class="back" href="main" onClick="Clear();">Voltar</a>

    function Clear()
       document.getElementById('ticker').innerHTML = '';
       document.getElementById('price').innerHTML = '';
       document.getElementById('pctChange').innerHTML = '';

    function link(event) {
        var element =;
        var ticker_id = element.getAttribute("ticker_id");
        // do what you will with hike_id

            function getPrice(y) {

              if (self.fetch) {
                console.log("fetch ok!")
                    .then(response => response.json())
                    .then(data => {
                //document.getElementById('title').innerHTML = data[y]['name']
                var CompanyName = data[y]['name'];
                var CompanyTicker = data[y]['ticker'];
                var lastPrice = Number(data[y]['lastPrice']);
                var pctChange = Number(data[y]['pctChange']);
                pctChange = pctChange.toFixed(2);

                document.getElementById('ticker').innerHTML = CompanyTicker;
                document.getElementById('title').innerHTML = CompanyName;
                document.getElementById('price').innerHTML = lastPrice.toLocaleString('pt-BR');
                document.getElementById('pctChange').innerHTML = pctChange.replace('.',',') + '%';

                if (pctChange < 0) {
                        console.log('Achou o sinal negativo');
                    document.getElementById('pctChange').className = 'redFont';
                        document.getElementById('pctChange').className = 'greenFont';


              } else {
                console.log("Something went wrong...")

    function red(){
            var elements = document.getElementById('pctChange').innerHTML;
            console.log('Elemento: '+elements);
            if (elements.includes('-')) {
            console.log('Achou o sinal negativo');
              document.getElementById('pctChange').className = 'redFont';
            document.getElementById('pctChange').className = 'greenFont';
    <script src="lib/tau/wearable/js/tau.min.js"></script>
    <script src="js/app.js"></script>
    <script src="js/lowBatteryCheck.js"></script>
    <script src="js/circle-helper.js"></script>
    <script type="text/javascript" src="jquery-3.4.1.min.js"></script>

The html file is pretty simple. The multiple page works with href pointing to id tags (in this case is #two and #main the pages).

For any reason, the button back in the emulator and real gadget is not working. Neither back to previous page, nor exit the application.


2 Replies
gui reif

I have just figure out that for the buttons to work (and also the function tizenhwkey) you have to setup the config.xml file of your project.

I have just added the line below:

<tizen:setting background-support="disable" encryption="disable" hwkey-event="enable"/>

And now the function and buttons work fine!

Marcus Mendes