1

I writting a desktop application by tideSDK use HTML5. My applicaion will check infomation error of website and notify for me by this application desktop. I used Notification of TideSDK. But i have a problem, when have a infomation error, my application display normal, when have multiple error, notification will display overrides. i research on document of tideSDK, but don't have infomation for this problem.

My code: SERVER:

<?php
$named_array = array(
"kq" => array(
    array(
        "foo" => "http://lvsolution.vn"
    ),
    array(
        "foo" => "http://longvan.net"
    )
)
);
echo json_encode($named_array);
?>

Code My Application:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Network monitor</title>
<style type="text/css">
    body {
        background-color:transparent;
    }

    html, body {
        height: 100%;
    }

    div.wrapper
    {
        width: 100%;
        height: 100%;
        margin-left: auto;
        margin-right: auto;
        border: none;
    }
</style>
<script type="text/javascript" src="app.js"></script> 
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">

function showNotify() {
    var xmlhttp;
    var response;

    if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    }
    else
    {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.open("GET",'http://192.168.64.246/index.php',false);
    xmlhttp.send();
    response = xmlhttp.responseText;
    if(response=="")
    {
    }
    else
    {
        var obj = JSON.parse(response);
        for( i=0; i< obj.kq.length;i++)
        {
        var noti = obj.kq[i].foo;   
        var notification = Ti.Notification.createNotification({
        'title': 'Warning' || 'No Title',
        'message': noti || 'No Message',
        'callback' : function (){ document.getElementById("iFrame").src = noti;
                                    /***alert(noti);***/
                                },
        'icon' : 'app://images/notification.png'        
        });
        notification.show();
        //Create a callback function for the notification

        }
    }
}

$(document).ready( function() {
        showNotify();
        setInterval(function() {
            showNotify();
        }, 10000);
    });
</script>
</head>

<body>
<div class="wrapper">
    <iframe id="iFrame" scrolling="no" src="http://support.longvan.net/cloud   /login.xhtml" width="100%" height="100%" frameborder="0" allowtransparency="yes"  ></iframe>     
</div>      

developer82
  • 13,237
  • 21
  • 88
  • 153
Takeshi
  • 221
  • 1
  • 4
  • 16

0 Answers0