Files
Mazapa-Reparto/B4A/Objects/src/reparto_mazapa/keymon/lat/newinst2.java
2025-01-14 11:20:38 -06:00

229 lines
11 KiB
Java

package reparto_mazapa.keymon.lat;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.objects.ServiceHelper;
import anywheresoftware.b4a.debug.*;
public class newinst2 extends android.app.Service{
public static class newinst2_BR extends android.content.BroadcastReceiver {
@Override
public void onReceive(android.content.Context context, android.content.Intent intent) {
BA.LogInfo("** Receiver (newinst2) OnReceive **");
android.content.Intent in = new android.content.Intent(context, newinst2.class);
if (intent != null)
in.putExtra("b4a_internal_intent", intent);
ServiceHelper.StarterHelper.startServiceFromReceiver (context, in, false, BA.class);
}
}
static newinst2 mostCurrent;
public static BA processBA;
private ServiceHelper _service;
public static Class<?> getObject() {
return newinst2.class;
}
@Override
public void onCreate() {
super.onCreate();
mostCurrent = this;
if (processBA == null) {
processBA = new BA(this, null, null, "reparto_mazapa.keymon.lat", "reparto_mazapa.keymon.lat.newinst2");
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, "reparto_mazapa.keymon.lat.newinst2", processBA, _service, anywheresoftware.b4a.keywords.Common.Density);
}
if (!false && ServiceHelper.StarterHelper.startFromServiceCreate(processBA, false) == false) {
}
else {
processBA.setActivityPaused(false);
BA.LogInfo("*** Service (newinst2) 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 (newinst2) 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 (newinst2) 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 (newinst2) Destroy (ignored)**");
}
else {
BA.LogInfo("** Service (newinst2) 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 String _pkg = "";
public static boolean _svcverbose = false;
public static int _logcolor1 = 0;
public b4a.example.dateutils _dateutils = null;
public reparto_mazapa.keymon.lat.main _main = null;
public reparto_mazapa.keymon.lat.appupdater _appupdater = null;
public reparto_mazapa.keymon.lat.foto _foto = null;
public reparto_mazapa.keymon.lat.mapa_cliente _mapa_cliente = null;
public reparto_mazapa.keymon.lat.mapa_rutas _mapa_rutas = null;
public reparto_mazapa.keymon.lat.starter _starter = null;
public reparto_mazapa.keymon.lat.subs _subs = null;
public reparto_mazapa.keymon.lat.tracker _tracker = null;
public reparto_mazapa.keymon.lat.b4xpages _b4xpages = null;
public reparto_mazapa.keymon.lat.b4xcollections _b4xcollections = null;
public reparto_mazapa.keymon.lat.httputils2service _httputils2service = null;
public reparto_mazapa.keymon.lat.xuiviewsutils _xuiviewsutils = null;
public static String _getpackagename() throws Exception{
anywheresoftware.b4a.agraham.reflection.Reflection _r = null;
//BA.debugLineNum = 38;BA.debugLine="Sub GetPackageName As String";
//BA.debugLineNum = 39;BA.debugLine="Dim r As Reflector";
_r = new anywheresoftware.b4a.agraham.reflection.Reflection();
//BA.debugLineNum = 40;BA.debugLine="Return r.GetStaticField(\"anywheresoftware.b4a.BA\"";
if (true) return BA.ObjectToString(_r.GetStaticField("anywheresoftware.b4a.BA","packageName"));
//BA.debugLineNum = 41;BA.debugLine="End Sub";
return "";
}
public static String _myappreload() throws Exception{
//BA.debugLineNum = 43;BA.debugLine="Sub MyAppReload";
//BA.debugLineNum = 44;BA.debugLine="If svcVerbose Then Log(\"-- AppUpdating.NewInst2:";
if (_svcverbose) {
anywheresoftware.b4a.keywords.Common.LogImpl("224641537","-- AppUpdating.NewInst2: processing MyAppReload",0);};
//BA.debugLineNum = 45;BA.debugLine="If IsPaused(\"main\") Then";
if (anywheresoftware.b4a.keywords.Common.IsPaused(processBA,(Object)("main"))) {
//BA.debugLineNum = 46;BA.debugLine="StartActivity(\"main\")";
anywheresoftware.b4a.keywords.Common.StartActivity(processBA,(Object)("main"));
};
//BA.debugLineNum = 50;BA.debugLine="End Sub";
return "";
}
public static String _process_globals() throws Exception{
//BA.debugLineNum = 5;BA.debugLine="Sub Process_Globals";
//BA.debugLineNum = 8;BA.debugLine="Dim pkg As String 'app's package name";
_pkg = "";
//BA.debugLineNum = 9;BA.debugLine="Dim svcVerbose As Boolean 'True = shows start";
_svcverbose = false;
//BA.debugLineNum = 10;BA.debugLine="Private LogColor1 As Int = 0xFFFF8C00 'color for";
_logcolor1 = ((int)0xffff8c00);
//BA.debugLineNum = 11;BA.debugLine="End Sub";
return "";
}
public static String _service_create() throws Exception{
//BA.debugLineNum = 13;BA.debugLine="Sub Service_Create";
//BA.debugLineNum = 14;BA.debugLine="LogColor(\"---- AppUpdating.newinst2: service crea";
anywheresoftware.b4a.keywords.Common.LogImpl("224379393","---- AppUpdating.newinst2: service created",_logcolor1);
//BA.debugLineNum = 15;BA.debugLine="pkg = \"\"";
_pkg = "";
//BA.debugLineNum = 16;BA.debugLine="svcVerbose = False";
_svcverbose = anywheresoftware.b4a.keywords.Common.False;
//BA.debugLineNum = 17;BA.debugLine="End Sub";
return "";
}
public static String _service_destroy() throws Exception{
//BA.debugLineNum = 35;BA.debugLine="Sub Service_Destroy";
//BA.debugLineNum = 36;BA.debugLine="End Sub";
return "";
}
public static String _service_start(anywheresoftware.b4a.objects.IntentWrapper _startingintent) throws Exception{
//BA.debugLineNum = 19;BA.debugLine="Sub Service_Start (StartingIntent As Intent)";
//BA.debugLineNum = 20;BA.debugLine="LogColor(\"---- AppUpdating.newinst2: service_star";
anywheresoftware.b4a.keywords.Common.LogImpl("224444929","---- AppUpdating.newinst2: service_started",_logcolor1);
//BA.debugLineNum = 21;BA.debugLine="If svcVerbose Then";
if (_svcverbose) {
//BA.debugLineNum = 22;BA.debugLine="Log($\"${TAB}intent: ${StartingIntent}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("224444931",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.TAB))+"intent: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_startingintent.getObject()))+""),0);
//BA.debugLineNum = 23;BA.debugLine="Log($\"${TAB}action: ${StartingIntent.Action}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("224444932",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.TAB))+"action: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_startingintent.getAction()))+""),0);
//BA.debugLineNum = 24;BA.debugLine="Log($\"${TAB}extra: ${StartingIntent.ExtrasToStri";
anywheresoftware.b4a.keywords.Common.LogImpl("224444933",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.TAB))+"extra: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_startingintent.ExtrasToString()))+""),0);
//BA.debugLineNum = 25;BA.debugLine="Log($\"${TAB}data: ${StartingIntent.GetData}\"$)";
anywheresoftware.b4a.keywords.Common.LogImpl("224444934",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.TAB))+"data: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_startingintent.GetData()))+""),0);
};
//BA.debugLineNum = 27;BA.debugLine="If StartingIntent.Action = \"android.intent.action";
if ((_startingintent.getAction()).equals("android.intent.action.MY_PACKAGE_REPLACED")) {
//BA.debugLineNum = 28;BA.debugLine="If svcVerbose Then Log($\"${TAB}Intent MY_PACKAGE";
if (_svcverbose) {
anywheresoftware.b4a.keywords.Common.LogImpl("224444937",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.TAB))+"Intent MY_PACKAGE_REPLACED received!"),0);};
//BA.debugLineNum = 29;BA.debugLine="pkg = GetPackageName";
_pkg = _getpackagename();
//BA.debugLineNum = 30;BA.debugLine="If svcVerbose Then Log($\"${TAB}package: ${pkg}\"$";
if (_svcverbose) {
anywheresoftware.b4a.keywords.Common.LogImpl("224444939",(""+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(anywheresoftware.b4a.keywords.Common.TAB))+"package: "+anywheresoftware.b4a.keywords.Common.SmartStringFormatter("",(Object)(_pkg))+""),0);};
//BA.debugLineNum = 31;BA.debugLine="MyAppReload";
_myappreload();
};
//BA.debugLineNum = 33;BA.debugLine="End Sub";
return "";
}
}