//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create Dynamic button.
btnDynamic = app.CreateButton( "Dynamic" );
btnDynamic.SetOnTouch( btnDynamic_OnTouch );
lay.AddChild( btnDynamic );
//Create Remote button.
btnRemote = app.CreateButton( "Remote" );
btnRemote.SetOnTouch( btnRemote_OnTouch );
lay.AddChild( btnRemote );
//Create a web control.
web = app.CreateWebView( 1, .5, "AllowZoom,AllowRemote" );
web.SetOnProgress( web_OnProgess );
lay.AddChild( web );
//Add layout to app.
app.AddLayout( lay );
Test2();
}
function btnDynamic_OnTouch()
{
Test();
}
function btnRemote_OnTouch()
{
Test2();
}
function notify(){
var notify1 = app.CreateNotification();
notify1.SetMessage( "You have a notification!", "My Title", "My Details" );
notify1.SetLights( "#00ffff", 500, 500 );
notify1.Notify();
}
function Test(){
var html = "<html><head>";
html += "<meta name=viewport content=width=device-width>";
html += '<script src="file:///android_asset/app.js"></script>';
html += "</head><body>Hello Dynamic World!<br>";
html += "<script>app.Execute('notify()');</script>";
html += "</body></html>";
web.LoadHtml( html, "file:///Sys/" );
//notify();y
}
function Test2(){
web.LoadUrl( "http:///aerik.com/temp/test.htm" );
}
//Show page load progress.
function web_OnProgess( progress )
{
if(progress == 100){
}
}
<html><head> <script src="file:///android_asset/app.js"></script> </head><body>Remote page<br> <script>app.Execute('notify()');</script> <script>notify();</script> </body></html>
<html><head><script src="file:///android_asset/app.js"></script><script>window.onload=function(){ alert("just making sure this is running"); prompt(null,"app.Execute('notify();')"); app.Execute('notify()');}</script></head><body>Remote page v2<br></body></html>function Execute(func)
{
prompt( "@", "App.Execute(" + func );
}Execute("notify()");var myapp = App;App = null;prompt( "@", "App.Execute(" + func );