package gunav2.keymon.com.mx;


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

public class tracker extends android.app.Service{
	public static class tracker_BR extends android.content.BroadcastReceiver {

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

	}
    static tracker mostCurrent;
	public static BA processBA;
    private ServiceHelper _service;
    public static Class<?> getObject() {
		return tracker.class;
	}
	@Override
	public void onCreate() {
        super.onCreate();
        mostCurrent = this;
        if (processBA == null) {
		    processBA = new anywheresoftware.b4a.ShellBA(this, null, null, "gunav2.keymon.com.mx", "gunav2.keymon.com.mx.tracker");
            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.tracker", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
		}
        if (!false && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
				
		}
		else {
            processBA.setActivityPaused(false);
            BA.LogInfo("*** Service (tracker) Create ***");
            processBA.raiseEvent(null, "service_create");
        }
        processBA.runHook("oncreate", this, null);
        if (false) {
			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 (tracker) 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 (false)
            processBA.raiseEvent(null, "service_taskremoved");
            
    }
    private void handleStart(android.content.Intent intent) {
    	BA.LogInfo("** Service (tracker) 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 (false) {
            BA.LogInfo("** Service (tracker) Destroy (ignored)**");
        }
        else {
            BA.LogInfo("** Service (tracker) 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 int _nid = 0;
public static boolean _tracking = false;
public static anywheresoftware.b4a.phone.Phone.PhoneWakeState _lock = null;
public static uk.co.martinpearman.b4a.fusedlocationprovider.FusedLocationProviderWrapper _flp = null;
public static uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest _actuallr = null;
public static boolean _flpstarted = false;
public static anywheresoftware.b4a.gps.LocationWrapper _uugcoords = null;
public b4a.example.dateutils _dateutils = null;
public gunav2.keymon.com.mx.main _main = null;
public gunav2.keymon.com.mx.starter _starter = null;
public gunav2.keymon.com.mx.subs _subs = null;
public gunav2.keymon.com.mx.appupdater _appupdater = null;
public gunav2.keymon.com.mx.firebasemessaging _firebasemessaging = null;
public gunav2.keymon.com.mx.mapa_rutas _mapa_rutas = 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 uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest  _createlocationrequest() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "createlocationrequest", false))
	 {return ((uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest) Debug.delegate(processBA, "createlocationrequest", null));}
uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest _lr = null;
RDebugUtils.currentLine=72351744;
 //BA.debugLineNum = 72351744;BA.debugLine="Private Sub CreateLocationRequest As LocationReque";
RDebugUtils.currentLine=72351745;
 //BA.debugLineNum = 72351745;BA.debugLine="Log(\"CreateLocationRequest\")";
anywheresoftware.b4a.keywords.Common.LogImpl("072351745","CreateLocationRequest",0);
RDebugUtils.currentLine=72351746;
 //BA.debugLineNum = 72351746;BA.debugLine="Dim lr As LocationRequest";
_lr = new uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest();
RDebugUtils.currentLine=72351747;
 //BA.debugLineNum = 72351747;BA.debugLine="lr.Initialize";
_lr.Initialize();
RDebugUtils.currentLine=72351748;
 //BA.debugLineNum = 72351748;BA.debugLine="lr.SetInterval(2000) 'Intervalo deseado para actu";
_lr.SetInterval((long) (2000));
RDebugUtils.currentLine=72351749;
 //BA.debugLineNum = 72351749;BA.debugLine="lr.SetFastestInterval(lr.GetInterval / 2) 'Interv";
_lr.SetFastestInterval((long) (_lr.GetInterval()/(double)2));
RDebugUtils.currentLine=72351750;
 //BA.debugLineNum = 72351750;BA.debugLine="lr.SetSmallestDisplacement(15) 'Solo registra cam";
_lr.SetSmallestDisplacement((float) (15));
RDebugUtils.currentLine=72351751;
 //BA.debugLineNum = 72351751;BA.debugLine="lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY";
_lr.SetPriority(_lr.Priority.PRIORITY_HIGH_ACCURACY);
RDebugUtils.currentLine=72351752;
 //BA.debugLineNum = 72351752;BA.debugLine="actualLR=lr";
_actuallr = _lr;
RDebugUtils.currentLine=72351753;
 //BA.debugLineNum = 72351753;BA.debugLine="Return lr";
if (true) return _lr;
RDebugUtils.currentLine=72351754;
 //BA.debugLineNum = 72351754;BA.debugLine="End Sub";
return null;
}
public static uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest  _createlocationrequest2() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "createlocationrequest2", false))
	 {return ((uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest) Debug.delegate(processBA, "createlocationrequest2", null));}
boolean _logger = false;
uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest _lr = null;
RDebugUtils.currentLine=72482816;
 //BA.debugLineNum = 72482816;BA.debugLine="Private Sub CreateLocationRequest2 As LocationRequ";
RDebugUtils.currentLine=72482817;
 //BA.debugLineNum = 72482817;BA.debugLine="Private logger As Boolean = True";
_logger = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=72482818;
 //BA.debugLineNum = 72482818;BA.debugLine="If logger Then Log(\"Iniciamos CreateLocationReque";
if (_logger) { 
anywheresoftware.b4a.keywords.Common.LogImpl("072482818","Iniciamos CreateLocationRequest2",0);};
RDebugUtils.currentLine=72482819;
 //BA.debugLineNum = 72482819;BA.debugLine="Dim lr As LocationRequest";
_lr = new uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest();
RDebugUtils.currentLine=72482820;
 //BA.debugLineNum = 72482820;BA.debugLine="lr.Initialize";
_lr.Initialize();
RDebugUtils.currentLine=72482821;
 //BA.debugLineNum = 72482821;BA.debugLine="lr.SetInterval(1000) 'Intervalo deseado para actu";
_lr.SetInterval((long) (1000));
RDebugUtils.currentLine=72482822;
 //BA.debugLineNum = 72482822;BA.debugLine="lr.SetFastestInterval(lr.GetInterval / 2) 'Interv";
_lr.SetFastestInterval((long) (_lr.GetInterval()/(double)2));
RDebugUtils.currentLine=72482823;
 //BA.debugLineNum = 72482823;BA.debugLine="lr.setNumUpdates(2) 'Solicitamos solo x actualiza";
_lr.SetNumUpdates((int) (2));
RDebugUtils.currentLine=72482824;
 //BA.debugLineNum = 72482824;BA.debugLine="lr.SetSmallestDisplacement(1) 'Solo registra camb";
_lr.SetSmallestDisplacement((float) (1));
RDebugUtils.currentLine=72482825;
 //BA.debugLineNum = 72482825;BA.debugLine="lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY";
_lr.SetPriority(_lr.Priority.PRIORITY_HIGH_ACCURACY);
RDebugUtils.currentLine=72482826;
 //BA.debugLineNum = 72482826;BA.debugLine="actualLR=lr";
_actuallr = _lr;
RDebugUtils.currentLine=72482827;
 //BA.debugLineNum = 72482827;BA.debugLine="Return lr";
if (true) return _lr;
RDebugUtils.currentLine=72482828;
 //BA.debugLineNum = 72482828;BA.debugLine="End Sub";
return null;
}
public static uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest  _createlocationrequestsmalld() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "createlocationrequestsmalld", false))
	 {return ((uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest) Debug.delegate(processBA, "createlocationrequestsmalld", null));}
uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest _lr = null;
RDebugUtils.currentLine=72417280;
 //BA.debugLineNum = 72417280;BA.debugLine="Private Sub CreateLocationRequestSmallD As Locatio";
RDebugUtils.currentLine=72417281;
 //BA.debugLineNum = 72417281;BA.debugLine="Log(\"Iniciamos CreateLocationRequestSmallD\")";
anywheresoftware.b4a.keywords.Common.LogImpl("072417281","Iniciamos CreateLocationRequestSmallD",0);
RDebugUtils.currentLine=72417282;
 //BA.debugLineNum = 72417282;BA.debugLine="Dim lr As LocationRequest";
_lr = new uk.co.martinpearman.b4a.fusedlocationprovider.LocationRequest();
RDebugUtils.currentLine=72417283;
 //BA.debugLineNum = 72417283;BA.debugLine="lr.Initialize";
_lr.Initialize();
RDebugUtils.currentLine=72417284;
 //BA.debugLineNum = 72417284;BA.debugLine="lr.SetInterval(2000) 'Intervalo deseado para actu";
_lr.SetInterval((long) (2000));
RDebugUtils.currentLine=72417285;
 //BA.debugLineNum = 72417285;BA.debugLine="lr.SetFastestInterval(lr.GetInterval / 2) 'Interv";
_lr.SetFastestInterval((long) (_lr.GetInterval()/(double)2));
RDebugUtils.currentLine=72417286;
 //BA.debugLineNum = 72417286;BA.debugLine="lr.setNumUpdates(2) 'Solicitamos solo x actualiza";
_lr.SetNumUpdates((int) (2));
RDebugUtils.currentLine=72417287;
 //BA.debugLineNum = 72417287;BA.debugLine="lr.SetSmallestDisplacement(3) 'Solo registra camb";
_lr.SetSmallestDisplacement((float) (3));
RDebugUtils.currentLine=72417288;
 //BA.debugLineNum = 72417288;BA.debugLine="lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY";
_lr.SetPriority(_lr.Priority.PRIORITY_HIGH_ACCURACY);
RDebugUtils.currentLine=72417289;
 //BA.debugLineNum = 72417289;BA.debugLine="actualLR=lr";
_actuallr = _lr;
RDebugUtils.currentLine=72417290;
 //BA.debugLineNum = 72417290;BA.debugLine="Return lr";
if (true) return _lr;
RDebugUtils.currentLine=72417291;
 //BA.debugLineNum = 72417291;BA.debugLine="End Sub";
return null;
}
public static anywheresoftware.b4a.objects.NotificationWrapper  _createnotification(String _body) throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "createnotification", false))
	 {return ((anywheresoftware.b4a.objects.NotificationWrapper) Debug.delegate(processBA, "createnotification", new Object[] {_body}));}
anywheresoftware.b4a.objects.NotificationWrapper _notification = null;
RDebugUtils.currentLine=72744960;
 //BA.debugLineNum = 72744960;BA.debugLine="Sub CreateNotification (Body As String) As Notific";
RDebugUtils.currentLine=72744961;
 //BA.debugLineNum = 72744961;BA.debugLine="Dim notification As Notification";
_notification = new anywheresoftware.b4a.objects.NotificationWrapper();
RDebugUtils.currentLine=72744962;
 //BA.debugLineNum = 72744962;BA.debugLine="notification.Initialize2(notification.IMPORTANCE_";
_notification.Initialize2(_notification.IMPORTANCE_LOW);
RDebugUtils.currentLine=72744963;
 //BA.debugLineNum = 72744963;BA.debugLine="notification.Icon = \"icon\"";
_notification.setIcon("icon");
RDebugUtils.currentLine=72744964;
 //BA.debugLineNum = 72744964;BA.debugLine="notification.SetInfo(\"GUNA\", Body, Main)";
_notification.SetInfoNew(processBA,BA.ObjectToCharSequence("GUNA"),BA.ObjectToCharSequence(_body),(Object)(mostCurrent._main.getObject()));
RDebugUtils.currentLine=72744965;
 //BA.debugLineNum = 72744965;BA.debugLine="Return notification";
if (true) return _notification;
RDebugUtils.currentLine=72744966;
 //BA.debugLineNum = 72744966;BA.debugLine="End Sub";
return null;
}
public static String  _dameultimaubicacionconocida() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "dameultimaubicacionconocida", false))
	 {return ((String) Debug.delegate(processBA, "dameultimaubicacionconocida", null));}
String _coords = "";
RDebugUtils.currentLine=72548352;
 //BA.debugLineNum = 72548352;BA.debugLine="Sub dameUltimaUbicacionConocida";
RDebugUtils.currentLine=72548353;
 //BA.debugLineNum = 72548353;BA.debugLine="If FLP.GetLastKnownLocation.IsInitialized Then 'M";
if (_flp.GetLastKnownLocation().IsInitialized()) { 
RDebugUtils.currentLine=72548355;
 //BA.debugLineNum = 72548355;BA.debugLine="If Starter.Logger Then LogColor($\"Mandamos UUC \"";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("072548355",("Mandamos UUC \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._subs._fechakmt /*String*/ (processBA,BA.NumberToString(_flp.GetLastKnownLocation().getTime()))))+"|Acc:"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.2",(Object)(_flp.GetLastKnownLocation().getAccuracy()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.8",(Object)(_flp.GetLastKnownLocation().getLatitude()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.8",(Object)(_flp.GetLastKnownLocation().getLongitude()))+"|Spd:"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.2",(Object)(_flp.GetLastKnownLocation().getSpeed()))+"|"),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (255),(int) (112),(int) (35)));};
RDebugUtils.currentLine=72548356;
 //BA.debugLineNum = 72548356;BA.debugLine="Dim coords As String = FLP.GetLastKnownLocation.";
_coords = BA.NumberToString(_flp.GetLastKnownLocation().getLatitude())+","+BA.NumberToString(_flp.GetLastKnownLocation().getLongitude())+","+_formatofecha(BA.NumberToString(_flp.GetLastKnownLocation().getTime()));
 };
RDebugUtils.currentLine=72548360;
 //BA.debugLineNum = 72548360;BA.debugLine="End Sub";
return "";
}
public static String  _formatofecha(String _fecha) throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "formatofecha", false))
	 {return ((String) Debug.delegate(processBA, "formatofecha", new Object[] {_fecha}));}
String _origformat = "";
String _lastupdate = "";
RDebugUtils.currentLine=72876032;
 //BA.debugLineNum = 72876032;BA.debugLine="Sub formatoFecha(fecha As String) As String 'Convi";
RDebugUtils.currentLine=72876034;
 //BA.debugLineNum = 72876034;BA.debugLine="Dim OrigFormat As String = DateTime.DateFormat  '";
_origformat = anywheresoftware.b4a.keywords.Common.DateTime.getDateFormat();
RDebugUtils.currentLine=72876035;
 //BA.debugLineNum = 72876035;BA.debugLine="DateTime.DateFormat=\"yyMMddHHmmss\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("yyMMddHHmmss");
RDebugUtils.currentLine=72876036;
 //BA.debugLineNum = 72876036;BA.debugLine="Dim lastUpdate As String=DateTime.Date(fecha)";
_lastupdate = anywheresoftware.b4a.keywords.Common.DateTime.Date((long)(Double.parseDouble(_fecha)));
RDebugUtils.currentLine=72876037;
 //BA.debugLineNum = 72876037;BA.debugLine="DateTime.DateFormat=OrigFormat  'return to orig d";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat(_origformat);
RDebugUtils.currentLine=72876039;
 //BA.debugLineNum = 72876039;BA.debugLine="Return lastUpdate";
if (true) return _lastupdate;
RDebugUtils.currentLine=72876040;
 //BA.debugLineNum = 72876040;BA.debugLine="End Sub";
return "";
}
public static String  _flp_connectionfailed(int _connectionresult1) throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "flp_connectionfailed", false))
	 {return ((String) Debug.delegate(processBA, "flp_connectionfailed", new Object[] {_connectionresult1}));}
RDebugUtils.currentLine=71958528;
 //BA.debugLineNum = 71958528;BA.debugLine="Sub flp_ConnectionFailed(ConnectionResult1 As Int)";
RDebugUtils.currentLine=71958529;
 //BA.debugLineNum = 71958529;BA.debugLine="Log(\"Failed to connect to location provider\")";
anywheresoftware.b4a.keywords.Common.LogImpl("071958529","Failed to connect to location provider",0);
RDebugUtils.currentLine=71958530;
 //BA.debugLineNum = 71958530;BA.debugLine="End Sub";
return "";
}
public static String  _flp_connectionsuccess() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "flp_connectionsuccess", false))
	 {return ((String) Debug.delegate(processBA, "flp_connectionsuccess", null));}
RDebugUtils.currentLine=71892992;
 //BA.debugLineNum = 71892992;BA.debugLine="Sub flp_ConnectionSuccess";
RDebugUtils.currentLine=71892995;
 //BA.debugLineNum = 71892995;BA.debugLine="End Sub";
return "";
}
public static String  _flp_locationchanged(anywheresoftware.b4a.gps.LocationWrapper _location1) throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "flp_locationchanged", false))
	 {return ((String) Debug.delegate(processBA, "flp_locationchanged", new Object[] {_location1}));}
String _sdate = "";
String _stime = "";
String _coords = "";
RDebugUtils.currentLine=72679424;
 //BA.debugLineNum = 72679424;BA.debugLine="Sub flp_LocationChanged (Location1 As Location)";
RDebugUtils.currentLine=72679425;
 //BA.debugLineNum = 72679425;BA.debugLine="Log($\"Loc changed:${Location1.Longitude},${Locati";
anywheresoftware.b4a.keywords.Common.LogImpl("072679425",("Loc changed:"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_location1.getLongitude()))+","+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_location1.getLatitude()))+""),0);
RDebugUtils.currentLine=72679427;
 //BA.debugLineNum = 72679427;BA.debugLine="B4XPages.MainPage.lat_gps = Location1.Latitude";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._lat_gps /*String*/  = BA.NumberToString(_location1.getLatitude());
RDebugUtils.currentLine=72679428;
 //BA.debugLineNum = 72679428;BA.debugLine="B4XPages.MainPage.lon_gps = Location1.Longitude";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._lon_gps /*String*/  = BA.NumberToString(_location1.getLongitude());
RDebugUtils.currentLine=72679429;
 //BA.debugLineNum = 72679429;BA.debugLine="UUGCoords = Location1";
_uugcoords = _location1;
RDebugUtils.currentLine=72679437;
 //BA.debugLineNum = 72679437;BA.debugLine="Dim sDate,sTime As String";
_sdate = "";
_stime = "";
RDebugUtils.currentLine=72679438;
 //BA.debugLineNum = 72679438;BA.debugLine="DateTime.DateFormat = \"MM/dd/yyyy\"";
anywheresoftware.b4a.keywords.Common.DateTime.setDateFormat("MM/dd/yyyy");
RDebugUtils.currentLine=72679439;
 //BA.debugLineNum = 72679439;BA.debugLine="sDate=DateTime.Date(DateTime.Now)";
_sdate = anywheresoftware.b4a.keywords.Common.DateTime.Date(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=72679440;
 //BA.debugLineNum = 72679440;BA.debugLine="sTime=DateTime.Time(DateTime.Now)";
_stime = anywheresoftware.b4a.keywords.Common.DateTime.Time(anywheresoftware.b4a.keywords.Common.DateTime.getNow());
RDebugUtils.currentLine=72679441;
 //BA.debugLineNum = 72679441;BA.debugLine="If Not(B4XPages.MainPage.skmt.IsInitialized) Then";
if (anywheresoftware.b4a.keywords.Common.Not(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .IsInitialized())) { 
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .Initialize(mostCurrent._starter._ruta /*String*/ ,"kmt.db",anywheresoftware.b4a.keywords.Common.True);};
RDebugUtils.currentLine=72679442;
 //BA.debugLineNum = 72679442;BA.debugLine="Try";
try {RDebugUtils.currentLine=72679443;
 //BA.debugLineNum = 72679443;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INT";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO  HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(_sdate+_stime),(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*/ )}));
RDebugUtils.currentLine=72679444;
 //BA.debugLineNum = 72679444;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery(\"DELETE FROM";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery("DELETE FROM HIST_GPS");
 } 
       catch (Exception e14) {
			processBA.setLastException(e14);RDebugUtils.currentLine=72679446;
 //BA.debugLineNum = 72679446;BA.debugLine="LogColor(LastException, Colors.Red)";
anywheresoftware.b4a.keywords.Common.LogImpl("072679446",BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=72679449;
 //BA.debugLineNum = 72679449;BA.debugLine="Dim coords As String = Location1.Latitude&\",\"&Loc";
_coords = BA.NumberToString(_location1.getLatitude())+","+BA.NumberToString(_location1.getLongitude())+","+_formatofecha(BA.NumberToString(_location1.getTime()));
RDebugUtils.currentLine=72679454;
 //BA.debugLineNum = 72679454;BA.debugLine="If Location1.Accuracy < 100 Then";
if (_location1.getAccuracy()<100) { 
 };
RDebugUtils.currentLine=72679458;
 //BA.debugLineNum = 72679458;BA.debugLine="CallSub2(Starter, \"GPS_LocationChanged\", Location";
anywheresoftware.b4a.keywords.Common.CallSubDebug2(processBA,(Object)(mostCurrent._starter.getObject()),"GPS_LocationChanged",(Object)(_location1));
RDebugUtils.currentLine=72679462;
 //BA.debugLineNum = 72679462;BA.debugLine="If B4XPages.MainPage.cliente.IsInitialized And St";
if (mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._cliente /*gunav2.keymon.com.mx.c_cliente*/ .IsInitialized /*boolean*/ () && mostCurrent._starter._encliente /*boolean*/ ) { 
RDebugUtils.currentLine=72679463;
 //BA.debugLineNum = 72679463;BA.debugLine="CallSub2(B4XPages.GetPage(\"Cliente\"), \"GPS_Locat";
anywheresoftware.b4a.keywords.Common.CallSubDebug2(processBA,mostCurrent._b4xpages._getpage /*Object*/ (processBA,"Cliente"),"GPS_LocationChanged",(Object)(_location1));
 };
RDebugUtils.currentLine=72679465;
 //BA.debugLineNum = 72679465;BA.debugLine="If B4XPages.MainPage.nuevoCliente.IsInitialized T";
if (mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._nuevocliente /*gunav2.keymon.com.mx.c_nuevocliente*/ .IsInitialized /*boolean*/ ()) { 
RDebugUtils.currentLine=72679466;
 //BA.debugLineNum = 72679466;BA.debugLine="CallSub2(B4XPages.GetPage(\"nuevocliente\"), \"GPS_";
anywheresoftware.b4a.keywords.Common.CallSubDebug2(processBA,mostCurrent._b4xpages._getpage /*Object*/ (processBA,"nuevocliente"),"GPS_LocationChanged",(Object)(_location1));
 };
RDebugUtils.currentLine=72679469;
 //BA.debugLineNum = 72679469;BA.debugLine="End Sub";
return "";
}
public static String  _revisaflp() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "revisaflp", false))
	 {return ((String) Debug.delegate(processBA, "revisaflp", null));}
boolean _todobienflp = false;
RDebugUtils.currentLine=72941568;
 //BA.debugLineNum = 72941568;BA.debugLine="Sub revisaFLP 'ignore";
RDebugUtils.currentLine=72941569;
 //BA.debugLineNum = 72941569;BA.debugLine="LogColor(\"**** **** Revisamos FLP **** ****\", Col";
anywheresoftware.b4a.keywords.Common.LogImpl("072941569","**** **** Revisamos FLP **** ****",anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (78),(int) (0),(int) (227)));
RDebugUtils.currentLine=72941570;
 //BA.debugLineNum = 72941570;BA.debugLine="Private todoBienFLP As Boolean = True";
_todobienflp = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=72941571;
 //BA.debugLineNum = 72941571;BA.debugLine="Try";
try {RDebugUtils.currentLine=72941572;
 //BA.debugLineNum = 72941572;BA.debugLine="If Not(FLP.IsInitialized) Then";
if (anywheresoftware.b4a.keywords.Common.Not(_flp.IsInitialized())) { 
RDebugUtils.currentLine=72941573;
 //BA.debugLineNum = 72941573;BA.debugLine="Subs.log2DB(\"revisaFLP: No esta inicializado ..";
mostCurrent._subs._log2db /*String*/ (processBA,"revisaFLP: No esta inicializado ... 'Reinicializando FLP'");
RDebugUtils.currentLine=72941574;
 //BA.debugLineNum = 72941574;BA.debugLine="FLP.Initialize(\"flp\")";
_flp.Initialize(processBA,"flp");
RDebugUtils.currentLine=72941575;
 //BA.debugLineNum = 72941575;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e10) {
			processBA.setLastException(e10);RDebugUtils.currentLine=72941578;
 //BA.debugLineNum = 72941578;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsInitialized) -->";
anywheresoftware.b4a.keywords.Common.LogImpl("072941578","If Not(Tracker.FLP.IsInitialized) --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=72941580;
 //BA.debugLineNum = 72941580;BA.debugLine="Try";
try {RDebugUtils.currentLine=72941581;
 //BA.debugLineNum = 72941581;BA.debugLine="If FLP.IsInitialized Then";
if (_flp.IsInitialized()) { 
RDebugUtils.currentLine=72941582;
 //BA.debugLineNum = 72941582;BA.debugLine="Try";
try {RDebugUtils.currentLine=72941583;
 //BA.debugLineNum = 72941583;BA.debugLine="If Not(FLP.IsConnected) Then";
if (anywheresoftware.b4a.keywords.Common.Not(_flp.IsConnected())) { 
RDebugUtils.currentLine=72941584;
 //BA.debugLineNum = 72941584;BA.debugLine="Subs.log2DB(\"revisaFLP: No esta conectado ...";
mostCurrent._subs._log2db /*String*/ (processBA,"revisaFLP: No esta conectado ... 'Reconectando FLP'");
RDebugUtils.currentLine=72941586;
 //BA.debugLineNum = 72941586;BA.debugLine="StartFLP";
_startflp();
RDebugUtils.currentLine=72941587;
 //BA.debugLineNum = 72941587;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e21) {
			processBA.setLastException(e21);RDebugUtils.currentLine=72941590;
 //BA.debugLineNum = 72941590;BA.debugLine="LogColor(\"If Not(Tracker.FLP.IsConnected) -->";
anywheresoftware.b4a.keywords.Common.LogImpl("072941590","If Not(Tracker.FLP.IsConnected) --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=72941592;
 //BA.debugLineNum = 72941592;BA.debugLine="Try";
try {RDebugUtils.currentLine=72941593;
 //BA.debugLineNum = 72941593;BA.debugLine="If FLP.IsConnected And _ 					FLP.GetLastKnown";
if (_flp.IsConnected() && _flp.GetLastKnownLocation().IsInitialized() && _flp.GetLastKnownLocation().DistanceTo((android.location.Location)(_uugcoords.getObject()))>500) { 
RDebugUtils.currentLine=72941596;
 //BA.debugLineNum = 72941596;BA.debugLine="Subs.log2DB(\"revisaFLP: 'No se esta actualiza";
mostCurrent._subs._log2db /*String*/ (processBA,"revisaFLP: 'No se esta actualizando, lo reiniciamos ...'");
RDebugUtils.currentLine=72941597;
 //BA.debugLineNum = 72941597;BA.debugLine="StartService(Me)";
anywheresoftware.b4a.keywords.Common.StartService(processBA,tracker.getObject());
RDebugUtils.currentLine=72941598;
 //BA.debugLineNum = 72941598;BA.debugLine="todoBienFLP = False";
_todobienflp = anywheresoftware.b4a.keywords.Common.False;
 };
 } 
       catch (Exception e30) {
			processBA.setLastException(e30);RDebugUtils.currentLine=72941601;
 //BA.debugLineNum = 72941601;BA.debugLine="LogColor(\"If FLP.IsConnectctd and FLP.getLKL.I";
anywheresoftware.b4a.keywords.Common.LogImpl("072941601","If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 };
RDebugUtils.currentLine=72941604;
 //BA.debugLineNum = 72941604;BA.debugLine="If todoBienFLP Then LogColor(\" +++ +++ Sin error";
if (_todobienflp) { 
anywheresoftware.b4a.keywords.Common.LogImpl("072941604"," +++ +++ Sin errores en FLP",anywheresoftware.b4a.keywords.Common.Colors.Green);};
 } 
       catch (Exception e35) {
			processBA.setLastException(e35);RDebugUtils.currentLine=72941606;
 //BA.debugLineNum = 72941606;BA.debugLine="LogColor(\"If Tracker.FLP.IsInitialized --> \"&Las";
anywheresoftware.b4a.keywords.Common.LogImpl("072941606","If Tracker.FLP.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=72941609;
 //BA.debugLineNum = 72941609;BA.debugLine="End Sub";
return "";
}
public static void  _startflp() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "startflp", false))
	 {Debug.delegate(processBA, "startflp", null); return;}
ResumableSub_StartFLP rsub = new ResumableSub_StartFLP(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_StartFLP extends BA.ResumableSub {
public ResumableSub_StartFLP(gunav2.keymon.com.mx.tracker parent) {
this.parent = parent;
}
gunav2.keymon.com.mx.tracker parent;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="tracker";

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

case 0:
//C
this.state = 1;
RDebugUtils.currentLine=72155137;
 //BA.debugLineNum = 72155137;BA.debugLine="Log(\"StartFLP - flpStarted=\"&flpStarted)";
anywheresoftware.b4a.keywords.Common.LogImpl("072155137","StartFLP - flpStarted="+BA.ObjectToString(parent._flpstarted),0);
RDebugUtils.currentLine=72155138;
 //BA.debugLineNum = 72155138;BA.debugLine="Do While FLP.IsConnected = False";
if (true) break;

case 1:
//do while
this.state = 4;
while (parent._flp.IsConnected()==anywheresoftware.b4a.keywords.Common.False) {
this.state = 3;
if (true) break;
}
if (true) break;

case 3:
//C
this.state = 1;
RDebugUtils.currentLine=72155139;
 //BA.debugLineNum = 72155139;BA.debugLine="Sleep(500)";
anywheresoftware.b4a.keywords.Common.Sleep(processBA,new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "tracker", "startflp"),(int) (500));
this.state = 5;
return;
case 5:
//C
this.state = 1;
;
 if (true) break;

case 4:
//C
this.state = -1;
;
RDebugUtils.currentLine=72155144;
 //BA.debugLineNum = 72155144;BA.debugLine="FLP.RequestLocationUpdates(CreateLocationRequest)";
parent._flp.RequestLocationUpdates((com.google.android.gms.location.LocationRequest)(_createlocationrequest().getObject()));
RDebugUtils.currentLine=72155147;
 //BA.debugLineNum = 72155147;BA.debugLine="flpStarted = True";
parent._flpstarted = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=72155149;
 //BA.debugLineNum = 72155149;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static String  _revisauug() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "revisauug", false))
	 {return ((String) Debug.delegate(processBA, "revisauug", null));}
int _daa = 0;
RDebugUtils.currentLine=73007104;
 //BA.debugLineNum = 73007104;BA.debugLine="Sub revisaUUG 'ignore";
RDebugUtils.currentLine=73007105;
 //BA.debugLineNum = 73007105;BA.debugLine="Try";
try {RDebugUtils.currentLine=73007107;
 //BA.debugLineNum = 73007107;BA.debugLine="If FLP.IsInitialized And FLP.IsConnected Then";
if (_flp.IsInitialized() && _flp.IsConnected()) { 
RDebugUtils.currentLine=73007108;
 //BA.debugLineNum = 73007108;BA.debugLine="Try";
try {RDebugUtils.currentLine=73007109;
 //BA.debugLineNum = 73007109;BA.debugLine="If FLP.GetLastKnownLocation.IsInitialized Then";
if (_flp.GetLastKnownLocation().IsInitialized()) { 
RDebugUtils.currentLine=73007111;
 //BA.debugLineNum = 73007111;BA.debugLine="Dim daa As Int = UUGCoords.DistanceTo(FLP.Get";
_daa = (int) (_uugcoords.DistanceTo((android.location.Location)(_flp.GetLastKnownLocation().getObject())));
RDebugUtils.currentLine=73007112;
 //BA.debugLineNum = 73007112;BA.debugLine="If Starter.Logger Then LogColor($\"**** UUC \"$";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("073007112",("**** UUC \""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(mostCurrent._subs._fechakmt /*String*/ (processBA,BA.NumberToString(_flp.GetLastKnownLocation().getTime()))))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.2",(Object)(_flp.GetLastKnownLocation().getAccuracy()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.8",(Object)(_flp.GetLastKnownLocation().getLatitude()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.8",(Object)(_flp.GetLastKnownLocation().getLongitude()))+"|"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("0.2",(Object)(_flp.GetLastKnownLocation().getSpeed()))+"|"),anywheresoftware.b4a.keywords.Common.Colors.RGB((int) (255),(int) (112),(int) (35)));};
RDebugUtils.currentLine=73007113;
 //BA.debugLineNum = 73007113;BA.debugLine="If daa > 40 And FLP.GetLastKnownLocation.Accu";
if (_daa>40 && _flp.GetLastKnownLocation().getAccuracy()<35) { 
RDebugUtils.currentLine=73007114;
 //BA.debugLineNum = 73007114;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._skmt /*anywheresoftware.b4a.sql.SQL*/ .ExecNonQuery2("INSERT INTO RUTA_GPS(fecha, lat, lon) VALUES (?,?,?)",anywheresoftware.b4a.keywords.Common.ArrayToList(new Object[]{(Object)(mostCurrent._subs._fechakmt /*String*/ (processBA,BA.NumberToString(_flp.GetLastKnownLocation().getTime()))),(Object)(_flp.GetLastKnownLocation().getLatitude()),(Object)(_flp.GetLastKnownLocation().getLongitude())}));
RDebugUtils.currentLine=73007115;
 //BA.debugLineNum = 73007115;BA.debugLine="If Starter.Logger Then Log(\"++++ Distancia a";
if (mostCurrent._starter._logger /*boolean*/ ) { 
anywheresoftware.b4a.keywords.Common.LogImpl("073007115","++++ Distancia a anterior="+BA.NumberToString(_daa)+"|"+"Precision="+BA.NumberToString(_flp.GetLastKnownLocation().getAccuracy()),0);};
 };
RDebugUtils.currentLine=73007117;
 //BA.debugLineNum = 73007117;BA.debugLine="UUGCoords = FLP.GetLastKnownLocation";
_uugcoords = _flp.GetLastKnownLocation();
 };
 } 
       catch (Exception e14) {
			processBA.setLastException(e14);RDebugUtils.currentLine=73007120;
 //BA.debugLineNum = 73007120;BA.debugLine="LogColor(\"FLP.GetLastKnownLocation.IsInitializ";
anywheresoftware.b4a.keywords.Common.LogImpl("073007120","FLP.GetLastKnownLocation.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
 }else {
RDebugUtils.currentLine=73007123;
 //BA.debugLineNum = 73007123;BA.debugLine="Log(\"StartFLP\")";
anywheresoftware.b4a.keywords.Common.LogImpl("073007123","StartFLP",0);
RDebugUtils.currentLine=73007124;
 //BA.debugLineNum = 73007124;BA.debugLine="StartFLP";
_startflp();
 };
 } 
       catch (Exception e21) {
			processBA.setLastException(e21);RDebugUtils.currentLine=73007127;
 //BA.debugLineNum = 73007127;BA.debugLine="LogColor(\"If FLP.IsInitialized --> \"&LastExcepti";
anywheresoftware.b4a.keywords.Common.LogImpl("073007127","If FLP.IsInitialized --> "+BA.ObjectToString(anywheresoftware.b4a.keywords.Common.LastException(processBA)),anywheresoftware.b4a.keywords.Common.Colors.Red);
 };
RDebugUtils.currentLine=73007129;
 //BA.debugLineNum = 73007129;BA.debugLine="End Sub";
return "";
}
public static String  _service_create() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "service_create", false))
	 {return ((String) Debug.delegate(processBA, "service_create", null));}
RDebugUtils.currentLine=71827456;
 //BA.debugLineNum = 71827456;BA.debugLine="Sub Service_Create";
RDebugUtils.currentLine=71827457;
 //BA.debugLineNum = 71827457;BA.debugLine="Service.AutomaticForegroundMode = Service.AUTOMAT";
mostCurrent._service.AutomaticForegroundMode = mostCurrent._service.AUTOMATIC_FOREGROUND_NEVER;
RDebugUtils.currentLine=71827459;
 //BA.debugLineNum = 71827459;BA.debugLine="FLP.Initialize(\"flp\")";
_flp.Initialize(processBA,"flp");
RDebugUtils.currentLine=71827460;
 //BA.debugLineNum = 71827460;BA.debugLine="FLP.Connect";
_flp.Connect();
RDebugUtils.currentLine=71827461;
 //BA.debugLineNum = 71827461;BA.debugLine="lock.PartialLock";
_lock.PartialLock(processBA);
RDebugUtils.currentLine=71827462;
 //BA.debugLineNum = 71827462;BA.debugLine="StartFLP";
_startflp();
RDebugUtils.currentLine=71827463;
 //BA.debugLineNum = 71827463;BA.debugLine="End Sub";
return "";
}
public static String  _service_destroy() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "service_destroy", false))
	 {return ((String) Debug.delegate(processBA, "service_destroy", null));}
RDebugUtils.currentLine=72810496;
 //BA.debugLineNum = 72810496;BA.debugLine="Sub Service_Destroy";
RDebugUtils.currentLine=72810497;
 //BA.debugLineNum = 72810497;BA.debugLine="If Tracking Then";
if (_tracking) { 
RDebugUtils.currentLine=72810498;
 //BA.debugLineNum = 72810498;BA.debugLine="StopFLP";
_stopflp();
 };
RDebugUtils.currentLine=72810500;
 //BA.debugLineNum = 72810500;BA.debugLine="Tracking = False";
_tracking = anywheresoftware.b4a.keywords.Common.False;
RDebugUtils.currentLine=72810501;
 //BA.debugLineNum = 72810501;BA.debugLine="lock.ReleasePartialLock";
_lock.ReleasePartialLock();
RDebugUtils.currentLine=72810502;
 //BA.debugLineNum = 72810502;BA.debugLine="End Sub";
return "";
}
public static String  _stopflp() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "stopflp", false))
	 {return ((String) Debug.delegate(processBA, "stopflp", null));}
RDebugUtils.currentLine=72613888;
 //BA.debugLineNum = 72613888;BA.debugLine="Public Sub StopFLP";
RDebugUtils.currentLine=72613889;
 //BA.debugLineNum = 72613889;BA.debugLine="Log(\"StopFLP\")";
anywheresoftware.b4a.keywords.Common.LogImpl("072613889","StopFLP",0);
RDebugUtils.currentLine=72613890;
 //BA.debugLineNum = 72613890;BA.debugLine="If flpStarted Then";
if (_flpstarted) { 
RDebugUtils.currentLine=72613891;
 //BA.debugLineNum = 72613891;BA.debugLine="FLP.RemoveLocationUpdates  'Eliminamos todas las";
_flp.RemoveLocationUpdates();
RDebugUtils.currentLine=72613892;
 //BA.debugLineNum = 72613892;BA.debugLine="flpStarted = False";
_flpstarted = anywheresoftware.b4a.keywords.Common.False;
 };
RDebugUtils.currentLine=72613894;
 //BA.debugLineNum = 72613894;BA.debugLine="End Sub";
return "";
}
public static String  _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "service_start", false))
	 {return ((String) Debug.delegate(processBA, "service_start", new Object[] {_startingintent}));}
RDebugUtils.currentLine=72024064;
 //BA.debugLineNum = 72024064;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
RDebugUtils.currentLine=72024066;
 //BA.debugLineNum = 72024066;BA.debugLine="Service.StopAutomaticForeground";
mostCurrent._service.StopAutomaticForeground();
RDebugUtils.currentLine=72024067;
 //BA.debugLineNum = 72024067;BA.debugLine="Service.StartForeground(nid, CreateNotification(\"";
mostCurrent._service.StartForeground(_nid,(android.app.Notification)(_createnotification("...").getObject()));
RDebugUtils.currentLine=72024068;
 //BA.debugLineNum = 72024068;BA.debugLine="Track";
_track();
RDebugUtils.currentLine=72024069;
 //BA.debugLineNum = 72024069;BA.debugLine="StartServiceAt(Me, DateTime.Now + 5 * DateTime.Ti";
anywheresoftware.b4a.keywords.Common.StartServiceAt(processBA,tracker.getObject(),(long) (anywheresoftware.b4a.keywords.Common.DateTime.getNow()+5*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=72024070;
 //BA.debugLineNum = 72024070;BA.debugLine="FLP.GetLastKnownLocation.Initialize";
_flp.GetLastKnownLocation().Initialize();
RDebugUtils.currentLine=72024071;
 //BA.debugLineNum = 72024071;BA.debugLine="End Sub";
return "";
}
public static String  _track() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "track", false))
	 {return ((String) Debug.delegate(processBA, "track", null));}
RDebugUtils.currentLine=72089600;
 //BA.debugLineNum = 72089600;BA.debugLine="Public Sub Track";
RDebugUtils.currentLine=72089601;
 //BA.debugLineNum = 72089601;BA.debugLine="Log(\"Inicia Track - Tracking : \"&Tracking)";
anywheresoftware.b4a.keywords.Common.LogImpl("072089601","Inicia Track - Tracking : "+BA.ObjectToString(_tracking),0);
RDebugUtils.currentLine=72089602;
 //BA.debugLineNum = 72089602;BA.debugLine="If Not(FLP.IsInitialized) Then FLP.Initialize(\"fl";
if (anywheresoftware.b4a.keywords.Common.Not(_flp.IsInitialized())) { 
_flp.Initialize(processBA,"flp");};
RDebugUtils.currentLine=72089603;
 //BA.debugLineNum = 72089603;BA.debugLine="If Not(FLP.IsConnected) Then FLP.Connect";
if (anywheresoftware.b4a.keywords.Common.Not(_flp.IsConnected())) { 
_flp.Connect();};
RDebugUtils.currentLine=72089604;
 //BA.debugLineNum = 72089604;BA.debugLine="If Tracking And actualLR.IsInitialized Then";
if (_tracking && _actuallr.IsInitialized()) { 
RDebugUtils.currentLine=72089606;
 //BA.debugLineNum = 72089606;BA.debugLine="Return 'Si ya estamos \"rastreando\" no hacemos na";
if (true) return "";
 };
RDebugUtils.currentLine=72089608;
 //BA.debugLineNum = 72089608;BA.debugLine="If Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_";
if (mostCurrent._starter._rp /*anywheresoftware.b4a.objects.RuntimePermissions*/ .Check(mostCurrent._starter._rp /*anywheresoftware.b4a.objects.RuntimePermissions*/ .PERMISSION_ACCESS_FINE_LOCATION)==anywheresoftware.b4a.keywords.Common.False) { 
RDebugUtils.currentLine=72089609;
 //BA.debugLineNum = 72089609;BA.debugLine="Log(\"No permission\")";
anywheresoftware.b4a.keywords.Common.LogImpl("072089609","No permission",0);
RDebugUtils.currentLine=72089610;
 //BA.debugLineNum = 72089610;BA.debugLine="Return";
if (true) return "";
 };
RDebugUtils.currentLine=72089612;
 //BA.debugLineNum = 72089612;BA.debugLine="StartFLP 'Iniciamos FusedLocationProvider";
_startflp();
RDebugUtils.currentLine=72089613;
 //BA.debugLineNum = 72089613;BA.debugLine="Tracking = True";
_tracking = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=72089614;
 //BA.debugLineNum = 72089614;BA.debugLine="End Sub";
return "";
}
public static void  _startflp2() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "startflp2", false))
	 {Debug.delegate(processBA, "startflp2", null); return;}
ResumableSub_StartFLP2 rsub = new ResumableSub_StartFLP2(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_StartFLP2 extends BA.ResumableSub {
public ResumableSub_StartFLP2(gunav2.keymon.com.mx.tracker parent) {
this.parent = parent;
}
gunav2.keymon.com.mx.tracker parent;
boolean _logger = false;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="tracker";

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

case 0:
//C
this.state = 1;
RDebugUtils.currentLine=72220673;
 //BA.debugLineNum = 72220673;BA.debugLine="Log(\"StartFLP2\")";
anywheresoftware.b4a.keywords.Common.LogImpl("072220673","StartFLP2",0);
RDebugUtils.currentLine=72220674;
 //BA.debugLineNum = 72220674;BA.debugLine="Private logger As Boolean = True";
_logger = anywheresoftware.b4a.keywords.Common.True;
RDebugUtils.currentLine=72220675;
 //BA.debugLineNum = 72220675;BA.debugLine="If logger Then Log(\"StartFLP2 - flpStarted=\"&flpS";
if (true) break;

case 1:
//if
this.state = 6;
if (_logger) { 
this.state = 3;
;}if (true) break;

case 3:
//C
this.state = 6;
anywheresoftware.b4a.keywords.Common.LogImpl("072220675","StartFLP2 - flpStarted="+BA.ObjectToString(parent._flpstarted),0);
if (true) break;

case 6:
//C
this.state = 7;
;
RDebugUtils.currentLine=72220676;
 //BA.debugLineNum = 72220676;BA.debugLine="Do While FLP.IsConnected = False";
if (true) break;

case 7:
//do while
this.state = 16;
while (parent._flp.IsConnected()==anywheresoftware.b4a.keywords.Common.False) {
this.state = 9;
if (true) break;
}
if (true) break;

case 9:
//C
this.state = 10;
RDebugUtils.currentLine=72220677;
 //BA.debugLineNum = 72220677;BA.debugLine="Sleep(500)";
anywheresoftware.b4a.keywords.Common.Sleep(processBA,new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "tracker", "startflp2"),(int) (500));
this.state = 23;
return;
case 23:
//C
this.state = 10;
;
RDebugUtils.currentLine=72220678;
 //BA.debugLineNum = 72220678;BA.debugLine="If logger Then Log(\"kll - sleeping\")";
if (true) break;

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

case 12:
//C
this.state = 15;
anywheresoftware.b4a.keywords.Common.LogImpl("072220678","kll - sleeping",0);
if (true) break;

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

case 16:
//C
this.state = 17;
;
RDebugUtils.currentLine=72220680;
 //BA.debugLineNum = 72220680;BA.debugLine="dameUltimaUbicacionConocida 'Regresamos ultima ub";
_dameultimaubicacionconocida();
RDebugUtils.currentLine=72220681;
 //BA.debugLineNum = 72220681;BA.debugLine="FLP.RequestLocationUpdates(CreateLocationRequest2";
parent._flp.RequestLocationUpdates((com.google.android.gms.location.LocationRequest)(_createlocationrequest2().getObject()));
RDebugUtils.currentLine=72220682;
 //BA.debugLineNum = 72220682;BA.debugLine="If logger Then LogColor(\"Buscamos ubicacion (movi";
if (true) break;

case 17:
//if
this.state = 22;
if (_logger) { 
this.state = 19;
;}if (true) break;

case 19:
//C
this.state = 22;
anywheresoftware.b4a.keywords.Common.LogImpl("072220682","Buscamos ubicacion (movimientoMinimo = "+BA.NumberToString(parent._actuallr.GetSmallestDisplacement())+")",anywheresoftware.b4a.keywords.Common.Colors.Magenta);
if (true) break;

case 22:
//C
this.state = -1;
;
RDebugUtils.currentLine=72220684;
 //BA.debugLineNum = 72220684;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static void  _startflpsmall() throws Exception{
RDebugUtils.currentModule="tracker";
if (Debug.shouldDelegate(processBA, "startflpsmall", false))
	 {Debug.delegate(processBA, "startflpsmall", null); return;}
ResumableSub_StartFLPSmall rsub = new ResumableSub_StartFLPSmall(null);
rsub.resume(processBA, null);
}
public static class ResumableSub_StartFLPSmall extends BA.ResumableSub {
public ResumableSub_StartFLPSmall(gunav2.keymon.com.mx.tracker parent) {
this.parent = parent;
}
gunav2.keymon.com.mx.tracker parent;

@Override
public void resume(BA ba, Object[] result) throws Exception{
RDebugUtils.currentModule="tracker";

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

case 0:
//C
this.state = 1;
RDebugUtils.currentLine=72286209;
 //BA.debugLineNum = 72286209;BA.debugLine="Log(\"StartFLPSmall - flpStarted=\"&flpStarted)";
anywheresoftware.b4a.keywords.Common.LogImpl("072286209","StartFLPSmall - flpStarted="+BA.ObjectToString(parent._flpstarted),0);
RDebugUtils.currentLine=72286210;
 //BA.debugLineNum = 72286210;BA.debugLine="Do While FLP.IsConnected = False";
if (true) break;

case 1:
//do while
this.state = 4;
while (parent._flp.IsConnected()==anywheresoftware.b4a.keywords.Common.False) {
this.state = 3;
if (true) break;
}
if (true) break;

case 3:
//C
this.state = 1;
RDebugUtils.currentLine=72286211;
 //BA.debugLineNum = 72286211;BA.debugLine="Sleep(500)";
anywheresoftware.b4a.keywords.Common.Sleep(processBA,new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "tracker", "startflpsmall"),(int) (500));
this.state = 5;
return;
case 5:
//C
this.state = 1;
;
RDebugUtils.currentLine=72286212;
 //BA.debugLineNum = 72286212;BA.debugLine="Log(\"sleeping\")";
anywheresoftware.b4a.keywords.Common.LogImpl("072286212","sleeping",0);
 if (true) break;

case 4:
//C
this.state = -1;
;
RDebugUtils.currentLine=72286214;
 //BA.debugLineNum = 72286214;BA.debugLine="dameUltimaUbicacionConocida 'Regresamos ultima ub";
_dameultimaubicacionconocida();
RDebugUtils.currentLine=72286215;
 //BA.debugLineNum = 72286215;BA.debugLine="FLP.RequestLocationUpdates(CreateLocationRequestS";
parent._flp.RequestLocationUpdates((com.google.android.gms.location.LocationRequest)(_createlocationrequestsmalld().getObject()));
RDebugUtils.currentLine=72286218;
 //BA.debugLineNum = 72286218;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
}