package gunav2.keymon.com.mx;


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

public class firebasemessaging extends android.app.Service{
	public static class firebasemessaging_BR extends android.content.BroadcastReceiver {

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

	}
    static firebasemessaging mostCurrent;
	public static BA processBA;
    private ServiceHelper _service;
    public static Class<?> getObject() {
		return firebasemessaging.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.firebasemessaging");
            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.firebasemessaging", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
		}
        if (!false && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
				
		}
		else {
            processBA.setActivityPaused(false);
            BA.LogInfo("*** Service (firebasemessaging) 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 (firebasemessaging) 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 (firebasemessaging) 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 (firebasemessaging) Destroy (ignored)**");
        }
        else {
            BA.LogInfo("** Service (firebasemessaging) 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.objects.FirebaseNotificationsService.FirebaseMessageWrapper _fm = null;
public static String _api_key = "";
public static String _locrequest = "";
public static anywheresoftware.b4a.phone.PhoneEvents _pe = null;
public static anywheresoftware.b4a.sql.SQL.CursorWrapper _c = null;
public static de.donmanfred.GZipStringswrapper _gzip = null;
public static String _sprvsr = "";
public static String _subscrito = "";
public static String _au = "";
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.tracker _tracker = 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 String  _borragpshist() throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "borragpshist", false))
	 {return ((String) Debug.delegate(processBA, "borragpshist", null));}
RDebugUtils.currentLine=92864512;
 //BA.debugLineNum = 92864512;BA.debugLine="Sub borraGPSHist";
RDebugUtils.currentLine=92864513;
 //BA.debugLineNum = 92864513;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"delete FROM";
_c = (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("delete FROM RUTA_GPS")));
RDebugUtils.currentLine=92864514;
 //BA.debugLineNum = 92864514;BA.debugLine="End Sub";
return "";
}
public static String  _borramosarchivogps() throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "borramosarchivogps", false))
	 {return ((String) Debug.delegate(processBA, "borramosarchivogps", null));}
anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper _out = null;
String _s = "";
byte[] _t = null;
RDebugUtils.currentLine=92536832;
 //BA.debugLineNum = 92536832;BA.debugLine="Sub borramosArchivoGPS";
RDebugUtils.currentLine=92536833;
 //BA.debugLineNum = 92536833;BA.debugLine="Dim out As OutputStream = File.OpenOutput(File.Di";
_out = new anywheresoftware.b4a.objects.streams.File.OutputStreamWrapper();
_out = anywheresoftware.b4a.keywords.Common.File.OpenOutput(anywheresoftware.b4a.keywords.Common.File.getDirRootExternal(),"gps.txt",anywheresoftware.b4a.keywords.Common.False);
RDebugUtils.currentLine=92536834;
 //BA.debugLineNum = 92536834;BA.debugLine="Dim s As String = \"\"";
_s = "";
RDebugUtils.currentLine=92536835;
 //BA.debugLineNum = 92536835;BA.debugLine="Dim t() As Byte = s.GetBytes(\"UTF-8\")";
_t = _s.getBytes("UTF-8");
RDebugUtils.currentLine=92536836;
 //BA.debugLineNum = 92536836;BA.debugLine="out.WriteBytes(t, 0, t.Length)";
_out.WriteBytes(_t,(int) (0),_t.length);
RDebugUtils.currentLine=92536837;
 //BA.debugLineNum = 92536837;BA.debugLine="out.Close";
_out.Close();
RDebugUtils.currentLine=92536838;
 //BA.debugLineNum = 92536838;BA.debugLine="End Sub";
return "";
}
public static String  _compress(String _str) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "compress", false))
	 {return ((String) Debug.delegate(processBA, "compress", new Object[] {_str}));}
anywheresoftware.b4a.objects.StringUtils _su = null;
byte[] _compressed = null;
String _base64 = "";
RDebugUtils.currentLine=92667904;
 //BA.debugLineNum = 92667904;BA.debugLine="Sub compress(str As String) As String";
RDebugUtils.currentLine=92667906;
 //BA.debugLineNum = 92667906;BA.debugLine="Private su As StringUtils";
_su = new anywheresoftware.b4a.objects.StringUtils();
RDebugUtils.currentLine=92667907;
 //BA.debugLineNum = 92667907;BA.debugLine="Dim compressed() As Byte = GZip.compress(str)";
_compressed = _gzip.compress(_str);
RDebugUtils.currentLine=92667908;
 //BA.debugLineNum = 92667908;BA.debugLine="Log($\"CompressedBytesLength: ${compressed.Length}";
anywheresoftware.b4a.keywords.Common.LogImpl("092667908",("CompressedBytesLength: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_compressed.length))+""),0);
RDebugUtils.currentLine=92667909;
 //BA.debugLineNum = 92667909;BA.debugLine="Dim base64 As String = su.EncodeBase64(compressed";
_base64 = _su.EncodeBase64(_compressed);
RDebugUtils.currentLine=92667910;
 //BA.debugLineNum = 92667910;BA.debugLine="Log($\"CompressedBytes converted to base64 Length:";
anywheresoftware.b4a.keywords.Common.LogImpl("092667910",("CompressedBytes converted to base64 Length: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64.length()))+""),0);
RDebugUtils.currentLine=92667911;
 //BA.debugLineNum = 92667911;BA.debugLine="Log($\"CompressedBytes converted to base64: ${base";
anywheresoftware.b4a.keywords.Common.LogImpl("092667911",("CompressedBytes converted to base64: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_base64))+""),0);
RDebugUtils.currentLine=92667912;
 //BA.debugLineNum = 92667912;BA.debugLine="Return base64";
if (true) return _base64;
RDebugUtils.currentLine=92667913;
 //BA.debugLineNum = 92667913;BA.debugLine="End Sub";
return "";
}
public static String  _dameruta() throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "dameruta", false))
	 {return ((String) Debug.delegate(processBA, "dameruta", null));}
String _ruta2 = "";
int _i = 0;
RDebugUtils.currentLine=92798976;
 //BA.debugLineNum = 92798976;BA.debugLine="Sub dameRuta As String";
RDebugUtils.currentLine=92798977;
 //BA.debugLineNum = 92798977;BA.debugLine="Log(\"dameRuta\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092798977","dameRuta",0);
RDebugUtils.currentLine=92798978;
 //BA.debugLineNum = 92798978;BA.debugLine="Dim c As Cursor";
_c = new anywheresoftware.b4a.sql.SQL.CursorWrapper();
RDebugUtils.currentLine=92798979;
 //BA.debugLineNum = 92798979;BA.debugLine="c = B4XPages.MainPage.skmt.ExecQuery(\"select LAT,";
_c = (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 LAT, LON from RUTA_GPS order by FECHA desc limit 390")));
RDebugUtils.currentLine=92798980;
 //BA.debugLineNum = 92798980;BA.debugLine="c.Position = 0";
_c.setPosition((int) (0));
RDebugUtils.currentLine=92798981;
 //BA.debugLineNum = 92798981;BA.debugLine="Dim ruta2 As String = \"\"";
_ruta2 = "";
RDebugUtils.currentLine=92798982;
 //BA.debugLineNum = 92798982;BA.debugLine="If c.RowCount>0 Then";
if (_c.getRowCount()>0) { 
RDebugUtils.currentLine=92798983;
 //BA.debugLineNum = 92798983;BA.debugLine="For i=0 To c.RowCount -1";
{
final int step7 = 1;
final int limit7 = (int) (_c.getRowCount()-1);
_i = (int) (0) ;
for (;_i <= limit7 ;_i = _i + step7 ) {
RDebugUtils.currentLine=92798984;
 //BA.debugLineNum = 92798984;BA.debugLine="c.Position=i";
_c.setPosition(_i);
RDebugUtils.currentLine=92798985;
 //BA.debugLineNum = 92798985;BA.debugLine="ruta2=ruta2&CRLF&c.GetString(\"LAT\")&\",\"&c.GetSt";
_ruta2 = _ruta2+anywheresoftware.b4a.keywords.Common.CRLF+_c.GetString("LAT")+","+_c.GetString("LON");
 }
};
 };
RDebugUtils.currentLine=92798988;
 //BA.debugLineNum = 92798988;BA.debugLine="c.Close";
_c.Close();
RDebugUtils.currentLine=92798989;
 //BA.debugLineNum = 92798989;BA.debugLine="Return compress(ruta2)";
if (true) return _compress(_ruta2);
RDebugUtils.currentLine=92798990;
 //BA.debugLineNum = 92798990;BA.debugLine="End Sub";
return "";
}
public static String  _decompress(String _base64) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "decompress", false))
	 {return ((String) Debug.delegate(processBA, "decompress", new Object[] {_base64}));}
anywheresoftware.b4a.objects.StringUtils _su = null;
byte[] _decompressedbytes = null;
anywheresoftware.b4a.agraham.byteconverter.ByteConverter _bc = null;
String _uncompressed = "";
RDebugUtils.currentLine=92733440;
 //BA.debugLineNum = 92733440;BA.debugLine="Sub decompress(base64 As String) As String 'ignore";
RDebugUtils.currentLine=92733442;
 //BA.debugLineNum = 92733442;BA.debugLine="Private su As StringUtils";
_su = new anywheresoftware.b4a.objects.StringUtils();
RDebugUtils.currentLine=92733443;
 //BA.debugLineNum = 92733443;BA.debugLine="Dim decompressedbytes() As Byte = su.DecodeBase64";
_decompressedbytes = _su.DecodeBase64(_base64);
RDebugUtils.currentLine=92733444;
 //BA.debugLineNum = 92733444;BA.debugLine="Log($\"decompressedbytesLength: ${decompressedbyte";
anywheresoftware.b4a.keywords.Common.LogImpl("092733444",("decompressedbytesLength: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_decompressedbytes.length))+""),0);
RDebugUtils.currentLine=92733445;
 //BA.debugLineNum = 92733445;BA.debugLine="Dim bc As ByteConverter";
_bc = new anywheresoftware.b4a.agraham.byteconverter.ByteConverter();
RDebugUtils.currentLine=92733446;
 //BA.debugLineNum = 92733446;BA.debugLine="Dim uncompressed As String = bc.StringFromBytes(d";
_uncompressed = _bc.StringFromBytes(_decompressedbytes,"UTF8");
RDebugUtils.currentLine=92733447;
 //BA.debugLineNum = 92733447;BA.debugLine="Log($\"uncompressedLength: ${uncompressed.Length}\"";
anywheresoftware.b4a.keywords.Common.LogImpl("092733447",("uncompressedLength: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed.length()))+""),0);
RDebugUtils.currentLine=92733448;
 //BA.debugLineNum = 92733448;BA.debugLine="Log($\"Decompressed String = ${uncompressed}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("092733448",("Decompressed String = "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_uncompressed))+""),0);
RDebugUtils.currentLine=92733449;
 //BA.debugLineNum = 92733449;BA.debugLine="Return uncompressed";
if (true) return _uncompressed;
RDebugUtils.currentLine=92733450;
 //BA.debugLineNum = 92733450;BA.debugLine="End Sub";
return "";
}
public static String  _fm_messagearrived(anywheresoftware.b4a.objects.FirebaseNotificationsService.RemoteMessageWrapper _message) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "fm_messagearrived", false))
	 {return ((String) Debug.delegate(processBA, "fm_messagearrived", new Object[] {_message}));}
anywheresoftware.b4a.objects.collections.List _tipos = null;
anywheresoftware.b4a.objects.collections.Map _params = null;
String _rutagpscmp = "";
RDebugUtils.currentLine=92209152;
 //BA.debugLineNum = 92209152;BA.debugLine="Sub fm_MessageArrived (Message As RemoteMessage)";
RDebugUtils.currentLine=92209153;
 //BA.debugLineNum = 92209153;BA.debugLine="Log(\"Message arrived\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209153","Message arrived",0);
RDebugUtils.currentLine=92209154;
 //BA.debugLineNum = 92209154;BA.debugLine="Log($\"Message data: ${Message.GetData}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("092209154",("Message data: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_message.GetData().getObject()))+""),0);
RDebugUtils.currentLine=92209156;
 //BA.debugLineNum = 92209156;BA.debugLine="If Message.GetData.ContainsKey(\"t\") Then";
if (_message.GetData().ContainsKey((Object)("t"))) { 
RDebugUtils.currentLine=92209157;
 //BA.debugLineNum = 92209157;BA.debugLine="Dim tipos As List = Regex.Split(\",\",Message.GetD";
_tipos = new anywheresoftware.b4a.objects.collections.List();
_tipos = anywheresoftware.b4a.keywords.Common.ArrayToList(anywheresoftware.b4a.keywords.Common.Regex.Split(",",BA.ObjectToString(_message.GetData().Get((Object)("t")))));
RDebugUtils.currentLine=92209158;
 //BA.debugLineNum = 92209158;BA.debugLine="If tipos.IndexOf(\"pu\") <> -1 Or tipos.IndexOf(\"a";
if (_tipos.IndexOf((Object)("pu"))!=-1 || _tipos.IndexOf((Object)("au"))!=-1) { 
RDebugUtils.currentLine=92209159;
 //BA.debugLineNum = 92209159;BA.debugLine="Log(\"Es una peticion de ubicacion\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209159","Es una peticion de ubicacion",0);
RDebugUtils.currentLine=92209160;
 //BA.debugLineNum = 92209160;BA.debugLine="locRequest=\"Activa\"";
_locrequest = "Activa";
RDebugUtils.currentLine=92209161;
 //BA.debugLineNum = 92209161;BA.debugLine="Log(\"Llamamos StartFLPSmall\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209161","Llamamos StartFLPSmall",0);
RDebugUtils.currentLine=92209162;
 //BA.debugLineNum = 92209162;BA.debugLine="CallSubDelayed(Tracker, \"StartFLPSmall\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(mostCurrent._tracker.getObject()),"StartFLPSmall");
RDebugUtils.currentLine=92209163;
 //BA.debugLineNum = 92209163;BA.debugLine="CallSubDelayed(Tracker, \"StartFLP\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(mostCurrent._tracker.getObject()),"StartFLP");
 };
RDebugUtils.currentLine=92209165;
 //BA.debugLineNum = 92209165;BA.debugLine="If tipos.IndexOf(\"au\") <> -1 Then 'Si es una act";
if (_tipos.IndexOf((Object)("au"))!=-1) { 
RDebugUtils.currentLine=92209166;
 //BA.debugLineNum = 92209166;BA.debugLine="au = 1";
_au = BA.NumberToString(1);
 };
RDebugUtils.currentLine=92209168;
 //BA.debugLineNum = 92209168;BA.debugLine="If tipos.IndexOf(\"ping\") <> -1 Then 'Si es un pi";
if (_tipos.IndexOf((Object)("ping"))!=-1) { 
RDebugUtils.currentLine=92209169;
 //BA.debugLineNum = 92209169;BA.debugLine="Log(\"Es un ping\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209169","Es un ping",0);
RDebugUtils.currentLine=92209170;
 //BA.debugLineNum = 92209170;BA.debugLine="Log(\"Mandamos pong\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209170","Mandamos pong",0);
RDebugUtils.currentLine=92209171;
 //BA.debugLineNum = 92209171;BA.debugLine="Dim params As Map = CreateMap(\"topic\":Sprvsr,\"t";
_params = new anywheresoftware.b4a.objects.collections.Map();
_params = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("topic"),(Object)(_sprvsr),(Object)("title"),(Object)("pong"),(Object)("body"),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._usuario /*String*/ +" - Recibi mensaje "+BA.ObjectToString(_message.GetData().Get((Object)("title")))),(Object)("t"),(Object)("pong")});
RDebugUtils.currentLine=92209172;
 //BA.debugLineNum = 92209172;BA.debugLine="SendMessage(params)";
_sendmessage(_params);
 };
RDebugUtils.currentLine=92209174;
 //BA.debugLineNum = 92209174;BA.debugLine="If tipos.IndexOf(\"bgps\") <> -1 Then 'Si es una i";
if (_tipos.IndexOf((Object)("bgps"))!=-1) { 
RDebugUtils.currentLine=92209175;
 //BA.debugLineNum = 92209175;BA.debugLine="Log(\"Es una instruccion de borrar archivo gps\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209175","Es una instruccion de borrar archivo gps",0);
RDebugUtils.currentLine=92209176;
 //BA.debugLineNum = 92209176;BA.debugLine="Log(\"Borramos archivo gps\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209176","Borramos archivo gps",0);
RDebugUtils.currentLine=92209177;
 //BA.debugLineNum = 92209177;BA.debugLine="borramosArchivoGPS";
_borramosarchivogps();
 };
RDebugUtils.currentLine=92209179;
 //BA.debugLineNum = 92209179;BA.debugLine="If tipos.IndexOf(\"dr\") <> -1 Then 'Si es una pet";
if (_tipos.IndexOf((Object)("dr"))!=-1) { 
RDebugUtils.currentLine=92209180;
 //BA.debugLineNum = 92209180;BA.debugLine="Log(\"Es una peticion de Ruta GPS\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209180","Es una peticion de Ruta GPS",0);
RDebugUtils.currentLine=92209181;
 //BA.debugLineNum = 92209181;BA.debugLine="Dim rutaGpsCmp As String = dameRuta";
_rutagpscmp = _dameruta();
RDebugUtils.currentLine=92209182;
 //BA.debugLineNum = 92209182;BA.debugLine="Dim params As Map = CreateMap(\"topic\":Sprvsr,\"t";
_params = new anywheresoftware.b4a.objects.collections.Map();
_params = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("topic"),(Object)(_sprvsr),(Object)("title"),(Object)("ruta"),(Object)("body"),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._usuario /*String*/ +" - Recibi mensaje "+BA.ObjectToString(_message.GetData().Get((Object)("title")))),(Object)("t"),(Object)("ruta"),(Object)("r"),(Object)(_rutagpscmp)});
RDebugUtils.currentLine=92209183;
 //BA.debugLineNum = 92209183;BA.debugLine="SendMessage(params)";
_sendmessage(_params);
 };
RDebugUtils.currentLine=92209185;
 //BA.debugLineNum = 92209185;BA.debugLine="If tipos.IndexOf(\"bgps2\") <> -1 Then 'Si es una";
if (_tipos.IndexOf((Object)("bgps2"))!=-1) { 
RDebugUtils.currentLine=92209186;
 //BA.debugLineNum = 92209186;BA.debugLine="Log(\"Es una instruccion de borrar BD gps\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209186","Es una instruccion de borrar BD gps",0);
RDebugUtils.currentLine=92209187;
 //BA.debugLineNum = 92209187;BA.debugLine="Log(\"Borramos BD gps\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092209187","Borramos BD gps",0);
RDebugUtils.currentLine=92209188;
 //BA.debugLineNum = 92209188;BA.debugLine="borraGPSHist";
_borragpshist();
 };
RDebugUtils.currentLine=92209190;
 //BA.debugLineNum = 92209190;BA.debugLine="If tipos.IndexOf(\"pu\") = -1 And tipos.IndexOf(\"a";
if (_tipos.IndexOf((Object)("pu"))==-1 && _tipos.IndexOf((Object)("au"))==-1 && _tipos.IndexOf((Object)("ping"))==-1 && _tipos.IndexOf((Object)("dr"))==-1) { 
RDebugUtils.currentLine=92209191;
 //BA.debugLineNum = 92209191;BA.debugLine="Log(\"No es ping ni solicitud de ubicacion o rut";
anywheresoftware.b4a.keywords.Common.LogImpl("092209191","No es ping ni solicitud de ubicacion o ruta, entonces no hacemos nada",0);
 };
 };
RDebugUtils.currentLine=92209199;
 //BA.debugLineNum = 92209199;BA.debugLine="End Sub";
return "";
}
public static String  _sendmessage(anywheresoftware.b4a.objects.collections.Map _params) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "sendmessage", false))
	 {return ((String) Debug.delegate(processBA, "sendmessage", new Object[] {_params}));}
String _topic = "";
String _title = "";
String _body = "";
String _tipo = "";
String _rutagpscmp = "";
gunav2.keymon.com.mx.httpjob _job = null;
anywheresoftware.b4a.objects.collections.Map _m = null;
anywheresoftware.b4a.objects.collections.Map _data = null;
anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator _jg = null;
RDebugUtils.currentLine=92340224;
 //BA.debugLineNum = 92340224;BA.debugLine="Sub SendMessage(params As Map)";
RDebugUtils.currentLine=92340225;
 //BA.debugLineNum = 92340225;BA.debugLine="Dim topic As String= params.Get(\"topic\")";
_topic = BA.ObjectToString(_params.Get((Object)("topic")));
RDebugUtils.currentLine=92340226;
 //BA.debugLineNum = 92340226;BA.debugLine="Dim title As String= params.Get(\"title\")";
_title = BA.ObjectToString(_params.Get((Object)("title")));
RDebugUtils.currentLine=92340227;
 //BA.debugLineNum = 92340227;BA.debugLine="Dim body As String= params.Get(\"body\")";
_body = BA.ObjectToString(_params.Get((Object)("body")));
RDebugUtils.currentLine=92340228;
 //BA.debugLineNum = 92340228;BA.debugLine="Dim tipo As String= params.Get(\"t\")";
_tipo = BA.ObjectToString(_params.Get((Object)("t")));
RDebugUtils.currentLine=92340229;
 //BA.debugLineNum = 92340229;BA.debugLine="If params.ContainsKey(\"r\") Then";
if (_params.ContainsKey((Object)("r"))) { 
RDebugUtils.currentLine=92340230;
 //BA.debugLineNum = 92340230;BA.debugLine="Log(\"Con ruta\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092340230","Con ruta",0);
RDebugUtils.currentLine=92340231;
 //BA.debugLineNum = 92340231;BA.debugLine="Dim rutaGpsCmp As String= params.Get(\"r\")";
_rutagpscmp = BA.ObjectToString(_params.Get((Object)("r")));
 }else {
RDebugUtils.currentLine=92340233;
 //BA.debugLineNum = 92340233;BA.debugLine="Log(\"Sin ruta\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092340233","Sin ruta",0);
RDebugUtils.currentLine=92340234;
 //BA.debugLineNum = 92340234;BA.debugLine="Dim rutaGpsCmp As String = \"\"";
_rutagpscmp = "";
 };
RDebugUtils.currentLine=92340236;
 //BA.debugLineNum = 92340236;BA.debugLine="Dim Job As HttpJob";
_job = new gunav2.keymon.com.mx.httpjob();
RDebugUtils.currentLine=92340237;
 //BA.debugLineNum = 92340237;BA.debugLine="Job.Initialize(\"fcm\", Me)";
_job._initialize /*String*/ (null,processBA,"fcm",firebasemessaging.getObject());
RDebugUtils.currentLine=92340238;
 //BA.debugLineNum = 92340238;BA.debugLine="Dim m As Map = CreateMap(\"to\": $\"/topics/${topic}";
_m = new anywheresoftware.b4a.objects.collections.Map();
_m = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("to"),(Object)(("/topics/"+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_topic))+""))});
RDebugUtils.currentLine=92340239;
 //BA.debugLineNum = 92340239;BA.debugLine="Dim data As Map = CreateMap(\"title\":title, \"body\"";
_data = new anywheresoftware.b4a.objects.collections.Map();
_data = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("title"),(Object)(_title),(Object)("body"),(Object)(_body),(Object)("d"),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._usuario /*String*/ ),(Object)("t"),(Object)(_tipo),(Object)("b"),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._batt /*int*/ ),(Object)("mt"),(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)("r"),(Object)(_rutagpscmp),(Object)("v"),(Object)(mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._v /*String*/ )});
RDebugUtils.currentLine=92340240;
 //BA.debugLineNum = 92340240;BA.debugLine="m.Put(\"data\", data)";
_m.Put((Object)("data"),(Object)(_data.getObject()));
RDebugUtils.currentLine=92340241;
 //BA.debugLineNum = 92340241;BA.debugLine="Dim jg As JSONGenerator";
_jg = new anywheresoftware.b4a.objects.collections.JSONParser.JSONGenerator();
RDebugUtils.currentLine=92340242;
 //BA.debugLineNum = 92340242;BA.debugLine="jg.Initialize(m)";
_jg.Initialize(_m);
RDebugUtils.currentLine=92340243;
 //BA.debugLineNum = 92340243;BA.debugLine="Job.PostString(\"https://fcm.googleapis.com/fcm/se";
_job._poststring /*String*/ (null,"https://fcm.googleapis.com/fcm/send",_jg.ToString());
RDebugUtils.currentLine=92340244;
 //BA.debugLineNum = 92340244;BA.debugLine="Job.GetRequest.SetContentType(\"application/json;c";
_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ (null).SetContentType("application/json;charset=UTF-8");
RDebugUtils.currentLine=92340245;
 //BA.debugLineNum = 92340245;BA.debugLine="Job.GetRequest.SetHeader(\"Authorization\", \"key=\"";
_job._getrequest /*anywheresoftware.b4h.okhttp.OkHttpClientWrapper.OkHttpRequest*/ (null).SetHeader("Authorization","key="+_api_key);
RDebugUtils.currentLine=92340246;
 //BA.debugLineNum = 92340246;BA.debugLine="Log(m) 'ignore";
anywheresoftware.b4a.keywords.Common.LogImpl("092340246",BA.ObjectToString(_m),0);
RDebugUtils.currentLine=92340247;
 //BA.debugLineNum = 92340247;BA.debugLine="End Sub";
return "";
}
public static String  _guardainfoenarchivo(String _coords) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "guardainfoenarchivo", false))
	 {return ((String) Debug.delegate(processBA, "guardainfoenarchivo", new Object[] {_coords}));}
String[] _latlon = null;
RDebugUtils.currentLine=92471296;
 //BA.debugLineNum = 92471296;BA.debugLine="Sub guardaInfoEnArchivo(coords As String) 'ignore";
RDebugUtils.currentLine=92471297;
 //BA.debugLineNum = 92471297;BA.debugLine="Log(\"Guardamos ubicacion en BD\")";
anywheresoftware.b4a.keywords.Common.LogImpl("092471297","Guardamos ubicacion en BD",0);
RDebugUtils.currentLine=92471298;
 //BA.debugLineNum = 92471298;BA.debugLine="Dim latlon() As String = Regex.Split(\",\", coords)";
_latlon = anywheresoftware.b4a.keywords.Common.Regex.Split(",",_coords);
RDebugUtils.currentLine=92471299;
 //BA.debugLineNum = 92471299;BA.debugLine="B4XPages.MainPage.skmt.ExecNonQuery2(\"INSERT INTO";
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)(_latlon[(int) (2)]),(Object)(_latlon[(int) (0)]),(Object)(_latlon[(int) (1)])}));
RDebugUtils.currentLine=92471300;
 //BA.debugLineNum = 92471300;BA.debugLine="End Sub";
return "";
}
public static String  _mandamosloc(String _coords) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "mandamosloc", false))
	 {return ((String) Debug.delegate(processBA, "mandamosloc", new Object[] {_coords}));}
anywheresoftware.b4a.objects.collections.Map _params = null;
RDebugUtils.currentLine=92405760;
 //BA.debugLineNum = 92405760;BA.debugLine="Sub mandamosLoc(coords As String)";
RDebugUtils.currentLine=92405763;
 //BA.debugLineNum = 92405763;BA.debugLine="If locRequest=\"Activa\" Then 'Si hay solicitud de";
if ((_locrequest).equals("Activa")) { 
RDebugUtils.currentLine=92405764;
 //BA.debugLineNum = 92405764;BA.debugLine="Dim params As Map = CreateMap(\"topic\":Sprvsr,\"ti";
_params = new anywheresoftware.b4a.objects.collections.Map();
_params = anywheresoftware.b4a.keywords.Common.createMap(new Object[] {(Object)("topic"),(Object)(_sprvsr),(Object)("title"),(Object)("ubicacionRecibida"),(Object)("body"),(Object)(_coords),(Object)("t"),(Object)("u")});
RDebugUtils.currentLine=92405765;
 //BA.debugLineNum = 92405765;BA.debugLine="SendMessage(params)";
_sendmessage(_params);
RDebugUtils.currentLine=92405766;
 //BA.debugLineNum = 92405766;BA.debugLine="locRequest=\"Enviada\"";
_locrequest = "Enviada";
RDebugUtils.currentLine=92405767;
 //BA.debugLineNum = 92405767;BA.debugLine="CallSubDelayed(Tracker,\"CreateLocationRequest\")";
anywheresoftware.b4a.keywords.Common.CallSubDelayed(processBA,(Object)(mostCurrent._tracker.getObject()),"CreateLocationRequest");
 };
RDebugUtils.currentLine=92405769;
 //BA.debugLineNum = 92405769;BA.debugLine="End Sub";
return "";
}
public static String  _pe_batterychanged(int _level,int _scale,boolean _plugged,anywheresoftware.b4a.objects.IntentWrapper _intent) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "pe_batterychanged", false))
	 {return ((String) Debug.delegate(processBA, "pe_batterychanged", new Object[] {_level,_scale,_plugged,_intent}));}
RDebugUtils.currentLine=92602368;
 //BA.debugLineNum = 92602368;BA.debugLine="Sub pe_BatteryChanged (Level As Int, Scale As Int,";
RDebugUtils.currentLine=92602369;
 //BA.debugLineNum = 92602369;BA.debugLine="B4XPages.MainPage.batt=Level";
mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._batt /*int*/  = _level;
RDebugUtils.currentLine=92602370;
 //BA.debugLineNum = 92602370;BA.debugLine="End Sub";
return "";
}
public static String  _service_create() throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "service_create", false))
	 {return ((String) Debug.delegate(processBA, "service_create", null));}
RDebugUtils.currentLine=92012544;
 //BA.debugLineNum = 92012544;BA.debugLine="Sub Service_Create";
RDebugUtils.currentLine=92012545;
 //BA.debugLineNum = 92012545;BA.debugLine="fm.Initialize(\"fm\") 'Inicializamos FirebaseMessag";
_fm.Initialize(processBA,"fm");
RDebugUtils.currentLine=92012546;
 //BA.debugLineNum = 92012546;BA.debugLine="pe.Initialize(\"pe\") 'Para obtener la bateria";
_pe.Initialize(processBA,"pe");
RDebugUtils.currentLine=92012547;
 //BA.debugLineNum = 92012547;BA.debugLine="End Sub";
return "";
}
public static String  _service_destroy() throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "service_destroy", false))
	 {return ((String) Debug.delegate(processBA, "service_destroy", null));}
RDebugUtils.currentLine=92274688;
 //BA.debugLineNum = 92274688;BA.debugLine="Sub Service_Destroy";
RDebugUtils.currentLine=92274690;
 //BA.debugLineNum = 92274690;BA.debugLine="End Sub";
return "";
}
public static void  _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "service_start", false))
	 {Debug.delegate(processBA, "service_start", new Object[] {_startingintent}); return;}
ResumableSub_Service_Start rsub = new ResumableSub_Service_Start(null,_startingintent);
rsub.resume(processBA, null);
}
public static class ResumableSub_Service_Start extends BA.ResumableSub {
public ResumableSub_Service_Start(gunav2.keymon.com.mx.firebasemessaging parent,anywheresoftware.b4a.objects.IntentWrapper _startingintent) {
this.parent = parent;
this._startingintent = _startingintent;
}
gunav2.keymon.com.mx.firebasemessaging parent;
anywheresoftware.b4a.objects.IntentWrapper _startingintent;

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

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

case 0:
//C
this.state = 1;
RDebugUtils.currentLine=92143617;
 //BA.debugLineNum = 92143617;BA.debugLine="If StartingIntent.IsInitialized Then fm.HandleInt";
if (true) break;

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

case 3:
//C
this.state = 6;
parent._fm.HandleIntent((android.content.Intent)(_startingintent.getObject()));
if (true) break;

case 6:
//C
this.state = -1;
;
RDebugUtils.currentLine=92143618;
 //BA.debugLineNum = 92143618;BA.debugLine="Sleep(0)";
anywheresoftware.b4a.keywords.Common.Sleep(processBA,new anywheresoftware.b4a.shell.DebugResumableSub.DelegatableResumableSub(this, "firebasemessaging", "service_start"),(int) (0));
this.state = 7;
return;
case 7:
//C
this.state = -1;
;
RDebugUtils.currentLine=92143619;
 //BA.debugLineNum = 92143619;BA.debugLine="Service.StopAutomaticForeground 'remove if not us";
parent.mostCurrent._service.StopAutomaticForeground();
RDebugUtils.currentLine=92143620;
 //BA.debugLineNum = 92143620;BA.debugLine="StartServiceAt(Me, DateTime.Now + 15 * DateTime.T";
anywheresoftware.b4a.keywords.Common.StartServiceAt(processBA,firebasemessaging.getObject(),(long) (anywheresoftware.b4a.keywords.Common.DateTime.getNow()+15*anywheresoftware.b4a.keywords.Common.DateTime.TicksPerMinute),anywheresoftware.b4a.keywords.Common.True);
RDebugUtils.currentLine=92143621;
 //BA.debugLineNum = 92143621;BA.debugLine="End Sub";
if (true) break;

            }
        }
    }
}
public static String  _subscribetotopics() throws Exception{
RDebugUtils.currentModule="firebasemessaging";
if (Debug.shouldDelegate(processBA, "subscribetotopics", false))
	 {return ((String) Debug.delegate(processBA, "subscribetotopics", null));}
RDebugUtils.currentLine=92078080;
 //BA.debugLineNum = 92078080;BA.debugLine="Public Sub SubscribeToTopics";
RDebugUtils.currentLine=92078082;
 //BA.debugLineNum = 92078082;BA.debugLine="fm.SubscribeToTopic(\"Trckr\") 'Tracker Global";
_fm.SubscribeToTopic("Trckr");
RDebugUtils.currentLine=92078084;
 //BA.debugLineNum = 92078084;BA.debugLine="fm.SubscribeToTopic(\"Trckr-Cedex\") 'Topico de Gun";
_fm.SubscribeToTopic("Trckr-Cedex");
RDebugUtils.currentLine=92078085;
 //BA.debugLineNum = 92078085;BA.debugLine="If \"Cdx_\"&B4XPages.MainPage.usuario <> Subscrito";
if (("Cdx_"+mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._usuario /*String*/ ).equals(_subscrito) == false) { 
RDebugUtils.currentLine=92078086;
 //BA.debugLineNum = 92078086;BA.debugLine="fm.SubscribeToTopic(\"Cdx_\"&B4XPages.MainPage.usu";
_fm.SubscribeToTopic("Cdx_"+mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._usuario /*String*/ );
RDebugUtils.currentLine=92078087;
 //BA.debugLineNum = 92078087;BA.debugLine="fm.UnsubscribeFromTopic(Subscrito) 'Unsubscribe";
_fm.UnsubscribeFromTopic(_subscrito);
 };
RDebugUtils.currentLine=92078090;
 //BA.debugLineNum = 92078090;BA.debugLine="Subscrito = \"Cdx_\"&B4XPages.MainPage.usuario";
_subscrito = "Cdx_"+mostCurrent._b4xpages._mainpage /*gunav2.keymon.com.mx.b4xmainpage*/ (processBA)._usuario /*String*/ ;
RDebugUtils.currentLine=92078093;
 //BA.debugLineNum = 92078093;BA.debugLine="End Sub";
return "";
}
}