Monday, November 26, 2018

App basic API with function sample

//Type your code here
function getcurfrm(){
  alert(kony.application.getCurrentForm().id);
  return false;
}
function getprefrm(){ 
  alert(kony.application.getPreviousForm().id);
  return false;
}
function getshowload(){
  kony.application.showLoadingScreen("sknloading","Loading...",constants.
LOADING_SCREEN_POSITION_ONLY_CENTER, false,true,{enableMenuKey:true,
enableBackKey:true, progressIndicatorColor : "ffffff77"});
 
}
function gethideload(){
  kony.application.dismissLoadingScreen();
}
function openURLshow()
{
  //Accessing an external web page : http://www.google.com
  kony.application.openURL("http://hitechkd.blogspot.com/");
}
function exitappli()
{
   try{
         kony.application.exit();
      }
   catch(Error)
      {
         alert("Exception While getting exiting the application  : "+Error);
      }
}

function OSfreeM()
{
   var freememory = kony.os.freeMemory();
alert(freememory);
}
function OSDinfo()
{
   var deviceInfo = kony.os.deviceInfo();
for (var key in deviceInfo)
{
              if(key === "version"){
                 DeviceinfoPopup.LlblVersion.text =deviceInfo[key];
                 }
              if(key === "deviceHeight"){
                 DeviceinfoPopup.LlblDeviceHieght.text =deviceInfo[key];
                 }
              if(key === "deviceWidth"){
                 DeviceinfoPopup.LlblDeviceWidth.text =deviceInfo[key];
                 }
              if(key === "name"){
                 DeviceinfoPopup.LlblName.text =deviceInfo[key];
                 }
              if(key === "model"){
                 DeviceinfoPopup.LlblModel.text =deviceInfo[key];
                 }
       
}
  DeviceinfoPopup.show();
}
function popupdismis(){
  DeviceinfoPopup.dismiss();
}
function OSDGPS()
{
   alert(kony.os.hasGPSSupport());
}
function OSCAMRA()
{
   alert(kony.os.hasCameraSupport());
}
function OSTOUCH()
{
   alert(kony.os.hasTouchSupport());
}
 var i = 0;
function timerFuncstart() //nested function
{
 timercallbackcancel();
i = i+1;
frmtimer.lbltimer.text = i+" secs ";
}
function strat(){
kony.timer.schedule("mytimer12",timerFuncstart, 5, true);
}

//nested function
function setcall1(){
  i = 0;
  frmtimer.lbltimer.text = i+" secs";
}
function timerFuncCallBack()
{
  alert("innovike");
kony.timer.setCallBack("mytimer12",setcall1);
}


function timercallbackcancel()
{

try
{
kony.timer.cancel("mytimer12");
}
catch(err)
{
alert("error in second button onclick and err is:: "+err);
}
}

0 comments:

Post a Comment