package gunav2.keymon.com.mx;


import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.objects.ServiceHelper;
import anywheresoftware.b4a.debug.*;

public class starter extends android.app.Service{
	public static class starter_BR extends android.content.BroadcastReceiver {

		@Override
		public void onReceive(android.content.Context context, android.content.Intent intent) {
            BA.LogInfo("** Receiver (starter) OnReceive **");
			android.content.Intent in = new android.content.Intent(context, starter.class);
			if (intent != null)
				in.putExtra("b4a_internal_intent", intent);
            ServiceHelper.StarterHelper.startServiceFromReceiver (context, in, true, BA.class);
		}

	}
    static starter mostCurrent;
	public static BA processBA;
    private ServiceHelper _service;
    public static Class<?> getObject() {
		return starter.class;
	}
	@Override
	public void onCreate() {
        super.onCreate();
        mostCurrent = this;
        if (processBA == null) {
		    processBA = new BA(this, null, null, "gunav2.keymon.com.mx", "gunav2.keymon.com.mx.starter");
            if (BA.isShellModeRuntimeCheck(processBA)) {
                processBA.raiseEvent2(null, true, "SHELL", false);
		    }
            try {
                Class.forName(BA.applicationContext.getPackageName() + ".main").getMethod("initializeProcessGlobals").invoke(null, null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            processBA.loadHtSubs(this.getClass());
            ServiceHelper.init();
        }
        _service = new ServiceHelper(this);
        processBA.service = this;
        
        if (BA.isShellModeRuntimeCheck(processBA)) {
			processBA.raiseEvent2(null, true, "CREATE", true, "gunav2.keymon.com.mx.starter", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
		}
        if (!true && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
				
		}
		else {
            processBA.setActivityPaused(false);
            BA.LogInfo("*** Service (starter) Create ***");
            processBA.raiseEvent(null, "service_create");
        }
        processBA.runHook("oncreate", this, null);
        if (true) {
			if (ServiceHelper.StarterHelper.runWaitForLayouts() == false) {
                BA.LogInfo("stopping spontaneous created service");
                stopSelf();
            }
		}
    }
		@Override
	public void onStart(android.content.Intent intent, int startId) {
		onStartCommand(intent, 0, 0);
    }
    @Override
    public int onStartCommand(final android.content.Intent intent, int flags, int startId) {
    	if (ServiceHelper.StarterHelper.onStartCommand(processBA, new Runnable() {
            public void run() {
                handleStart(intent);
            }}))
			;
		else {
			ServiceHelper.StarterHelper.addWaitForLayout (new Runnable() {
				public void run() {
                    processBA.setActivityPaused(false);
                    BA.LogInfo("** Service (starter) Create **");
                    processBA.raiseEvent(null, "service_create");
					handleStart(intent);
                    ServiceHelper.StarterHelper.removeWaitForLayout();
				}
			});
		}
        processBA.runHook("onstartcommand", this, new Object[] {intent, flags, startId});
		return android.app.Service.START_NOT_STICKY;
    }
    public void onTaskRemoved(android.content.Intent rootIntent) {
        super.onTaskRemoved(rootIntent);
        if (true)
            processBA.raiseEvent(null, "service_taskremoved");
            
    }
    private void handleStart(android.content.Intent intent) {
    	BA.LogInfo("** Service (starter) Start **");
    	java.lang.reflect.Method startEvent = processBA.htSubs.get("service_start");
    	if (startEvent != null) {
    		if (startEvent.getParameterTypes().length > 0) {
    			anywheresoftware.b4a.objects.IntentWrapper iw = ServiceHelper.StarterHelper.handleStartIntent(intent, _service, processBA);
    			processBA.raiseEvent(null, "service_start", iw);
    		}
    		else {
    			processBA.raiseEvent(null, "service_start");
    		}
    	}
    }
	
	@Override
	public void onDestroy() {
        super.onDestroy();
        if (true) {
            BA.LogInfo("** Service (starter) Destroy (ignored)**");
        }
        else {
            BA.LogInfo("** Service (starter) Destroy **");
		    processBA.raiseEvent(null, "service_destroy");
            processBA.service = null;
		    mostCurrent = null;
		    processBA.setActivityPaused(true);
            processBA.runHook("ondestroy", this, null);
        }
	}

@Override
	public android.os.IBinder onBind(android.content.Intent intent) {
		return null;
	}public anywheresoftware.b4a.keywords.Common __c = null;
public static anywheresoftware.b4a.gps.GPS _gps = null;
public static anywheresoftware.b4a.phone.Phone _ph = null;
public static anywheresoftware.b4a.sql.SQL _skmt = null;
public static anywheresoftware.b4a.objects.RuntimePermissions _rp = null;
public static uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper _flp = null;
public static gunav2.keymon.com.mx.dbrequestmanager _reqmanager = null;
public static String _server = "";
public static anywheresoftware.b4a.objects.Timer _timer1 = null;
public static int _interval = 0;
public static String _ruta = "";
public static anywheresoftware.b4a.keywords.StringBuilderWrapper _logs = null;
public static anywheresoftware.b4a.phone.Phone.LogCat _logcat = null;
public static boolean _logger = false;
public static String _marcacel = "";
public static anywheresoftware.b4a.objects.Serial.BluetoothAdmin _btadmin = null;
public static String _mac_impresora = "";
public static boolean _bluetoothstate = false;
public static anywheresoftware.b4a.gps.LocationWrapper _ubicacionactual = null;
public static boolean _enventa = false;
public static String _muestraprogreso = "";
public static gunav2.keymon.com.mx.appupdater._mnewversion _newapp = null;
public static String _nuevolink = "";
public static String _idcliente = "";
public static String _encuesta = "";
public static gunav2.keymon.com.mx.fileprovider _ffileprovider = null;
public static String _tabla = "";
public static boolean _encliente = false;
public b4a.example.dateutils _dateutils = null;
public gunav2.keymon.com.mx.main _main = null;
public gunav2.keymon.com.mx.subs _subs = null;
public gunav2.keymon.com.mx.mapa_rutas _mapa_rutas = null;
public gunav2.keymon.com.mx.appupdater _appupdater = null;
public gunav2.keymon.com.mx.firebasemessaging _firebasemessaging = null;
public gunav2.keymon.com.mx.tracker _tracker = null;
public gunav2.keymon.com.mx.newinst2 _newinst2 = null;
public gunav2.keymon.com.mx.b4xpages _b4xpages = null;
public gunav2.keymon.com.mx.b4xcollections _b4xcollections = null;
public gunav2.keymon.com.mx.httputils2service _httputils2service = null;
public gunav2.keymon.com.mx.xuiviewsutils _xuiviewsutils = null;
public static boolean  _application_error(anywheresoftware.b4a.objects.B4AException _error,String _stacktrace) throws Exception{
anywheresoftware.b4j.object.JavaObject _jo = null;
long _l = 0L;
 //BA.debugLineNum = 149;BA.debugLine="Sub Application_Error (Error As Exception, StackTr";
 //BA.debugLineNum = 151;BA.debugLine="Dim jo As JavaObject";
_jo = new anywheresoftware.b4j.object.JavaObject();
 //BA.debugLineNum = 152;BA.debugLine="Dim l As Long = 500: jo.InitializeStatic(\"java.la";
_l = (long) (500);
 //BA.debugLineNum = 152;BA.debugLine="Dim l As Long = 500: jo.InitializeStatic(\"java.la";
_jo.InitializeStatic("java.lang.Thread").RunMethod("sleep",new Object[]{(Object)(_l)});
 //BA.debugLineNum = 153;BA.debugLine="logcat.LogCatStop";
_logcat.LogCatStop();
 //BA.debugLineNum = 154;BA.debugLine="logs.Append(StackTrace)";
_logs.Append(_stacktrace);
 //BA.debugLineNum = 155;BA.debugLine="Subs.revisaBD";
mostCurrent._subs._revisabd /*String*/ (processBA);
 //BA.debugLineNum = 156;BA.debugLine="Subs.errorLog.ExecNonQuery2(\"INSERT INTO errores(";
mostCurrent._subs._errorlog /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO errores(fecha, error) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(mostCurrent._subs._fechakmt /*String*/ (processBA,BA.NumberToString(anywheresoftware.b4a.keywords.Common.DateTime.getNow()))),(Object)(_logs.getObject())}));
 //BA.debugLineNum = 157;BA.debugLine="Return True";
if (true) return anywheresoftware.b4a.keywords.Common.True;
 //BA.debugLineNum = 158;BA.debugLine="End Sub";
return false;
}
public static String  _btadmin_statechanged(int _newstate,int _oldstate) throws Exception{
 //BA.debugLineNum = 63;BA.debugLine="Private Sub BTAdmin_StateChanged (NewState As Int,";
 //BA.debugLineNum = 64;BA.debugLine="If logger Then Log(\"BT state changed: \" & NewStat";
if (_logger) { 
anywheresoftware.b4a.keywords.Common.LogImpl("4720897","BT state changed: "+BA.NumberToString(_newstate),0);};
 //BA.debugLineNum = 65;BA.debugLine="BluetoothState = NewState = BTAdmin.STATE_ON";
_bluetoothstate = _newstate==_btadmin.STATE_ON;
 //BA.debugLineNum = 67;BA.debugLine="End Sub";
return "";
}
public static String  _envia_ultima_gps() throws Exception{
gunav2.keymon.com.mx.dbrequestmanager._dbcommand _cmd = null;
anywheresoftware.b4a.sql.SQL.CursorWrapper _s7 = null;
int _totalstick = 0;
int _sfsdf = 0;
anywheresoftware.b4a.sql.SQL.CursorWrapper _s8 = null;
int _totalpaquete = 0;
 //BA.debugLineNum = 101;BA.debugLine="Sub ENVIA_ULTIMA_GPS";
 //BA.debugLineNum = 102;BA.debugLine="LogColor(\"Iniciamos ENVIA_ULTIMA_GPS\", Colors.Mag";
anywheresoftware.b4a.keywords.Common.LogImpl("41114113","Iniciamos ENVIA_ULTIMA_GPS",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
 //BA.debugLineNum = 103;BA.debugLine="Dim skmt As SQL";
_skmt = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 104;BA.debugLine="Dim cmd As DBCommand";
_cmd = new gunav2.keymon.com.mx.dbrequestmanager._dbcommand();
 //BA.debugLineNum = 105;BA.debugLine="skmt.Initialize(ruta,\"kmt.db\", True)";
_skmt.Initialize(_ruta,"kmt.db",anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 109;BA.debugLine="Dim cmd As DBCommand";
_cmd = new gunav2.keymon.com.mx.dbrequestmanager._dbcommand();
 //BA.debugLineNum = 110;BA.debugLine="cmd.Initialize";
_cmd.Initialize();
 //BA.debugLineNum = 111;BA.debugLine="cmd.Name = \"UPDATE_GUNA_ACTUAL2_GPS2\"";
_cmd.Name /*String*/  = "UPDATE_GUNA_ACTUAL2_GPS2";
 //BA.debugLineNum = 112;BA.debugLine="Private s7 As Cursor = B4XPages.MainPage.skmt.Exe";
_s7 = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_s7 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery("select SUM(PE_CANT) AS PE_CANT, PE_PROID FROM PEDIDO WHERE PE_PROID IN (SELECT CAT_GP_ID FROM CAT_GUNAPROD WHERE CAT_GP_TIPO = 'CIGARRO') GROUP BY PE_PROID")));
 //BA.debugLineNum = 113;BA.debugLine="If s7.RowCount > 0 Then";
if (_s7.getRowCount()>0) { 
 //BA.debugLineNum = 114;BA.debugLine="Dim totalstick As Int = 0";
_totalstick = (int) (0);
 //BA.debugLineNum = 115;BA.debugLine="For sfsdf = 0 To s7.RowCount -1";
{
final int step11 = 1;
final int limit11 = (int) (_s7.getRowCount()-1);
_sfsdf = (int) (0) ;
for (;_sfsdf <= limit11 ;_sfsdf = _sfsdf + step11 ) {
 //BA.debugLineNum = 116;BA.debugLine="s7.Position= sfsdf";
_s7.setPosition(_sfsdf);
 //BA.debugLineNum = 117;BA.debugLine="Log(\"ENTRE AQUI\")";
anywheresoftware.b4a.keywords.Common.LogImpl("41114128","ENTRE AQUI",0);
 //BA.debugLineNum = 118;BA.debugLine="Dim s8 As Cursor = B4XPages.MainPage.skmt.ExecQ";
_s8 = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_s8 = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecQuery(("SELECT ifnull(CAT_GP_CONVERSION3,0) as CAT_GP_CONVERSION3 FROM CAT_GUNAPROD WHERE CAT_GP_ID = '"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_s7.GetString("PE_PROID")))+"'"))));
 //BA.debugLineNum = 119;BA.debugLine="s8.Position = 0";
_s8.setPosition((int) (0));
 //BA.debugLineNum = 120;BA.debugLine="totalstick = totalstick + (s7.GetString(\"PE_CAN";
_totalstick = (int) (_totalstick+((double)(Double.parseDouble(_s7.GetString("PE_CANT")))*(double)(Double.parseDouble(_s8.GetString("CAT_GP_CONVERSION3")))));
 //BA.debugLineNum = 121;BA.debugLine="Dim totalpaquete As Int = 0";
_totalpaquete = (int) (0);
 //BA.debugLineNum = 123;BA.debugLine="totalpaquete = totalpaquete +(totalstick/200)";
_totalpaquete = (int) (_totalpaquete+(_totalstick/(double)200));
 //BA.debugLineNum = 124;BA.debugLine="Log(totalpaquete)";
anywheresoftware.b4a.keywords.Common.LogImpl("41114135",BA.NumberToString(_totalpaquete),0);
 }
};
 };
 //BA.debugLineNum = 130;BA.debugLine="cmd.Parameters = Array As Object(NumberFormat2(B4";
_cmd.Parameters /*Object[]*/  = new Object[]{(Object)(anywheresoftware.b4a.keywords.Common.NumberFormat2((double)(Double.parseDouble(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._montoactual /*String*/ )),(int) (0),(int) (2),(int) (2),anywheresoftware.b4a.keywords.Common.False)),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._clientestotal /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._clientesventa /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._clientesvisitados /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._lat_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._lon_gps /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._batt /*int*/ ),(Object)(0),(Object)(_totalpaquete),(Object)(_totalstick),(Object)(_encuesta),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._almacen /*String*/ ),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._rutapreventa /*String*/ )};
 //BA.debugLineNum = 132;BA.debugLine="reqManager.ExecuteCommand(cmd, \"actualizaUltimaGP";
_reqmanager._executecommand /*String*/ (_cmd,(Object)("actualizaUltimaGPS"));
 //BA.debugLineNum = 133;BA.debugLine="skmt.ExecNonQuery2(\"Update cat_variables set CAT_";
_skmt.ExecNonQuery2("Update cat_variables set CAT_VA_VALOR = ?  WHERE CAT_VA_DESCRIPCION = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new String[]{anywheresoftware.b4a.keywords.Common.DateTime.Time(anywheresoftware.b4a.keywords.Common.DateTime.getNow()),"HoraIngreso"}));
 //BA.debugLineNum = 135;BA.debugLine="Timer1.Enabled = False";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.False);
 //BA.debugLineNum = 136;BA.debugLine="Timer1.Interval = Interval * 1000";
_timer1.setInterval((long) (_interval*1000));
 //BA.debugLineNum = 137;BA.debugLine="Timer1.Enabled = True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 138;BA.debugLine="End Sub";
return "";
}
public static String  _gps_locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
 //BA.debugLineNum = 89;BA.debugLine="Sub GPS_LocationChanged (Location1 As Location)";
 //BA.debugLineNum = 91;BA.debugLine="End Sub";
return "";
}
public static String  _jobdone(gunav2.keymon.com.mx.httpjob _job) throws Exception{
gunav2.keymon.com.mx.dbrequestmanager._dbresult _result = null;
 //BA.debugLineNum = 160;BA.debugLine="Sub JobDone(Job As HttpJob)";
 //BA.debugLineNum = 161;BA.debugLine="Log(\"JOBDONE STARTER\")";
anywheresoftware.b4a.keywords.Common.LogImpl("41310721","JOBDONE STARTER",0);
 //BA.debugLineNum = 163;BA.debugLine="If Job.Success = False Then ' Si hay unerror en e";
if (_job._success /*boolean*/ ==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 165;BA.debugLine="LogColor(\"Error: \" & Job.ErrorMessage, Colors.re";
anywheresoftware.b4a.keywords.Common.LogImpl("41310725","Error: "+_job._errormessage /*String*/ ,anywheresoftware.b4a.keywords.Common.Colors.Red);
 }else {
 //BA.debugLineNum = 167;BA.debugLine="If Job.JobName = \"DBRequest\" Then";
if ((_job._jobname /*String*/ ).equals("DBRequest")) { 
 //BA.debugLineNum = 168;BA.debugLine="Dim RESULT As DBResult = B4XPages.MainPage.reqM";
_result = mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._reqmanager /*gunav2.keymon.com.mx.dbrequestmanager*/ ._handlejob /*gunav2.keymon.com.mx.dbrequestmanager._dbresult*/ (_job);
 //BA.debugLineNum = 169;BA.debugLine="Log($\"Tag: ${RESULT.tag}, success=${Job.Success";
anywheresoftware.b4a.keywords.Common.LogImpl("41310729",("Tag: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",_result.Tag /*Object*/ )+", success="+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_job._success /*boolean*/ ))+""),0);
 };
 };
 //BA.debugLineNum = 173;BA.debugLine="End Sub";
return "";
}
public static String  _logcat_logcatdata(byte[] _buffer,int _length) throws Exception{
 //BA.debugLineNum = 141;BA.debugLine="Private Sub logcat_LogCatData (Buffer() As Byte, L";
 //BA.debugLineNum = 142;BA.debugLine="logs.Append(BytesToString(Buffer, 0, Length, \"utf";
_logs.Append(anywheresoftware.b4a.keywords.Common.BytesToString(_buffer,(int) (0),_length,"utf8"));
 //BA.debugLineNum = 143;BA.debugLine="If logs.Length > 4000 Then";
if (_logs.getLength()>4000) { 
 //BA.debugLineNum = 144;BA.debugLine="logs.Remove(0, logs.Length - 2000) 'Obtenemos lo";
_logs.Remove((int) (0),(int) (_logs.getLength()-2000));
 };
 //BA.debugLineNum = 146;BA.debugLine="End Sub";
return "";
}
public static String  _process_globals() throws Exception{
 //BA.debugLineNum = 6;BA.debugLine="Sub Process_Globals";
 //BA.debugLineNum = 9;BA.debugLine="Public gps As GPS";
_gps = new anywheresoftware.b4a.gps.GPS();
 //BA.debugLineNum = 10;BA.debugLine="Dim ph As Phone";
_ph = new anywheresoftware.b4a.phone.Phone();
 //BA.debugLineNum = 11;BA.debugLine="Dim skmt As SQL";
_skmt = new anywheresoftware.b4a.sql.SQL();
 //BA.debugLineNum = 12;BA.debugLine="Public rp As RuntimePermissions";
_rp = new anywheresoftware.b4a.objects.RuntimePermissions();
 //BA.debugLineNum = 13;BA.debugLine="Public FLP As FusedLocationProvider";
_flp = new uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper();
 //BA.debugLineNum = 15;BA.debugLine="Dim reqManager As DBRequestManager";
_reqmanager = new gunav2.keymon.com.mx.dbrequestmanager();
 //BA.debugLineNum = 16;BA.debugLine="Dim server As String = \"http://keymon.net:1782\"";
_server = "http://keymon.net:1782";
 //BA.debugLineNum = 18;BA.debugLine="Dim Timer1 As Timer";
_timer1 = new anywheresoftware.b4a.objects.Timer();
 //BA.debugLineNum = 19;BA.debugLine="Dim Interval As Int = 300";
_interval = (int) (300);
 //BA.debugLineNum = 20;BA.debugLine="Dim ruta As String = File.DirInternal";
_ruta = anywheresoftware.b4a.keywords.Common.File.getDirInternal();
 //BA.debugLineNum = 22;BA.debugLine="Private logs As StringBuilder";
_logs = new anywheresoftware.b4a.keywords.StringBuilderWrapper();
 //BA.debugLineNum = 23;BA.debugLine="Private logcat As LogCat";
_logcat = new anywheresoftware.b4a.phone.Phone.LogCat();
 //BA.debugLineNum = 24;BA.debugLine="Dim logger As Boolean = False";
_logger = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 25;BA.debugLine="Dim marcaCel As String = ph.manufacturer";
_marcacel = _ph.getManufacturer();
 //BA.debugLineNum = 26;BA.debugLine="Private BTAdmin As BluetoothAdmin";
_btadmin = new anywheresoftware.b4a.objects.Serial.BluetoothAdmin();
 //BA.debugLineNum = 27;BA.debugLine="Dim MAC_IMPRESORA As String";
_mac_impresora = "";
 //BA.debugLineNum = 28;BA.debugLine="Public BluetoothState As Boolean";
_bluetoothstate = false;
 //BA.debugLineNum = 29;BA.debugLine="Dim ubicacionActual As Location";
_ubicacionactual = new anywheresoftware.b4a.gps.LocationWrapper();
 //BA.debugLineNum = 30;BA.debugLine="Dim enVenta As Boolean = False";
_enventa = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 31;BA.debugLine="Dim muestraProgreso = 0 'Parte de la funcionalida";
_muestraprogreso = BA.NumberToString(0);
 //BA.debugLineNum = 32;BA.debugLine="Public newApp As mNewVersion 'Parte de la funcion";
_newapp = new gunav2.keymon.com.mx.appupdater._mnewversion();
 //BA.debugLineNum = 33;BA.debugLine="Dim nuevoLink As String";
_nuevolink = "";
 //BA.debugLineNum = 34;BA.debugLine="Dim idCliente As String = \"\"";
_idcliente = "";
 //BA.debugLineNum = 35;BA.debugLine="Dim encuesta As String = 0";
_encuesta = BA.NumberToString(0);
 //BA.debugLineNum = 36;BA.debugLine="Public fFileProvider As FileProvider";
_ffileprovider = new gunav2.keymon.com.mx.fileprovider();
 //BA.debugLineNum = 37;BA.debugLine="Dim tabla As String";
_tabla = "";
 //BA.debugLineNum = 38;BA.debugLine="Dim enCliente As Boolean = False";
_encliente = anywheresoftware.b4a.keywords.Common.False;
 //BA.debugLineNum = 39;BA.debugLine="End Sub";
return "";
}
public static String  _service_create() throws Exception{
 //BA.debugLineNum = 41;BA.debugLine="Sub Service_Create";
 //BA.debugLineNum = 44;BA.debugLine="gps.Initialize(\"GPS\")";
_gps.Initialize("GPS");
 //BA.debugLineNum = 45;BA.debugLine="CallSubDelayed(FirebaseMessaging, \"SubscribeToTop";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(mostCurrent._firebasemessaging.getObject()),"SubscribeToTopics");
 //BA.debugLineNum = 46;BA.debugLine="BTAdmin.Initialize(\"admin\")";
_btadmin.Initialize(processBA,"admin");
 //BA.debugLineNum = 47;BA.debugLine="Timer1.Initialize(\"Timer1\", Interval * 1000)";
_timer1.Initialize(processBA,"Timer1",(long) (_interval*1000));
 //BA.debugLineNum = 48;BA.debugLine="Timer1.Enabled = True";
_timer1.setEnabled(anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 51;BA.debugLine="logcat.LogCatStart(Array As String(\"-v\",\"raw\",\"*:";
_logcat.LogCatStart(processBA,new String[]{"-v","raw","*:F","B4A:v"},"logcat");
 //BA.debugLineNum = 53;BA.debugLine="logs.Initialize";
_logs.Initialize();
 //BA.debugLineNum = 54;BA.debugLine="fFileProvider.Initialize";
_ffileprovider._initialize /*String*/ (processBA);
 //BA.debugLineNum = 55;BA.debugLine="CallSubDelayed(FirebaseMessaging, \"SubscribeToTop";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(mostCurrent._firebasemessaging.getObject()),"SubscribeToTopics");
 //BA.debugLineNum = 56;BA.debugLine="ubicacionActual.Initialize";
_ubicacionactual.Initialize();
 //BA.debugLineNum = 57;BA.debugLine="If File.Exists(File.DirInternal, \"kmt.db\") = Fals";
if (anywheresoftware.b4a.keywords.Common.File.Exists(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db")==anywheresoftware.b4a.keywords.Common.False) { 
 //BA.debugLineNum = 58;BA.debugLine="File.Copy(File.DirAssets, \"kmt.db\", File.DirInte";
anywheresoftware.b4a.keywords.Common.File.Copy(anywheresoftware.b4a.keywords.Common.File.getDirAssets(),"kmt.db",anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db");
 };
 //BA.debugLineNum = 60;BA.debugLine="skmt.Initialize(File.DirInternal,\"kmt.db\", True)";
_skmt.Initialize(anywheresoftware.b4a.keywords.Common.File.getDirInternal(),"kmt.db",anywheresoftware.b4a.keywords.Common.True);
 //BA.debugLineNum = 61;BA.debugLine="End Sub";
return "";
}
public static String  _service_destroy() throws Exception{
 //BA.debugLineNum = 97;BA.debugLine="Sub Service_Destroy";
 //BA.debugLineNum = 99;BA.debugLine="End Sub";
return "";
}
public static String  _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
anywheresoftware.b4a.sql.SQL.CursorWrapper _s = null;
 //BA.debugLineNum = 69;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
 //BA.debugLineNum = 70;BA.debugLine="Service.StopAutomaticForeground 'Starter service";
mostCurrent._service.StopAutomaticForeground();
 //BA.debugLineNum = 71;BA.debugLine="Subs.revisaBD";
mostCurrent._subs._revisabd /*String*/ (processBA);
 //BA.debugLineNum = 72;BA.debugLine="Log(marcaCel)";
anywheresoftware.b4a.keywords.Common.LogImpl("4786435",_marcacel,0);
 //BA.debugLineNum = 73;BA.debugLine="Private s As Cursor = skmt.ExecQuery(\"select * fr";
_s = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
_s = (anywheresoftware.b4a.sql.SQL.CursorWrapper) anywheresoftware.b4a.AbsObjectWrapper.ConvertToWrapper(new anywheresoftware.b4a.sql.SQL.CursorWrapper(), (android.database.Cursor)(_skmt.ExecQuery("select * from cat_variables where cat_va_descripcion = 'DBReqServer'")));
 //BA.debugLineNum = 74;BA.debugLine="If s.RowCount > 0 Then 'Si tenemso valor en BD lo";
if (_s.getRowCount()>0) { 
 //BA.debugLineNum = 75;BA.debugLine="s.Position = 0";
_s.setPosition((int) (0));
 //BA.debugLineNum = 76;BA.debugLine="server = s.GetString(\"CAT_VA_VALOR\")";
_server = _s.GetString("CAT_VA_VALOR");
 }else {
 //BA.debugLineNum = 78;BA.debugLine="skmt.ExecNonQuery2(\"delete from CAT_VARIABLES wh";
_skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("DBReqServer")}));
 //BA.debugLineNum = 79;BA.debugLine="skmt.ExecNonQuery2(\"INSERT INTO CAT_VARIABLES(CA";
_skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)("DBReqServer"),(Object)(_server)}));
 };
 //BA.debugLineNum = 81;BA.debugLine="reqManager.Initialize(Me, server)";
_reqmanager._initialize /*String*/ (processBA,starter.getObject(),_server);
 //BA.debugLineNum = 82;BA.debugLine="End Sub";
return "";
}
public static String  _service_taskremoved() throws Exception{
 //BA.debugLineNum = 93;BA.debugLine="Sub Service_TaskRemoved";
 //BA.debugLineNum = 95;BA.debugLine="End Sub";
return "";
}
public static String  _timer1_tick() throws Exception{
 //BA.debugLineNum = 84;BA.debugLine="Private Sub Timer1_Tick";
 //BA.debugLineNum = 86;BA.debugLine="ENVIA_ULTIMA_GPS";
_envia_ultima_gps();
 //BA.debugLineNum = 87;BA.debugLine="End Sub";
return "";
}
}
