package medicomed.keymon.com.mx;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.B4AClass;
import anywheresoftware.b4a.BALayout;
import anywheresoftware.b4a.debug.*;

public class cl_appupdate extends B4AClass.ImplB4AClass implements BA.SubDelegator{
    private static java.util.HashMap<String, java.lang.reflect.Method> htSubs;
    private void innerInitialize(BA _ba) throws Exception {
        if (ba == null) {
            ba = new BA(_ba, this, htSubs, "medicomed.keymon.com.mx.cl_appupdate");
            if (htSubs == null) {
                ba.loadHtSubs(this.getClass());
                htSubs = ba.htSubs;
            }
            
        }
        if (BA.isShellModeRuntimeCheck(ba)) 
			   this.getClass().getMethod("_class_globals", medicomed.keymon.com.mx.cl_appupdate.class).invoke(this, new Object[] {null});
        else
            ba.raiseEvent2(null, true, "class_globals", false);
    }

 public anywheresoftware.b4a.keywords.Common __c = null;
public int _err_nopkg = 0;
public int _err_notxt = 0;
public int _err_noapk = 0;
public int _err_txtrow = 0;
public int _err_html = 0;
public int _err_nospace = 0;
public int _err_noperm = 0;
public int _err_download = 0;
public int _err_http = 0;
public int _ok_init = 0;
public int _ok_curver = 0;
public int _ok_webver = 0;
public int _no_newerapk = 0;
public int _ok_newerapk = 0;
public int _ok_download = 0;
public int _ok_install = 0;
public Object _callback = null;
public String _event = "";
public String _spackagename = "";
public String _snewvertxt = "";
public String _snewverapk = "";
public int _sstatuscode = 0;
public String _susername = "";
public String _supassword = "";
public String _curver = "";
public String _webver = "";
public String _webclog = "";
public String _webfsize = "";
public boolean _sverbose = false;
public anywheresoftware.b4a.objects.PanelWrapper _pnlsplash = null;
public boolean _splashshowing = false;
public anywheresoftware.b4a.phone.Phone _phone = null;
public anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
public String _sharedfolder = "";
public boolean _usefileprovider = false;
public int _logcolor1 = 0;
public b4a.example.dateutils _dateutils = null;
public medicomed.keymon.com.mx.main _main = null;
public medicomed.keymon.com.mx.starter _starter = null;
public medicomed.keymon.com.mx.appupdater _appupdater = null;
public medicomed.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public medicomed.keymon.com.mx.mapa_cliente _mapa_cliente = null;
public medicomed.keymon.com.mx.subs _subs = null;
public medicomed.keymon.com.mx.notificationservice _notificationservice = null;
public medicomed.keymon.com.mx.pendientes _pendientes = null;
public medicomed.keymon.com.mx.tracker _tracker = null;
public medicomed.keymon.com.mx.newinst2 _newinst2 = null;
public medicomed.keymon.com.mx.b4xpages _b4xpages = null;
public medicomed.keymon.com.mx.b4xcollections _b4xcollections = null;
public medicomed.keymon.com.mx.httputils2service _httputils2service = null;
public medicomed.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public boolean  _canrequestpackageinstalls() throws Exception{
anywheresoftware.b4j.object.JavaObject _ctxt = null;
anywheresoftware.b4j.object.JavaObject _packagemanager = null;
 //BA.debugLineNum = 448;BA.debugLine="Public Sub CanRequestPackageInstalls As Boolean";
 //BA.debugLineNum = 449;BA.debugLine="Dim ctxt As JavaObject";
_ctxt = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 450;BA.debugLine="ctxt.InitializeContext";
_ctxt.InitializeContext(ba);
 //BA.debugLineNum = 451;BA.debugLine="Dim PackageManager As JavaObject = ctxt.RunMethod";
_packagemanager = new anywheresoftware.b4j.object.JavaObject();
_packagemanager = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_ctxt.RunMethod("getPackageManager",(Object[])(__c.Null))));
 //BA.debugLineNum = 452;BA.debugLine="Return PackageManager.RunMethod(\"canRequestPackag";
if (true) return BA.ObjectToBoolean(_packagemanager.RunMethod("canRequestPackageInstalls",(Object[])(__c.Null)));
 //BA.debugLineNum = 453;BA.debugLine="End Sub";
return false;
}
public boolean  _checknonmarketappsenabled() throws Exception{
anywheresoftware.b4j.object.JavaObject _context = null;
anywheresoftware.b4j.object.JavaObject _resolver = null;
anywheresoftware.b4j.object.JavaObject _global = null;
 //BA.debugLineNum = 471;BA.debugLine="Public Sub CheckNonMarketAppsEnabled As Boolean";
 //BA.debugLineNum = 472;BA.debugLine="If phone.SdkVersion >= 26 Then Return True";
if (_phone.getSdkVersion()>=26) { 
if (true) return __c.True;};
 //BA.debugLineNum = 473;BA.debugLine="If phone.SdkVersion < 17 Or phone.SdkVersion >= 2";
if (_phone.getSdkVersion()<17 || _phone.getSdkVersion()>=21) { 
 //BA.debugLineNum = 474;BA.debugLine="Return phone.GetSettings(\"install_non_market_app";
if (true) return (_phone.GetSettings("install_non_market_apps")).equals("1");
 }else {
 //BA.debugLineNum = 476;BA.debugLine="Dim context As JavaObject";
_context = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 477;BA.debugLine="context.InitializeContext";
_context.InitializeContext(ba);
 //BA.debugLineNum = 478;BA.debugLine="Dim resolver As JavaObject = context.RunMethod(\"";
_resolver = new anywheresoftware.b4j.object.JavaObject();
_resolver = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_context.RunMethod("getContentResolver",(Object[])(__c.Null))));
 //BA.debugLineNum = 479;BA.debugLine="Dim global As JavaObject";
_global = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 480;BA.debugLine="global.InitializeStatic(\"android.provider.Settin";
_global.InitializeStatic("android.provider.Settings.Global");
 //BA.debugLineNum = 481;BA.debugLine="Return global.RunMethod(\"getString\", Array(resol";
if (true) return (_global.RunMethod("getString",new Object[]{(Object)(_resolver.getObject()),(Object)("install_non_market_apps")})).equals((Object)("1"));
 };
 //BA.debugLineNum = 483;BA.debugLine="End Sub";
return false;
}
public String  _class_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Private Sub Class_Globals";
 //BA.debugLineNum = 8;BA.debugLine="Public ERR_NOPKG = -1	As Int				'missing package";
_err_nopkg = (int) (-1);
 //BA.debugLineNum = 9;BA.debugLine="Public ERR_NOTXT = -2 As Int				'missing webserve";
_err_notxt = (int) (-2);
 //BA.debugLineNum = 10;BA.debugLine="Public ERR_NOAPK = -3 As Int				'missing webserve";
_err_noapk = (int) (-3);
 //BA.debugLineNum = 11;BA.debugLine="Public ERR_TXTROW = -4 As Int				'wrong row forma";
_err_txtrow = (int) (-4);
 //BA.debugLineNum = 12;BA.debugLine="Public ERR_HTML = -5 As Int					'website returned";
_err_html = (int) (-5);
 //BA.debugLineNum = 13;BA.debugLine="Public ERR_NOSPACE = -6 As Int				'no enough spac";
_err_nospace = (int) (-6);
 //BA.debugLineNum = 14;BA.debugLine="Public ERR_NOPERM = -7 As Int				'no permissions";
_err_noperm = (int) (-7);
 //BA.debugLineNum = 15;BA.debugLine="Public ERR_DOWNLOAD = -8 As Int				'failed to dow";
_err_download = (int) (-8);
 //BA.debugLineNum = 16;BA.debugLine="Public ERR_HTTP = -100 As Int				'HttpUtils error";
_err_http = (int) (-100);
 //BA.debugLineNum = 17;BA.debugLine="Public OK_INIT = 0 As Int";
_ok_init = (int) (0);
 //BA.debugLineNum = 18;BA.debugLine="Public OK_CURVER = 1 As Int					'curver has valid";
_ok_curver = (int) (1);
 //BA.debugLineNum = 19;BA.debugLine="Public OK_WEBVER = 2 As Int";
_ok_webver = (int) (2);
 //BA.debugLineNum = 20;BA.debugLine="Public NO_NEWERAPK = 3 As Int				'apk version on";
_no_newerapk = (int) (3);
 //BA.debugLineNum = 21;BA.debugLine="Public OK_NEWERAPK = 4 As Int				'current apk has";
_ok_newerapk = (int) (4);
 //BA.debugLineNum = 22;BA.debugLine="Public OK_DOWNLOAD = 5 As Int				'newer apk corre";
_ok_download = (int) (5);
 //BA.debugLineNum = 23;BA.debugLine="Public OK_INSTALL = 6 As Int				'user asked to in";
_ok_install = (int) (6);
 //BA.debugLineNum = 26;BA.debugLine="Private Callback As Object";
_callback = new Object();
 //BA.debugLineNum = 27;BA.debugLine="Private Event As String";
_event = "";
 //BA.debugLineNum = 28;BA.debugLine="Private sPackageName As String      		'ex: com.te";
_spackagename = "";
 //BA.debugLineNum = 29;BA.debugLine="Private sNewVerTxt As String        		'ex: http:/";
_snewvertxt = "";
 //BA.debugLineNum = 30;BA.debugLine="Private sNewVerApk  As String       		'ex: http:/";
_snewverapk = "";
 //BA.debugLineNum = 31;BA.debugLine="Private sStatusCode As Int          		'negatives";
_sstatuscode = 0;
 //BA.debugLineNum = 32;BA.debugLine="Private sUserName As String         		'user name";
_susername = "";
 //BA.debugLineNum = 33;BA.debugLine="Private sUPassword As String        		'password r";
_supassword = "";
 //BA.debugLineNum = 34;BA.debugLine="Private curver, webver As String    		'curver = c";
_curver = "";
_webver = "";
 //BA.debugLineNum = 35;BA.debugLine="Private webclog As String					'webclog = optional";
_webclog = "";
 //BA.debugLineNum = 36;BA.debugLine="Private webfsize As String					'webfsize = option";
_webfsize = "";
 //BA.debugLineNum = 37;BA.debugLine="Private sVerbose As Boolean					'TRUE = a lot of";
_sverbose = false;
 //BA.debugLineNum = 38;BA.debugLine="Private pnlSplash As Panel					'panel used to sup";
_pnlsplash = new anywheresoftware.b4a.objects.PanelWrapper();
 //BA.debugLineNum = 39;BA.debugLine="Private SplashShowing As Boolean			'True = splash";
_splashshowing = false;
 //BA.debugLineNum = 40;BA.debugLine="Private phone As Phone";
_phone = new anywheresoftware.b4a.phone.Phone();
 //BA.debugLineNum = 41;BA.debugLine="Private rp As RuntimePermissions";
_rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 42;BA.debugLine="Private SharedFolder As String				'Foder where to";
_sharedfolder = "";
 //BA.debugLineNum = 43;BA.debugLine="Private UseFileProvider As Boolean			'TRUE = SDK";
_usefileprovider = false;
 //BA.debugLineNum = 44;BA.debugLine="Private LogColor1 As Int = 0xFFFF8C00		'first col";
_logcolor1 = ((int)0xffff8c00);
 //BA.debugLineNum = 45;BA.debugLine="End Sub";
return "";
}
public void  _downloadapk() throws Exception{
ResumableSub_DownloadApk rsub = new ResumableSub_DownloadApk(this);
rsub.resume(ba, null);
}
public static class ResumableSub_DownloadApk extends BA.ResumableSub {
public ResumableSub_DownloadApk(medicomed.keymon.com.mx.cl_appupdate parent) {
this.parent = parent;
}
medicomed.keymon.com.mx.cl_appupdate parent;
medicomed.keymon.com.mx.httpjob _j = null;
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 159;BA.debugLine="LogColor(\"---- AppUpdating.DownloadApk\", LogColor";
parent.__c.LogImpl("99764865","---- AppUpdating.DownloadApk",parent._logcolor1);
 //BA.debugLineNum = 161;BA.debugLine="If sNewVerApk = \"\" Then";
if (true) break;

case 1:
//if
this.state = 10;
if ((parent._snewverapk).equals("")) { 
this.state = 3;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 162;BA.debugLine="sStatusCode = ERR_NOAPK";
parent._sstatuscode = parent._err_noapk;
 //BA.debugLineNum = 163;BA.debugLine="If sVerbose Then Log($\"${TAB}missing apk file fu";
if (true) break;

case 4:
//if
this.state = 9;
if (parent._sverbose) { 
this.state = 6;
;}if (true) break;

case 6:
//C
this.state = 9;
parent.__c.LogImpl("99764869",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"missing apk file full path indication"),0);
if (true) break;

case 9:
//C
this.state = 10;
;
 //BA.debugLineNum = 164;BA.debugLine="Finito";
parent._finito();
 //BA.debugLineNum = 165;BA.debugLine="Return";
if (true) return ;
 if (true) break;

case 10:
//C
this.state = 11;
;
 //BA.debugLineNum = 168;BA.debugLine="Dim j As HttpJob";
_j = new medicomed.keymon.com.mx.httpjob();
 //BA.debugLineNum = 169;BA.debugLine="j.Initialize(\"\", Me)";
_j._initialize /*String*/ (ba,"",parent);
 //BA.debugLineNum = 170;BA.debugLine="j.Username = sUserName";
_j._username /*String*/  = parent._susername;
 //BA.debugLineNum = 171;BA.debugLine="j.Password = sUPassword";
_j._password /*String*/  = parent._supassword;
 //BA.debugLineNum = 172;BA.debugLine="j.Download(sNewVerApk)							'ex: j.Download(\"htt";
_j._download /*String*/ (parent._snewverapk);
 //BA.debugLineNum = 173;BA.debugLine="Wait For (j) JobDone(j As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j));
this.state = 29;
return;
case 29:
//C
this.state = 11;
_j = (medicomed.keymon.com.mx.httpjob) result[0];
;
 //BA.debugLineNum = 174;BA.debugLine="Log($\"Donload ok? ${j.Success}\"$)";
parent.__c.LogImpl("99764880",("Donload ok? "+parent.__c.SmartStringFormatter("",(Object)(_j._success /*boolean*/ ))+""),0);
 //BA.debugLineNum = 175;BA.debugLine="If j.Success Then";
if (true) break;

case 11:
//if
this.state = 28;
if (_j._success /*boolean*/ ) { 
this.state = 13;
}else {
this.state = 21;
}if (true) break;

case 13:
//C
this.state = 14;
 //BA.debugLineNum = 177;BA.debugLine="Dim out As OutputStream";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
 //BA.debugLineNum = 178;BA.debugLine="out = File.OpenOutput(SharedFolder,\"tmp.apk\",Fal";
_out = parent.__c.File.OpenOutput(parent._sharedfolder,"tmp.apk",parent.__c.False);
 //BA.debugLineNum = 179;BA.debugLine="File.Copy2(J.GetInputStream, out)";
parent.__c.File.Copy2((java.io.InputStream)(_j._getinputstream /*anywheresoftware.b4a.objects.streams.File.InputStreamWrapper*/ ().getObject()),(java.io.OutputStream)(_out.getObject()));
 //BA.debugLineNum = 180;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 181;BA.debugLine="Log($\"Copy2 (saving) ok? TRUE\"$)";
parent.__c.LogImpl("99764887",("Copy2 (saving) ok? TRUE"),0);
 //BA.debugLineNum = 182;BA.debugLine="sStatusCode = OK_DOWNLOAD";
parent._sstatuscode = parent._ok_download;
 //BA.debugLineNum = 183;BA.debugLine="If sVerbose Then Log($\"${TAB}new apk version dow";
if (true) break;

case 14:
//if
this.state = 19;
if (parent._sverbose) { 
this.state = 16;
;}if (true) break;

case 16:
//C
this.state = 19;
parent.__c.LogImpl("99764889",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"new apk version downloaded and ready to install"),0);
if (true) break;

case 19:
//C
this.state = 28;
;
 if (true) break;

case 21:
//C
this.state = 22;
 //BA.debugLineNum = 185;BA.debugLine="Log($\"${TAB}Error: ${J.ErrorMessage}\"$)";
parent.__c.LogImpl("99764891",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"Error: "+parent.__c.SmartStringFormatter("",(Object)(_j._errormessage /*String*/ ))+""),0);
 //BA.debugLineNum = 186;BA.debugLine="sStatusCode = ERR_HTTP";
parent._sstatuscode = parent._err_http;
 //BA.debugLineNum = 187;BA.debugLine="If sVerbose Then Log($\"${TAB}error in httputils2";
if (true) break;

case 22:
//if
this.state = 27;
if (parent._sverbose) { 
this.state = 24;
;}if (true) break;

case 24:
//C
this.state = 27;
parent.__c.LogImpl("99764893",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"error in httputils2"),0);
if (true) break;

case 27:
//C
this.state = 28;
;
 //BA.debugLineNum = 188;BA.debugLine="ToastMessageShow(\"Error: \" & J.ErrorMessage, Tru";
parent.__c.ToastMessageShow(BA.ObjectToCharSequence("Error: "+_j._errormessage /*String*/ ),parent.__c.True);
 if (true) break;

case 28:
//C
this.state = -1;
;
 //BA.debugLineNum = 190;BA.debugLine="j.Release";
_j._release /*String*/ ();
 //BA.debugLineNum = 191;BA.debugLine="Finito";
parent._finito();
 //BA.debugLineNum = 192;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public void  _jobdone(medicomed.keymon.com.mx.httpjob _j) throws Exception{
}
public String  _extractcl(String _txtrow) throws Exception{
int _i = 0;
int _j1 = 0;
int _j2 = 0;
 //BA.debugLineNum = 381;BA.debugLine="Private Sub ExtractCL(TxtRow As String) As String";
 //BA.debugLineNum = 382;BA.debugLine="Dim i As Int";
_i = 0;
 //BA.debugLineNum = 383;BA.debugLine="i = TxtRow.IndexOf(\"<ChangeLog>\")";
_i = _txtrow.indexOf("<ChangeLog>");
 //BA.debugLineNum = 384;BA.debugLine="If i <> -1 Then";
if (_i!=-1) { 
 //BA.debugLineNum = 385;BA.debugLine="Dim j1 As Int = TxtRow.IndexOf(\"</ChangeLog>\")";
_j1 = _txtrow.indexOf("</ChangeLog>");
 //BA.debugLineNum = 386;BA.debugLine="If j1 = -1 Then";
if (_j1==-1) { 
 //BA.debugLineNum = 387;BA.debugLine="Dim j2 As Int = TxtRow.IndexOf(\"<FileSize>\")	'l";
_j2 = _txtrow.indexOf("<FileSize>");
 //BA.debugLineNum = 388;BA.debugLine="j1 = j2";
_j1 = _j2;
 //BA.debugLineNum = 389;BA.debugLine="If j1 < i Then j1 = -1";
if (_j1<_i) { 
_j1 = (int) (-1);};
 };
 //BA.debugLineNum = 391;BA.debugLine="If j1 <> -1 Then Return TxtRow.SubString2(i+11,j";
if (_j1!=-1) { 
if (true) return _txtrow.substring((int) (_i+11),_j1);}
else {
if (true) return _txtrow.substring((int) (_i+11));};
 }else {
 //BA.debugLineNum = 393;BA.debugLine="Return \"\"";
if (true) return "";
 };
 //BA.debugLineNum = 395;BA.debugLine="End Sub";
return "";
}
public String  _extractsz(String _txtrow) throws Exception{
int _i = 0;
int _j1 = 0;
int _j2 = 0;
String _s = "";
 //BA.debugLineNum = 399;BA.debugLine="Private Sub ExtractSZ(TxtRow As String) As String";
 //BA.debugLineNum = 400;BA.debugLine="Dim i As Int";
_i = 0;
 //BA.debugLineNum = 401;BA.debugLine="i = TxtRow.IndexOf(\"<FileSize>\")";
_i = _txtrow.indexOf("<FileSize>");
 //BA.debugLineNum = 402;BA.debugLine="If i <> -1 Then";
if (_i!=-1) { 
 //BA.debugLineNum = 403;BA.debugLine="Dim j1 As Int = TxtRow.IndexOf(\"</FileSize>\")		'";
_j1 = _txtrow.indexOf("</FileSize>");
 //BA.debugLineNum = 404;BA.debugLine="If j1 = -1 Then";
if (_j1==-1) { 
 //BA.debugLineNum = 405;BA.debugLine="Dim j2 As Int = TxtRow.IndexOf(\"<ChangeLog>\")	'";
_j2 = _txtrow.indexOf("<ChangeLog>");
 //BA.debugLineNum = 406;BA.debugLine="j1 = j2";
_j1 = _j2;
 //BA.debugLineNum = 407;BA.debugLine="If j1 < i Then j1 = -1";
if (_j1<_i) { 
_j1 = (int) (-1);};
 };
 //BA.debugLineNum = 409;BA.debugLine="Dim s As String";
_s = "";
 //BA.debugLineNum = 410;BA.debugLine="If j1 <> -1 Then s = TxtRow.SubString2(i+10,j1)";
if (_j1!=-1) { 
_s = _txtrow.substring((int) (_i+10),_j1);}
else {
_s = _txtrow.substring((int) (_i+10));};
 //BA.debugLineNum = 411;BA.debugLine="s = s.Replace(CRLF,\"\")";
_s = _s.replace(__c.CRLF,"");
 //BA.debugLineNum = 412;BA.debugLine="s=s.Replace(Chr(13),\"\")";
_s = _s.replace(BA.ObjectToString(__c.Chr((int) (13))),"");
 //BA.debugLineNum = 413;BA.debugLine="Return s";
if (true) return _s;
 }else {
 //BA.debugLineNum = 415;BA.debugLine="Return \"\"";
if (true) return "";
 };
 //BA.debugLineNum = 417;BA.debugLine="End Sub";
return "";
}
public String  _extractvn(String _txtrow) throws Exception{
int _i = 0;
int _j1 = 0;
int _j2 = 0;
int _j = 0;
String _s = "";
 //BA.debugLineNum = 360;BA.debugLine="Private Sub ExtractVN(TxtRow As String) As String";
 //BA.debugLineNum = 361;BA.debugLine="Dim i As Int";
_i = 0;
 //BA.debugLineNum = 362;BA.debugLine="i = TxtRow.IndexOf(\"=\")";
_i = _txtrow.indexOf("=");
 //BA.debugLineNum = 363;BA.debugLine="If i <> -1 Then";
if (_i!=-1) { 
 //BA.debugLineNum = 364;BA.debugLine="Dim j1 As Int = TxtRow.IndexOf(\"<ChangeLog>\")	'l";
_j1 = _txtrow.indexOf("<ChangeLog>");
 //BA.debugLineNum = 365;BA.debugLine="Dim j2 As Int = TxtRow.IndexOf(\"<FileSize>\")	'lo";
_j2 = _txtrow.indexOf("<FileSize>");
 //BA.debugLineNum = 366;BA.debugLine="Dim j As Int = Min(j1, j2)";
_j = (int) (__c.Min(_j1,_j2));
 //BA.debugLineNum = 367;BA.debugLine="If j = -1 Then j = Max(j1,j2)";
if (_j==-1) { 
_j = (int) (__c.Max(_j1,_j2));};
 //BA.debugLineNum = 368;BA.debugLine="Dim s As String";
_s = "";
 //BA.debugLineNum = 369;BA.debugLine="If j <> - 1 Then s=TxtRow.SubString2(i+1,j) Else";
if (_j!=-1) { 
_s = _txtrow.substring((int) (_i+1),_j);}
else {
_s = _txtrow.substring((int) (_i+1));};
 //BA.debugLineNum = 370;BA.debugLine="s=s.Replace(CRLF,\"\")";
_s = _s.replace(__c.CRLF,"");
 //BA.debugLineNum = 371;BA.debugLine="s=s.Replace(Chr(13),\"\")";
_s = _s.replace(BA.ObjectToString(__c.Chr((int) (13))),"");
 //BA.debugLineNum = 372;BA.debugLine="Return s";
if (true) return _s;
 }else {
 //BA.debugLineNum = 374;BA.debugLine="Return \"\"";
if (true) return "";
 };
 //BA.debugLineNum = 376;BA.debugLine="End Sub";
return "";
}
public String  _finito() throws Exception{
 //BA.debugLineNum = 290;BA.debugLine="Private Sub Finito";
 //BA.debugLineNum = 291;BA.debugLine="If SubExists(Callback,Event&\"_UpdateComplete\") Th";
if (__c.SubExists(ba,_callback,_event+"_UpdateComplete")) { 
 //BA.debugLineNum = 292;BA.debugLine="CallSub(Callback,Event&\"_UpdateComplete\")";
__c.CallSubNew(ba,_callback,_event+"_UpdateComplete");
 };
 //BA.debugLineNum = 294;BA.debugLine="End Sub";
return "";
}
public long  _getavailablespace() throws Exception{
 //BA.debugLineNum = 137;BA.debugLine="Public Sub GetAvailableSpace As Long";
 //BA.debugLineNum = 138;BA.debugLine="Return GetFreeSpace";
if (true) return _getfreespace();
 //BA.debugLineNum = 139;BA.debugLine="End Sub";
return 0L;
}
public String  _getcurvn() throws Exception{
 //BA.debugLineNum = 114;BA.debugLine="Public Sub getCurVN As String";
 //BA.debugLineNum = 115;BA.debugLine="Return curver";
if (true) return _curver;
 //BA.debugLineNum = 116;BA.debugLine="End Sub";
return "";
}
public Object  _getfileuri(String _filename) throws Exception{
anywheresoftware.b4j.object.JavaObject _uri = null;
anywheresoftware.b4j.object.JavaObject _f = null;
anywheresoftware.b4j.object.JavaObject _fp = null;
anywheresoftware.b4j.object.JavaObject _context = null;
 //BA.debugLineNum = 503;BA.debugLine="Private Sub GetFileUri (FileName As String) As Obj";
 //BA.debugLineNum = 504;BA.debugLine="If UseFileProvider = False Then";
if (_usefileprovider==__c.False) { 
 //BA.debugLineNum = 505;BA.debugLine="Dim uri As JavaObject";
_uri = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 506;BA.debugLine="Return uri.InitializeStatic(\"android.net.Uri\").R";
if (true) return _uri.InitializeStatic("android.net.Uri").RunMethod("parse",new Object[]{(Object)("file://"+__c.File.Combine(_sharedfolder,_filename))});
 }else {
 //BA.debugLineNum = 508;BA.debugLine="Dim f As JavaObject";
_f = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 509;BA.debugLine="f.InitializeNewInstance(\"java.io.File\", Array(Sh";
_f.InitializeNewInstance("java.io.File",new Object[]{(Object)(_sharedfolder),(Object)(_filename)});
 //BA.debugLineNum = 510;BA.debugLine="Dim fp As JavaObject";
_fp = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 511;BA.debugLine="Dim context As JavaObject";
_context = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 512;BA.debugLine="context.InitializeContext";
_context.InitializeContext(ba);
 //BA.debugLineNum = 513;BA.debugLine="fp.InitializeStatic(\"android.support.v4.content.";
_fp.InitializeStatic("androidx.core.content.FileProvider");
 //BA.debugLineNum = 514;BA.debugLine="Return fp.RunMethod(\"getUriForFile\", Array(conte";
if (true) return _fp.RunMethod("getUriForFile",new Object[]{(Object)(_context.getObject()),(Object)(__c.Application.getPackageName()+".provider"),(Object)(_f.getObject())});
 };
 //BA.debugLineNum = 516;BA.debugLine="End Sub";
return null;
}
public long  _getfreespace() throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
 //BA.debugLineNum = 421;BA.debugLine="Private Sub GetFreeSpace As Long";
 //BA.debugLineNum = 422;BA.debugLine="Dim jo As JavaObject";
_jo = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 423;BA.debugLine="jo.InitializeNewInstance(\"java.io.File\", Array(Sh";
_jo.InitializeNewInstance("java.io.File",new Object[]{(Object)(_sharedfolder)});
 //BA.debugLineNum = 424;BA.debugLine="Return jo.RunMethod(\"getFreeSpace\", Null)";
if (true) return BA.ObjectToLongNumber(_jo.RunMethod("getFreeSpace",(Object[])(__c.Null)));
 //BA.debugLineNum = 425;BA.debugLine="End Sub";
return 0L;
}
public String  _getnmappinst() throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
anywheresoftware.b4j.object.JavaObject _context = null;
anywheresoftware.b4j.object.JavaObject _resolver = null;
 //BA.debugLineNum = 435;BA.debugLine="Private Sub GetNMAppInst As String";
 //BA.debugLineNum = 436;BA.debugLine="Dim jo As JavaObject";
_jo = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 437;BA.debugLine="jo.InitializeStatic(\"android.provider.Settings.Se";
_jo.InitializeStatic("android.provider.Settings.Secure");
 //BA.debugLineNum = 438;BA.debugLine="Dim context As JavaObject";
_context = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 439;BA.debugLine="context.InitializeContext";
_context.InitializeContext(ba);
 //BA.debugLineNum = 440;BA.debugLine="Dim resolver As JavaObject = context.RunMethod(\"g";
_resolver = new anywheresoftware.b4j.object.JavaObject();
_resolver = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_context.RunMethod("getContentResolver",(Object[])(__c.Null))));
 //BA.debugLineNum = 441;BA.debugLine="Return jo.RunMethod(\"getString\", Array(resolver,";
if (true) return BA.ObjectToString(_jo.RunMethod("getString",new Object[]{(Object)(_resolver.getObject()),(Object)("install_non_market_apps")}));
 //BA.debugLineNum = 442;BA.debugLine="End Sub";
return "";
}
public String  _getpackagename() throws Exception{
 //BA.debugLineNum = 79;BA.debugLine="Public Sub getPackageName As String";
 //BA.debugLineNum = 80;BA.debugLine="Return sPackageName";
if (true) return _spackagename;
 //BA.debugLineNum = 81;BA.debugLine="End Sub";
return "";
}
public int  _getsdkversion() throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
 //BA.debugLineNum = 428;BA.debugLine="Private Sub GetSDKVersion As Int";
 //BA.debugLineNum = 429;BA.debugLine="Dim jo As JavaObject";
_jo = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 430;BA.debugLine="jo.InitializeStatic(\"android.os.Build.VERSION\")";
_jo.InitializeStatic("android.os.Build.VERSION");
 //BA.debugLineNum = 431;BA.debugLine="Return jo.GetField(\"SDK_INT\")";
if (true) return (int)(BA.ObjectToNumber(_jo.GetField("SDK_INT")));
 //BA.debugLineNum = 432;BA.debugLine="End Sub";
return 0;
}
public int  _getstatus() throws Exception{
 //BA.debugLineNum = 108;BA.debugLine="Public Sub getStatus As Int";
 //BA.debugLineNum = 109;BA.debugLine="Return sStatusCode";
if (true) return _sstatuscode;
 //BA.debugLineNum = 110;BA.debugLine="End Sub";
return 0;
}
public String  _getwebchangelog() throws Exception{
 //BA.debugLineNum = 126;BA.debugLine="Public Sub getWebChangeLog As String";
 //BA.debugLineNum = 127;BA.debugLine="Return webclog";
if (true) return _webclog;
 //BA.debugLineNum = 128;BA.debugLine="End Sub";
return "";
}
public String  _getwebfilesize() throws Exception{
 //BA.debugLineNum = 132;BA.debugLine="Public Sub getWebFileSize As String";
 //BA.debugLineNum = 133;BA.debugLine="Return webfsize";
if (true) return _webfsize;
 //BA.debugLineNum = 134;BA.debugLine="End Sub";
return "";
}
public String  _getwebvn() throws Exception{
 //BA.debugLineNum = 120;BA.debugLine="Public Sub getWebVN As String";
 //BA.debugLineNum = 121;BA.debugLine="Return webver";
if (true) return _webver;
 //BA.debugLineNum = 122;BA.debugLine="End Sub";
return "";
}
public String  _initialize(anywheresoftware.b4a.BA _ba,Object _callbackmodule,String _eventname) throws Exception{
innerInitialize(_ba);
anywheresoftware.b4a.phone.Phone _p = null;
 //BA.debugLineNum = 48;BA.debugLine="Public Sub Initialize(CallbackModule As Object, Ev";
 //BA.debugLineNum = 49;BA.debugLine="Callback = CallbackModule";
_callback = _callbackmodule;
 //BA.debugLineNum = 50;BA.debugLine="Event = EventName";
_event = _eventname;
 //BA.debugLineNum = 51;BA.debugLine="sPackageName = \"\"";
_spackagename = "";
 //BA.debugLineNum = 52;BA.debugLine="sNewVerTxt = \"\"";
_snewvertxt = "";
 //BA.debugLineNum = 53;BA.debugLine="sNewVerApk = \"\"";
_snewverapk = "";
 //BA.debugLineNum = 54;BA.debugLine="sUserName = \"\"";
_susername = "";
 //BA.debugLineNum = 55;BA.debugLine="sUPassword = \"\"";
_supassword = "";
 //BA.debugLineNum = 56;BA.debugLine="sStatusCode = OK_INIT";
_sstatuscode = _ok_init;
 //BA.debugLineNum = 57;BA.debugLine="curver = \"\"";
_curver = "";
 //BA.debugLineNum = 58;BA.debugLine="webver = \"\"";
_webver = "";
 //BA.debugLineNum = 59;BA.debugLine="sVerbose = False";
_sverbose = __c.False;
 //BA.debugLineNum = 60;BA.debugLine="Dim p As Phone";
_p = new anywheresoftware.b4a.phone.Phone();
 //BA.debugLineNum = 61;BA.debugLine="If p.SdkVersion >= 24 Or File.ExternalWritable =";
if (_p.getSdkVersion()>=24 || __c.File.getExternalWritable()==__c.False) { 
 //BA.debugLineNum = 62;BA.debugLine="UseFileProvider = True";
_usefileprovider = __c.True;
 //BA.debugLineNum = 63;BA.debugLine="SharedFolder = File.Combine(File.DirInternal, \"s";
_sharedfolder = __c.File.Combine(__c.File.getDirInternal(),"shared");
 //BA.debugLineNum = 64;BA.debugLine="File.MakeDir(\"\", SharedFolder)";
__c.File.MakeDir("",_sharedfolder);
 }else {
 //BA.debugLineNum = 66;BA.debugLine="UseFileProvider = False";
_usefileprovider = __c.False;
 //BA.debugLineNum = 67;BA.debugLine="SharedFolder = rp.GetSafeDirDefaultExternal(\"sha";
_sharedfolder = _rp.GetSafeDirDefaultExternal("shared");
 };
 //BA.debugLineNum = 69;BA.debugLine="Log($\"SDK#: ${p.SdkVersion} - UseFP: ${UseFilePro";
__c.LogImpl("98781845",("SDK#: "+__c.SmartStringFormatter("",(Object)(_p.getSdkVersion()))+" - UseFP: "+__c.SmartStringFormatter("",(Object)(_usefileprovider))+" - SharedFolder: "+__c.SmartStringFormatter("",(Object)(_sharedfolder))+""),0);
 //BA.debugLineNum = 70;BA.debugLine="End Sub";
return "";
}
public String  _installapk(boolean _pstatus) throws Exception{
 //BA.debugLineNum = 195;BA.debugLine="Public Sub InstallApk(pstatus As Boolean)";
 //BA.debugLineNum = 196;BA.debugLine="LogColor(\"---- AppUpdating.InstallApk\", LogColor1";
__c.LogImpl("99830401","---- AppUpdating.InstallApk",_logcolor1);
 //BA.debugLineNum = 197;BA.debugLine="If pstatus Then";
if (_pstatus) { 
 //BA.debugLineNum = 198;BA.debugLine="SendInstallIntent";
_sendinstallintent();
 //BA.debugLineNum = 199;BA.debugLine="sStatusCode = OK_INSTALL";
_sstatuscode = _ok_install;
 //BA.debugLineNum = 200;BA.debugLine="If sVerbose Then Log(TAB & \"user asked to instal";
if (_sverbose) { 
__c.LogImpl("99830405",__c.TAB+"user asked to install new apk",0);};
 }else {
 //BA.debugLineNum = 202;BA.debugLine="sStatusCode = ERR_NOPERM";
_sstatuscode = _err_noperm;
 //BA.debugLineNum = 203;BA.debugLine="If sVerbose Then Log(TAB & \"no permissions from";
if (_sverbose) { 
__c.LogImpl("99830408",__c.TAB+"no permissions from user to install new apk",0);};
 };
 //BA.debugLineNum = 205;BA.debugLine="Finito";
_finito();
 //BA.debugLineNum = 206;BA.debugLine="End Sub";
return "";
}
public boolean  _isvalidcv() throws Exception{
anywheresoftware.b4a.phone.PackageManagerWrapper _pm = null;
 //BA.debugLineNum = 297;BA.debugLine="Private Sub IsValidCV As Boolean";
 //BA.debugLineNum = 298;BA.debugLine="If sPackageName = \"\" Then";
if ((_spackagename).equals("")) { 
 //BA.debugLineNum = 299;BA.debugLine="curver = \"\"";
_curver = "";
 //BA.debugLineNum = 300;BA.debugLine="sStatusCode = ERR_NOPKG";
_sstatuscode = _err_nopkg;
 //BA.debugLineNum = 301;BA.debugLine="If sVerbose Then Log($\"${TAB}missing package nam";
if (_sverbose) { 
__c.LogImpl("910092548",(""+__c.SmartStringFormatter("",(Object)(__c.TAB))+"missing package name for current version check"),0);};
 }else {
 //BA.debugLineNum = 303;BA.debugLine="Dim pm As PackageManager";
_pm = new anywheresoftware.b4a.phone.PackageManagerWrapper();
 //BA.debugLineNum = 304;BA.debugLine="curver = pm.GetVersionName(sPackageName)";
_curver = _pm.GetVersionName(_spackagename);
 //BA.debugLineNum = 305;BA.debugLine="sStatusCode = OK_CURVER 									'got current ve";
_sstatuscode = _ok_curver;
 //BA.debugLineNum = 306;BA.debugLine="If sVerbose Then Log($\"${TAB}Current Version: ${";
if (_sverbose) { 
__c.LogImpl("910092553",(""+__c.SmartStringFormatter("",(Object)(__c.TAB))+"Current Version: "+__c.SmartStringFormatter("",(Object)(_curver))+""),0);};
 };
 //BA.debugLineNum = 308;BA.debugLine="Return (sStatusCode == OK_CURVER)";
if (true) return (_sstatuscode==_ok_curver);
 //BA.debugLineNum = 309;BA.debugLine="End Sub";
return false;
}
public anywheresoftware.b4a.keywords.Common.ResumableSubWrapper  _isvalidwv() throws Exception{
ResumableSub_IsvalidWV rsub = new ResumableSub_IsvalidWV(this);
rsub.resume(ba, null);
return (anywheresoftware.b4a.keywords.Common.ResumableSubWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.keywords.Common.ResumableSubWrapper(), rsub);
}
public static class ResumableSub_IsvalidWV extends BA.ResumableSub {
public ResumableSub_IsvalidWV(medicomed.keymon.com.mx.cl_appupdate parent) {
this.parent = parent;
}
medicomed.keymon.com.mx.cl_appupdate parent;
medicomed.keymon.com.mx.httpjob _j = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
{
parent.__c.ReturnFromResumableSub(this,null);return;}
case 0:
//C
this.state = 1;
 //BA.debugLineNum = 313;BA.debugLine="Log(\"IsValidComplete start\")";
parent.__c.LogImpl("910158081","IsValidComplete start",0);
 //BA.debugLineNum = 314;BA.debugLine="If sNewVerTxt = \"\" Then";
if (true) break;

case 1:
//if
this.state = 60;
if ((parent._snewvertxt).equals("")) { 
this.state = 3;
}else {
this.state = 11;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 315;BA.debugLine="webver = \"\"";
parent._webver = "";
 //BA.debugLineNum = 316;BA.debugLine="sStatusCode = ERR_NOTXT";
parent._sstatuscode = parent._err_notxt;
 //BA.debugLineNum = 317;BA.debugLine="If sVerbose Then Log($\"${TAB}missing info file f";
if (true) break;

case 4:
//if
this.state = 9;
if (parent._sverbose) { 
this.state = 6;
;}if (true) break;

case 6:
//C
this.state = 9;
parent.__c.LogImpl("910158085",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"missing info file full path indication"),0);
if (true) break;

case 9:
//C
this.state = 60;
;
 if (true) break;

case 11:
//C
this.state = 12;
 //BA.debugLineNum = 320;BA.debugLine="Dim j As HttpJob";
_j = new medicomed.keymon.com.mx.httpjob();
 //BA.debugLineNum = 321;BA.debugLine="j.Initialize(\"\", Me)";
_j._initialize /*String*/ (ba,"",parent);
 //BA.debugLineNum = 322;BA.debugLine="j.Username = sUserName";
_j._username /*String*/  = parent._susername;
 //BA.debugLineNum = 323;BA.debugLine="j.Password = sUPassword";
_j._password /*String*/  = parent._supassword;
 //BA.debugLineNum = 324;BA.debugLine="j.Download(sNewVerTxt)								'ex: jobapk.Downlo";
_j._download /*String*/ (parent._snewvertxt);
 //BA.debugLineNum = 325;BA.debugLine="Log(\"before\")";
parent.__c.LogImpl("910158093","before",0);
 //BA.debugLineNum = 326;BA.debugLine="Wait For (j) JobDone(j As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j));
this.state = 61;
return;
case 61:
//C
this.state = 12;
_j = (medicomed.keymon.com.mx.httpjob) result[0];
;
 //BA.debugLineNum = 327;BA.debugLine="Log(\"after\")";
parent.__c.LogImpl("910158095","after",0);
 //BA.debugLineNum = 328;BA.debugLine="If j.Success Then";
if (true) break;

case 12:
//if
this.state = 59;
if (_j._success /*boolean*/ ) { 
this.state = 14;
}else {
this.state = 52;
}if (true) break;

case 14:
//C
this.state = 15;
 //BA.debugLineNum = 329;BA.debugLine="If sVerbose Then Log($\"Webserver's info file co";
if (true) break;

case 15:
//if
this.state = 20;
if (parent._sverbose) { 
this.state = 17;
;}if (true) break;

case 17:
//C
this.state = 20;
parent.__c.LogImpl("910158097",("Webserver's info file content: "+parent.__c.SmartStringFormatter("",(Object)(parent.__c.CRLF))+""+parent.__c.SmartStringFormatter("",(Object)(_j._getstring /*String*/ ()))+""),0);
if (true) break;

case 20:
//C
this.state = 21;
;
 //BA.debugLineNum = 330;BA.debugLine="If Not(J.GetString.Contains(\"<!DOCTYPE html>\"))";
if (true) break;

case 21:
//if
this.state = 50;
if (parent.__c.Not(_j._getstring /*String*/ ().contains("<!DOCTYPE html>"))) { 
this.state = 23;
}else {
this.state = 43;
}if (true) break;

case 23:
//C
this.state = 24;
 //BA.debugLineNum = 331;BA.debugLine="webver = ExtractVN(J.GetString)";
parent._webver = parent._extractvn(_j._getstring /*String*/ ());
 //BA.debugLineNum = 332;BA.debugLine="webclog = ExtractCL(J.GetString)					'optional";
parent._webclog = parent._extractcl(_j._getstring /*String*/ ());
 //BA.debugLineNum = 333;BA.debugLine="webfsize = ExtractSZ(J.GetString)					'optiona";
parent._webfsize = parent._extractsz(_j._getstring /*String*/ ());
 //BA.debugLineNum = 334;BA.debugLine="If webver = \"\" Then";
if (true) break;

case 24:
//if
this.state = 41;
if ((parent._webver).equals("")) { 
this.state = 26;
}else {
this.state = 34;
}if (true) break;

case 26:
//C
this.state = 27;
 //BA.debugLineNum = 335;BA.debugLine="sStatusCode = ERR_TXTROW";
parent._sstatuscode = parent._err_txtrow;
 //BA.debugLineNum = 336;BA.debugLine="If sVerbose Then Log($\"${TAB}wrong row format";
if (true) break;

case 27:
//if
this.state = 32;
if (parent._sverbose) { 
this.state = 29;
;}if (true) break;

case 29:
//C
this.state = 32;
parent.__c.LogImpl("910158104",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"wrong row format in info file "),0);
if (true) break;

case 32:
//C
this.state = 41;
;
 if (true) break;

case 34:
//C
this.state = 35;
 //BA.debugLineNum = 338;BA.debugLine="sStatusCode = OK_WEBVER							'read apk's ver";
parent._sstatuscode = parent._ok_webver;
 //BA.debugLineNum = 339;BA.debugLine="If sVerbose Then Log($\"${TAB}Web version numb";
if (true) break;

case 35:
//if
this.state = 40;
if (parent._sverbose) { 
this.state = 37;
;}if (true) break;

case 37:
//C
this.state = 40;
parent.__c.LogImpl("910158107",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"Web version number: "+parent.__c.SmartStringFormatter("",(Object)(parent._webver))+""),0);
if (true) break;

case 40:
//C
this.state = 41;
;
 if (true) break;

case 41:
//C
this.state = 50;
;
 if (true) break;

case 43:
//C
this.state = 44;
 //BA.debugLineNum = 342;BA.debugLine="sStatusCode = ERR_HTML								'website returne";
parent._sstatuscode = parent._err_html;
 //BA.debugLineNum = 343;BA.debugLine="If sVerbose Then Log($\"${TAB}ERROR: website re";
if (true) break;

case 44:
//if
this.state = 49;
if (parent._sverbose) { 
this.state = 46;
;}if (true) break;

case 46:
//C
this.state = 49;
parent.__c.LogImpl("910158111",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"ERROR: website returned an HTML error page"),0);
if (true) break;

case 49:
//C
this.state = 50;
;
 if (true) break;

case 50:
//C
this.state = 59;
;
 if (true) break;

case 52:
//C
this.state = 53;
 //BA.debugLineNum = 346;BA.debugLine="Log($\"${TAB}Error: ${J.ErrorMessage}\"$)";
parent.__c.LogImpl("910158114",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"Error: "+parent.__c.SmartStringFormatter("",(Object)(_j._errormessage /*String*/ ))+""),0);
 //BA.debugLineNum = 347;BA.debugLine="sStatusCode = ERR_HTTP";
parent._sstatuscode = parent._err_http;
 //BA.debugLineNum = 348;BA.debugLine="If sVerbose Then Log($\"${TAB}error in httputils";
if (true) break;

case 53:
//if
this.state = 58;
if (parent._sverbose) { 
this.state = 55;
;}if (true) break;

case 55:
//C
this.state = 58;
parent.__c.LogImpl("910158116",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"error in httputils2"),0);
if (true) break;

case 58:
//C
this.state = 59;
;
 //BA.debugLineNum = 349;BA.debugLine="ToastMessageShow(\"Error: \" & J.ErrorMessage, Tr";
parent.__c.ToastMessageShow(BA.ObjectToCharSequence("Error: "+_j._errormessage /*String*/ ),parent.__c.True);
 if (true) break;

case 59:
//C
this.state = 60;
;
 //BA.debugLineNum = 351;BA.debugLine="j.Release";
_j._release /*String*/ ();
 if (true) break;

case 60:
//C
this.state = -1;
;
 //BA.debugLineNum = 353;BA.debugLine="Return (sStatusCode == OK_WEBVER)";
if (true) {
parent.__c.ReturnFromResumableSub(this,(Object)((parent._sstatuscode==parent._ok_webver)));return;};
 //BA.debugLineNum = 354;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public String  _readcurvn() throws Exception{
 //BA.debugLineNum = 143;BA.debugLine="Public Sub ReadCurVN";
 //BA.debugLineNum = 144;BA.debugLine="LogColor(\"---- AppUpdating.ReadCurVN\", LogColor1)";
__c.LogImpl("99633793","---- AppUpdating.ReadCurVN",_logcolor1);
 //BA.debugLineNum = 145;BA.debugLine="IsValidCV											'we don't care about its resu";
_isvalidcv();
 //BA.debugLineNum = 146;BA.debugLine="Finito";
_finito();
 //BA.debugLineNum = 147;BA.debugLine="End Sub";
return "";
}
public void  _readwebvn() throws Exception{
ResumableSub_ReadWebVN rsub = new ResumableSub_ReadWebVN(this);
rsub.resume(ba, null);
}
public static class ResumableSub_ReadWebVN extends BA.ResumableSub {
public ResumableSub_ReadWebVN(medicomed.keymon.com.mx.cl_appupdate parent) {
this.parent = parent;
}
medicomed.keymon.com.mx.cl_appupdate parent;
boolean _okwebver = false;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = -1;
 //BA.debugLineNum = 152;BA.debugLine="LogColor(\"---- AppUpdating.ReadWebVN\", LogColor1)";
parent.__c.LogImpl("99699329","---- AppUpdating.ReadWebVN",parent._logcolor1);
 //BA.debugLineNum = 153;BA.debugLine="Wait For(IsvalidWV) Complete (OkWebVer As Boolean";
parent.__c.WaitFor("complete", ba, this, parent._isvalidwv());
this.state = 1;
return;
case 1:
//C
this.state = -1;
_okwebver = (Boolean) result[0];
;
 //BA.debugLineNum = 154;BA.debugLine="Finito";
parent._finito();
 //BA.debugLineNum = 155;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public void  _complete(boolean _okwebver) throws Exception{
}
public String  _sendinstallintent() throws Exception{
String _apkname = "";
anywheresoftware.b4a.objects.IntentWrapper _i = null;
 //BA.debugLineNum = 487;BA.debugLine="Private Sub SendInstallIntent";
 //BA.debugLineNum = 488;BA.debugLine="Dim ApkName As String = \"tmp.apk\"";
_apkname = "tmp.apk";
 //BA.debugLineNum = 489;BA.debugLine="Dim i As Intent";
_i = new anywheresoftware.b4a.objects.IntentWrapper();
 //BA.debugLineNum = 490;BA.debugLine="If phone.SdkVersion >= 24 Then													'Nouga";
if (_phone.getSdkVersion()>=24) { 
 //BA.debugLineNum = 491;BA.debugLine="i.Initialize(\"android.intent.action.INSTALL_PACK";
_i.Initialize("android.intent.action.INSTALL_PACKAGE",BA.ObjectToString(_getfileuri(_apkname)));
 //BA.debugLineNum = 492;BA.debugLine="i.Flags = Bit.Or(i.Flags, 1) 'FLAG_GRANT_READ_UR";
_i.setFlags(__c.Bit.Or(_i.getFlags(),(int) (1)));
 }else {
 //BA.debugLineNum = 494;BA.debugLine="i.Initialize(i.ACTION_VIEW, \"file://\" & File.Com";
_i.Initialize(_i.ACTION_VIEW,"file://"+__c.File.Combine(_sharedfolder,_apkname));
 //BA.debugLineNum = 495;BA.debugLine="i.SetType(\"application/vnd.android.package-archi";
_i.SetType("application/vnd.android.package-archive");
 };
 //BA.debugLineNum = 497;BA.debugLine="StartActivity(i)";
__c.StartActivity(ba,(Object)(_i.getObject()));
 //BA.debugLineNum = 498;BA.debugLine="End Sub";
return "";
}
public String  _setandstartsplashscreen(anywheresoftware.b4a.objects.ActivityWrapper _callingact,anywheresoftware.b4a.objects.drawable.CanvasWrapper.BitmapWrapper _bm) throws Exception{
anywheresoftware.b4a.objects.drawable.BitmapDrawable _bitimage = null;
 //BA.debugLineNum = 532;BA.debugLine="Public Sub SetAndStartSplashScreen(CallingAct As A";
 //BA.debugLineNum = 533;BA.debugLine="If BM.IsInitialized Then";
if (_bm.IsInitialized()) { 
 //BA.debugLineNum = 534;BA.debugLine="pnlSplash.Initialize(\"pnl1\")";
_pnlsplash.Initialize(ba,"pnl1");
 //BA.debugLineNum = 535;BA.debugLine="pnlSplash.Tag = \"splash\"";
_pnlsplash.setTag((Object)("splash"));
 //BA.debugLineNum = 536;BA.debugLine="Dim BitImage As BitmapDrawable";
_bitimage = new anywheresoftware.b4a.objects.drawable.BitmapDrawable();
 //BA.debugLineNum = 537;BA.debugLine="BitImage.Initialize(BM)";
_bitimage.Initialize((android.graphics.Bitmap)(_bm.getObject()));
 //BA.debugLineNum = 538;BA.debugLine="BitImage.Gravity = Gravity.FILL";
_bitimage.setGravity(__c.Gravity.FILL);
 //BA.debugLineNum = 539;BA.debugLine="CallingAct.AddView(pnlSplash, 0, 0, CallingAct.W";
_callingact.AddView((android.view.View)(_pnlsplash.getObject()),(int) (0),(int) (0),_callingact.getWidth(),_callingact.getHeight());
 //BA.debugLineNum = 540;BA.debugLine="pnlSplash.Background = BitImage";
_pnlsplash.setBackground((android.graphics.drawable.Drawable)(_bitimage.getObject()));
 //BA.debugLineNum = 541;BA.debugLine="pnlSplash.BringToFront";
_pnlsplash.BringToFront();
 //BA.debugLineNum = 542;BA.debugLine="SplashShowing = True";
_splashshowing = __c.True;
 };
 //BA.debugLineNum = 544;BA.debugLine="End Sub";
return "";
}
public String  _setcredentials(String _usern,String _userp) throws Exception{
 //BA.debugLineNum = 96;BA.debugLine="Public Sub setCredentials(UserN As String, UserP A";
 //BA.debugLineNum = 97;BA.debugLine="sUserName = UserN";
_susername = _usern;
 //BA.debugLineNum = 98;BA.debugLine="sUPassword = UserP";
_supassword = _userp;
 //BA.debugLineNum = 99;BA.debugLine="End Sub";
return "";
}
public String  _setfileuriasintentdata(anywheresoftware.b4a.objects.IntentWrapper _intent,String _filename) throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
 //BA.debugLineNum = 520;BA.debugLine="Private Sub SetFileUriAsIntentData (Intent As Inte";
 //BA.debugLineNum = 521;BA.debugLine="Dim jo As JavaObject = Intent";
_jo = new anywheresoftware.b4j.object.JavaObject();
_jo = (anywheresoftware.b4j.object.JavaObject) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4j.object.JavaObject(), (java.lang.Object)(_intent.getObject()));
 //BA.debugLineNum = 522;BA.debugLine="jo.RunMethod(\"setData\", Array(GetFileUri(FileName";
_jo.RunMethod("setData",new Object[]{_getfileuri(_filename)});
 //BA.debugLineNum = 523;BA.debugLine="Intent.Flags = Bit.Or(Intent.Flags, 1) 'FLAG_GRAN";
_intent.setFlags(__c.Bit.Or(_intent.getFlags(),(int) (1)));
 //BA.debugLineNum = 524;BA.debugLine="End Sub";
return "";
}
public String  _setnewverapk(String _nva) throws Exception{
 //BA.debugLineNum = 91;BA.debugLine="Public Sub setNewVerApk(NVA As String)";
 //BA.debugLineNum = 92;BA.debugLine="sNewVerApk = NVA";
_snewverapk = _nva;
 //BA.debugLineNum = 93;BA.debugLine="End Sub";
return "";
}
public String  _setnewvertxt(String _nvt) throws Exception{
 //BA.debugLineNum = 86;BA.debugLine="Public Sub setNewVerTxt(NVT As String)";
 //BA.debugLineNum = 87;BA.debugLine="sNewVerTxt = NVT";
_snewvertxt = _nvt;
 //BA.debugLineNum = 88;BA.debugLine="End Sub";
return "";
}
public String  _setpackagename(String _pn) throws Exception{
 //BA.debugLineNum = 74;BA.debugLine="Public Sub setPackageName(PN As String)";
 //BA.debugLineNum = 75;BA.debugLine="sPackageName = PN";
_spackagename = _pn;
 //BA.debugLineNum = 76;BA.debugLine="End Sub";
return "";
}
public String  _setverbose(boolean _verbose) throws Exception{
 //BA.debugLineNum = 102;BA.debugLine="Public Sub setVerbose(Verbose As Boolean)";
 //BA.debugLineNum = 103;BA.debugLine="sVerbose = Verbose";
_sverbose = _verbose;
 //BA.debugLineNum = 104;BA.debugLine="newinst2.svcVerbose = Verbose";
_newinst2._svcverbose /*boolean*/  = _verbose;
 //BA.debugLineNum = 105;BA.debugLine="End Sub";
return "";
}
public String  _stopsplashscreen() throws Exception{
 //BA.debugLineNum = 547;BA.debugLine="Public Sub StopSplashScreen";
 //BA.debugLineNum = 548;BA.debugLine="If SplashShowing Then";
if (_splashshowing) { 
 //BA.debugLineNum = 549;BA.debugLine="SplashShowing = False";
_splashshowing = __c.False;
 //BA.debugLineNum = 550;BA.debugLine="pnlSplash.RemoveView";
_pnlsplash.RemoveView();
 };
 //BA.debugLineNum = 552;BA.debugLine="End Sub";
return "";
}
public void  _tryapkupdate() throws Exception{
ResumableSub_TryApkUpdate rsub = new ResumableSub_TryApkUpdate(this);
rsub.resume(ba, null);
}
public static class ResumableSub_TryApkUpdate extends BA.ResumableSub {
public ResumableSub_TryApkUpdate(medicomed.keymon.com.mx.cl_appupdate parent) {
this.parent = parent;
}
medicomed.keymon.com.mx.cl_appupdate parent;
medicomed.keymon.com.mx.httpjob _j = null;
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
try {

        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 246;BA.debugLine="LogColor($\"${TAB}-- TryApkUpdate\"$, LogColor1)";
parent.__c.LogImpl("99961473",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"-- TryApkUpdate"),parent._logcolor1);
 //BA.debugLineNum = 248;BA.debugLine="If ((sStatusCode >= 0) And (sStatusCode <> NO_NEW";
if (true) break;

case 1:
//if
this.state = 44;
if (((parent._sstatuscode>=0) && (parent._sstatuscode!=parent._no_newerapk))) { 
this.state = 3;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 250;BA.debugLine="Dim j As HttpJob";
_j = new medicomed.keymon.com.mx.httpjob();
 //BA.debugLineNum = 251;BA.debugLine="j.Initialize(\"\", Me)";
_j._initialize /*String*/ (ba,"",parent);
 //BA.debugLineNum = 252;BA.debugLine="j.Username = sUserName";
_j._username /*String*/  = parent._susername;
 //BA.debugLineNum = 253;BA.debugLine="j.Password = sUPassword";
_j._password /*String*/  = parent._supassword;
 //BA.debugLineNum = 254;BA.debugLine="j.Download(sNewVerApk)								'ex: jobapk.Downlo";
_j._download /*String*/ (parent._snewverapk);
 //BA.debugLineNum = 255;BA.debugLine="Wait For (j) JobDone(j As HttpJob)";
parent.__c.WaitFor("jobdone", ba, this, (Object)(_j));
this.state = 45;
return;
case 45:
//C
this.state = 4;
_j = (medicomed.keymon.com.mx.httpjob) result[0];
;
 //BA.debugLineNum = 256;BA.debugLine="Log($\"Donload ok? ${j.Success}\"$)";
parent.__c.LogImpl("99961483",("Donload ok? "+parent.__c.SmartStringFormatter("",(Object)(_j._success /*boolean*/ ))+""),0);
 //BA.debugLineNum = 257;BA.debugLine="If j.Success Then";
if (true) break;

case 4:
//if
this.state = 33;
if (_j._success /*boolean*/ ) { 
this.state = 6;
}else {
this.state = 26;
}if (true) break;

case 6:
//C
this.state = 7;
 //BA.debugLineNum = 258;BA.debugLine="Try";
if (true) break;

case 7:
//try
this.state = 24;
this.catchState = 17;
this.state = 9;
if (true) break;

case 9:
//C
this.state = 10;
this.catchState = 17;
 //BA.debugLineNum = 260;BA.debugLine="Dim out As OutputStream";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
 //BA.debugLineNum = 261;BA.debugLine="out = File.OpenOutput(SharedFolder,\"tmp.apk\",F";
_out = parent.__c.File.OpenOutput(parent._sharedfolder,"tmp.apk",parent.__c.False);
 //BA.debugLineNum = 262;BA.debugLine="File.Copy2(j.GetInputStream, out)";
parent.__c.File.Copy2((java.io.InputStream)(_j._getinputstream /*anywheresoftware.b4a.objects.streams.File.InputStreamWrapper*/ ().getObject()),(java.io.OutputStream)(_out.getObject()));
 //BA.debugLineNum = 263;BA.debugLine="out.Close";
_out.Close();
 //BA.debugLineNum = 264;BA.debugLine="Log($\"Copy2 (saving) ok? TRUE\"$)";
parent.__c.LogImpl("99961491",("Copy2 (saving) ok? TRUE"),0);
 //BA.debugLineNum = 265;BA.debugLine="sStatusCode = OK_DOWNLOAD";
parent._sstatuscode = parent._ok_download;
 //BA.debugLineNum = 266;BA.debugLine="If sVerbose Then Log($\"${TAB}new apk version d";
if (true) break;

case 10:
//if
this.state = 15;
if (parent._sverbose) { 
this.state = 12;
;}if (true) break;

case 12:
//C
this.state = 15;
parent.__c.LogImpl("99961493",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"new apk version downloaded and ready to install"),0);
if (true) break;

case 15:
//C
this.state = 24;
;
 if (true) break;

case 17:
//C
this.state = 18;
this.catchState = 0;
 //BA.debugLineNum = 268;BA.debugLine="Log($\"Copy2 (saving) ok? FALSE\"$)";
parent.__c.LogImpl("99961495",("Copy2 (saving) ok? FALSE"),0);
 //BA.debugLineNum = 269;BA.debugLine="sStatusCode = ERR_DOWNLOAD";
parent._sstatuscode = parent._err_download;
 //BA.debugLineNum = 270;BA.debugLine="If sVerbose Then Log($\"${TAB}failed download o";
if (true) break;

case 18:
//if
this.state = 23;
if (parent._sverbose) { 
this.state = 20;
;}if (true) break;

case 20:
//C
this.state = 23;
parent.__c.LogImpl("99961497",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"failed download of new apk version"),0);
if (true) break;

case 23:
//C
this.state = 24;
;
 //BA.debugLineNum = 271;BA.debugLine="ToastMessageShow(LastException, True)";
parent.__c.ToastMessageShow(BA.ObjectToCharSequence(parent.__c.LastException(ba).getObject()),parent.__c.True);
 if (true) break;
if (true) break;

case 24:
//C
this.state = 33;
this.catchState = 0;
;
 if (true) break;

case 26:
//C
this.state = 27;
 //BA.debugLineNum = 274;BA.debugLine="Log($\"${TAB}Error: ${J.ErrorMessage}\"$)";
parent.__c.LogImpl("99961501",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"Error: "+parent.__c.SmartStringFormatter("",(Object)(_j._errormessage /*String*/ ))+""),0);
 //BA.debugLineNum = 275;BA.debugLine="sStatusCode = ERR_HTTP";
parent._sstatuscode = parent._err_http;
 //BA.debugLineNum = 276;BA.debugLine="If sVerbose Then Log($\"${TAB}error in httputils";
if (true) break;

case 27:
//if
this.state = 32;
if (parent._sverbose) { 
this.state = 29;
;}if (true) break;

case 29:
//C
this.state = 32;
parent.__c.LogImpl("99961503",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"error in httputils2"),0);
if (true) break;

case 32:
//C
this.state = 33;
;
 //BA.debugLineNum = 277;BA.debugLine="ToastMessageShow($\"Error: ${J.ErrorMessage}\"$,";
parent.__c.ToastMessageShow(BA.ObjectToCharSequence(("Error: "+parent.__c.SmartStringFormatter("",(Object)(_j._errormessage /*String*/ ))+"")),parent.__c.True);
 if (true) break;

case 33:
//C
this.state = 34;
;
 //BA.debugLineNum = 279;BA.debugLine="j.Release";
_j._release /*String*/ ();
 //BA.debugLineNum = 280;BA.debugLine="If sStatusCode == OK_DOWNLOAD Then";
if (true) break;

case 34:
//if
this.state = 43;
if (parent._sstatuscode==parent._ok_download) { 
this.state = 36;
}if (true) break;

case 36:
//C
this.state = 37;
 //BA.debugLineNum = 281;BA.debugLine="SendInstallIntent";
parent._sendinstallintent();
 //BA.debugLineNum = 282;BA.debugLine="sStatusCode = OK_INSTALL";
parent._sstatuscode = parent._ok_install;
 //BA.debugLineNum = 283;BA.debugLine="If sVerbose Then Log($\"${TAB}user asked to inst";
if (true) break;

case 37:
//if
this.state = 42;
if (parent._sverbose) { 
this.state = 39;
;}if (true) break;

case 39:
//C
this.state = 42;
parent.__c.LogImpl("99961510",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"user asked to install new apk"),0);
if (true) break;

case 42:
//C
this.state = 43;
;
 if (true) break;

case 43:
//C
this.state = 44;
;
 if (true) break;

case 44:
//C
this.state = -1;
;
 //BA.debugLineNum = 286;BA.debugLine="Finito";
parent._finito();
 //BA.debugLineNum = 287;BA.debugLine="End Sub";
if (true) break;
}} 
       catch (Exception e0) {
			
if (catchState == 0)
    throw e0;
else {
    state = catchState;
ba.setLastException(e0);}
            }
        }
    }
}
public void  _updateapk(boolean _pstatus) throws Exception{
ResumableSub_UpdateApk rsub = new ResumableSub_UpdateApk(this,_pstatus);
rsub.resume(ba, null);
}
public static class ResumableSub_UpdateApk extends BA.ResumableSub {
public ResumableSub_UpdateApk(medicomed.keymon.com.mx.cl_appupdate parent,boolean _pstatus) {
this.parent = parent;
this._pstatus = _pstatus;
}
medicomed.keymon.com.mx.cl_appupdate parent;
boolean _pstatus;
boolean _okwebver = false;
long _fsize = 0L;

@Override
public void resume(BA ba, Object[] result) throws Exception{

    while (true) {
        switch (state) {
            case -1:
return;

case 0:
//C
this.state = 1;
 //BA.debugLineNum = 211;BA.debugLine="LogColor(\"---- AppUpdating.UpdateApk\", LogColor1)";
parent.__c.LogImpl("99895937","---- AppUpdating.UpdateApk",parent._logcolor1);
 //BA.debugLineNum = 212;BA.debugLine="If Not(pstatus) Then";
if (true) break;

case 1:
//if
this.state = 61;
if (parent.__c.Not(_pstatus)) { 
this.state = 3;
}else {
this.state = 11;
}if (true) break;

case 3:
//C
this.state = 4;
 //BA.debugLineNum = 213;BA.debugLine="sStatusCode = ERR_NOPERM";
parent._sstatuscode = parent._err_noperm;
 //BA.debugLineNum = 214;BA.debugLine="If sVerbose Then Log(TAB & \"no permissions from";
if (true) break;

case 4:
//if
this.state = 9;
if (parent._sverbose) { 
this.state = 6;
;}if (true) break;

case 6:
//C
this.state = 9;
parent.__c.LogImpl("99895940",parent.__c.TAB+"no permissions from user to install new apk",0);
if (true) break;

case 9:
//C
this.state = 61;
;
 if (true) break;

case 11:
//C
this.state = 12;
 //BA.debugLineNum = 216;BA.debugLine="Wait For(IsvalidWV) Complete (OkWebVer As Boolea";
parent.__c.WaitFor("complete", ba, this, parent._isvalidwv());
this.state = 62;
return;
case 62:
//C
this.state = 12;
_okwebver = (Boolean) result[0];
;
 //BA.debugLineNum = 217;BA.debugLine="If (IsValidCV And OkWebVer) Then							'here we";
if (true) break;

case 12:
//if
this.state = 60;
if ((parent._isvalidcv() && _okwebver)) { 
this.state = 14;
}if (true) break;

case 14:
//C
this.state = 15;
 //BA.debugLineNum = 218;BA.debugLine="If curver < webver Then";
if (true) break;

case 15:
//if
this.state = 59;
if ((double)(Double.parseDouble(parent._curver))<(double)(Double.parseDouble(parent._webver))) { 
this.state = 17;
}else {
this.state = 52;
}if (true) break;

case 17:
//C
this.state = 18;
 //BA.debugLineNum = 220;BA.debugLine="If IsNumber(webfsize) Then";
if (true) break;

case 18:
//if
this.state = 31;
if (parent.__c.IsNumber(parent._webfsize)) { 
this.state = 20;
}if (true) break;

case 20:
//C
this.state = 21;
 //BA.debugLineNum = 221;BA.debugLine="Dim fsize As Long = webfsize";
_fsize = (long)(Double.parseDouble(parent._webfsize));
 //BA.debugLineNum = 222;BA.debugLine="If fsize*2 > GetFreeSpace Then";
if (true) break;

case 21:
//if
this.state = 30;
if (_fsize*2>parent._getfreespace()) { 
this.state = 23;
}if (true) break;

case 23:
//C
this.state = 24;
 //BA.debugLineNum = 223;BA.debugLine="sStatusCode = ERR_NOSPACE";
parent._sstatuscode = parent._err_nospace;
 //BA.debugLineNum = 224;BA.debugLine="If sVerbose Then Log($\"${TAB}no enough avail";
if (true) break;

case 24:
//if
this.state = 29;
if (parent._sverbose) { 
this.state = 26;
;}if (true) break;

case 26:
//C
this.state = 29;
parent.__c.LogImpl("99895950",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"no enough available space to download apk"),0);
if (true) break;

case 29:
//C
this.state = 30;
;
 if (true) break;

case 30:
//C
this.state = 31;
;
 if (true) break;
;
 //BA.debugLineNum = 227;BA.debugLine="If sStatusCode >= 0 Then";

case 31:
//if
this.state = 50;
if (parent._sstatuscode>=0) { 
this.state = 33;
}if (true) break;

case 33:
//C
this.state = 34;
 //BA.debugLineNum = 228;BA.debugLine="sStatusCode = OK_NEWERAPK			'info file tells";
parent._sstatuscode = parent._ok_newerapk;
 //BA.debugLineNum = 229;BA.debugLine="If sVerbose Then Log($\"${TAB}Newer version av";
if (true) break;

case 34:
//if
this.state = 39;
if (parent._sverbose) { 
this.state = 36;
;}if (true) break;

case 36:
//C
this.state = 39;
parent.__c.LogImpl("99895955",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"Newer version available. Now I try its downloading"),0);
if (true) break;

case 39:
//C
this.state = 40;
;
 //BA.debugLineNum = 230;BA.debugLine="If sNewVerApk = \"\" Then";
if (true) break;

case 40:
//if
this.state = 49;
if ((parent._snewverapk).equals("")) { 
this.state = 42;
}if (true) break;

case 42:
//C
this.state = 43;
 //BA.debugLineNum = 231;BA.debugLine="sStatusCode = ERR_NOAPK";
parent._sstatuscode = parent._err_noapk;
 //BA.debugLineNum = 232;BA.debugLine="If sVerbose Then Log($\"${TAB}missing apk fil";
if (true) break;

case 43:
//if
this.state = 48;
if (parent._sverbose) { 
this.state = 45;
;}if (true) break;

case 45:
//C
this.state = 48;
parent.__c.LogImpl("99895958",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"missing apk file full path indication"),0);
if (true) break;

case 48:
//C
this.state = 49;
;
 if (true) break;

case 49:
//C
this.state = 50;
;
 if (true) break;

case 50:
//C
this.state = 59;
;
 if (true) break;

case 52:
//C
this.state = 53;
 //BA.debugLineNum = 236;BA.debugLine="sStatusCode = NO_NEWERAPK";
parent._sstatuscode = parent._no_newerapk;
 //BA.debugLineNum = 237;BA.debugLine="If sVerbose Then Log($\"${TAB}No newer version";
if (true) break;

case 53:
//if
this.state = 58;
if (parent._sverbose) { 
this.state = 55;
;}if (true) break;

case 55:
//C
this.state = 58;
parent.__c.LogImpl("99895963",(""+parent.__c.SmartStringFormatter("",(Object)(parent.__c.TAB))+"No newer version available on webserver."),0);
if (true) break;

case 58:
//C
this.state = 59;
;
 if (true) break;

case 59:
//C
this.state = 60;
;
 if (true) break;

case 60:
//C
this.state = 61;
;
 if (true) break;

case 61:
//C
this.state = -1;
;
 //BA.debugLineNum = 241;BA.debugLine="TryApkUpdate						'if available and permitted, do";
parent._tryapkupdate();
 //BA.debugLineNum = 242;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public Object callSub(String sub, Object sender, Object[] args) throws Exception {
BA.senderHolder.set(sender);
return BA.SubDelegator.SubNotFound;
}
}
