robert83
Members-
Content Count
11 -
Joined
-
Last visited
Everything posted by robert83
-
Hello Everyone, got here a Table with Datetime2(5) field . For example 2022-03-11 07:39:53.86286 . Before I was using the MDAC SQLOLEDB Provider which comes with Windows . There this field DateTime2(5) was simply returned as WideString . Now I have installed the new Microsoft OLEDB Provider for SQL ( the undeprectated one ) . And it returns Datetime2(5) in Delphi inside a ADOQUERY simply as Datetime . And after playing around with the ADOQUERY Field , settings its Displayformat to : dd.MM.yyyy HH:nn:ss.zzzzz I get 11.03.2022 07:39:53.862 in cxGrid . If I leave this Displayformat empty I only get 11.03.2022 07:39:53 . My question is is there still a limitation with DateTime2(5) and Microsoft OLEDB Provider for SQL and Delphi ADO ? Thank you
-
Hello everyone, Does anyone know how to Auto Start an Application ( once it is launched 1x by user ) after Reboot on Android ? I have found some example for Delphi XE5 but that is way to old . I know that I have to set Receive boot Completed to true... but after that... how do I process this in the Program ? Thank you.
-
@Rollo62 Hi , sorry it took a while , but I just continued development on this tool which requires auto start with the custom .dex And debug is working! I am using Delphi 10.3.3
-
I have solved it . Step 1 : create src\com\XLR folder in your App Directory there create the file BootReceiver.java with the following content : package com.XLR; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Intent; import android.content.Context; public class BootReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent launchintent = new Intent(); launchintent.setClassName(context, "com.embarcadero.firemonkey.FMXNativeActivity"); launchintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(launchintent); } } Step 2 : Under your App Directory create build.bat with following content : @echo off echo. echo Compiles your Java code into classes.dex echo Verified to work in Delphi 10.3.3 echo. echo Place this batch in a java folder below your project (project\java) echo Place the source in project\java\src\com\dannywind\delphi echo If your source file location or name is different, please modify it below. echo. setlocal set ANDROID_JAR="C:\Users\Public\Documents\Embarcadero\Studio\20.0\PlatformSDKs\android-sdk-windows\platforms\android-26\android.jar" set DX_LIB="C:\Users\Public\Documents\Embarcadero\Studio\20.0\PlatformSDKs\android-sdk-windows\build-tools\28.0.2\lib" set EMBO_DEX="D:\PRG\20.0\lib\android\debug\classes.dex" set PROJ_DIR=%CD% set VERBOSE=0 set JAVASDK="C:\Program Files (x86)\Java\jdk1.7.0_71\bin" set DX_BAT="C:\Users\Public\Documents\Embarcadero\Studio\20.0\PlatformSDKs\android-sdk-windows\build-tools\28.0.2\dx.bat" echo. echo Compiling the Java source files echo. pause mkdir output 2> nul mkdir output\classes 2> nul if x%VERBOSE% == x1 SET VERBOSE_FLAG=-verbose %JAVASDK%\javac %VERBOSE_FLAG% -Xlint:all -classpath %ANDROID_JAR% -d output\classes -source 1.6 -target 1.6 src\com\XLR\BootReceiver.java echo. echo Creating jar containing the new classes echo. pause mkdir output\jar 2> nul if x%VERBOSE% == x1 SET VERBOSE_FLAG=v %JAVASDK%\jar c%VERBOSE_FLAG%f output\jar\XLRBoot.jar -C output\classes com :Exit endlocal Step 3 : now run build.bat and it will create the class and jar files in the Output Directory in your App Directory. Step 4 : Alter your AndroidManifest.template like this <?xml version="1.0" encoding="utf-8"?> <!-- BEGIN_INCLUDE(manifest) --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="%package%" android:versionCode="%versionCode%" android:versionName="%versionName%" android:installLocation="%installLocation%"> <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" /> <%uses-permission%> <uses-feature android:glEsVersion="0x00020000" android:required="True"/> <application android:persistent="%persistent%" android:restoreAnyVersion="%restoreAnyVersion%" android:label="%label%" android:debuggable="%debuggable%" android:largeHeap="%largeHeap%" android:icon="%icon%" android:theme="%theme%" android:hardwareAccelerated="%hardwareAccelerated%" android:resizeableActivity="false"> <%provider%> <%application-meta-data%> <%uses-libraries%> <%services%> <!-- Our activity is a subclass of the built-in NativeActivity framework class. This will take care of integrating with our NDK code. --> <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:launchMode="singleTask"> <!-- Tell NativeActivity the name of our .so --> <meta-data android:name="android.app.lib_name" android:value="%libNameValue%" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm" /> <receiver android:name="com.XLR.BootReceiver" android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver> <!-- Registration is complete --> <%activity%> <%receivers%> </application> </manifest> <!-- END_INCLUDE(manifest) --> Step 5: Add the output\jar\XLRBoot.jar file to your Libraries inside Delphi and Run the programm. Step 6: After Run the Program Starts, Stop it Start it again . Now Reboot it will start. Turn Device Off and Turn On again and it will start. Thank you. SPECIAL NOTE FOR ANDROID 10 : You must set the Permissions System Alert window in Delphi. And on the Phone under App Info -> Advanced enable the Display over other apps settings.
-
Unfortunately it is not working . No Error but nothing starts. Anyway I made "some" progress with some JAVA Code . But I am stuck. Created following JAVA File : package com.embarcadero.XLRBoot; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Intent; import android.content.Context; public class startup extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent sintent = new Intent(); sintent.setClassName(context, "com.embarcadero.firemonkey.FMXNativeActivity"); sintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(sintent); } } Then I made a JAR file out of it like this : C:\Program Files (x86)\Java\jdk1.7.0_71\bin>jar cf com-embarcadero-XLRBoot.jar "d:\Delphi XE 10\XLR Spider\Boot Receiver\com-embarcadero-XLRBoot.java" My AndroidManifest.template looks like this : <?xml version="1.0" encoding="utf-8"?> <!-- BEGIN_INCLUDE(manifest) --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="%package%" android:versionCode="%versionCode%" android:versionName="%versionName%" android:installLocation="%installLocation%"> <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" /> <%uses-permission%> <uses-feature android:glEsVersion="0x00020000" android:required="True"/> <application android:persistent="%persistent%" android:restoreAnyVersion="%restoreAnyVersion%" android:label="%label%" android:debuggable="%debuggable%" android:largeHeap="%largeHeap%" android:icon="%icon%" android:theme="%theme%" android:hardwareAccelerated="%hardwareAccelerated%" android:resizeableActivity="false"> <%provider%> <%application-meta-data%> <%uses-libraries%> <%services%> <!-- Our activity is a subclass of the built-in NativeActivity framework class. This will take care of integrating with our NDK code. --> <activity android:name="com.embarcadero.firemonkey.FMXNativeActivity" android:label="%activityLabel%" android:configChanges="orientation|keyboard|keyboardHidden|screenSize" android:launchMode="singleTask"> <!-- Tell NativeActivity the name of our .so --> <meta-data android:name="android.app.lib_name" android:value="%libNameValue%" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <receiver android:name="com.embarcadero.firemonkey.notifications.FMXNotificationAlarm" /> <receiver android:name="com.embarcadero.XLRBoot" android:permission="android.permission.RECEIVE_BOOT_COMPLETED"> <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </receiver> <!-- Registration is complete --> <%activity%> <%receivers%> </application> </manifest> <!-- END_INCLUDE(manifest) --> Now if I reboot I at least get an error and some information in the Log File, but I cannot figure out why is this not working : 04-20 12:38:49.087 2769 2769 E AndroidRuntime: FATAL EXCEPTION: main 04-20 12:38:49.087 2769 2769 E AndroidRuntime: Process: com.embarcadero.XLRBoot, PID: 2769 04-20 12:38:49.087 2769 2769 E AndroidRuntime: java.lang.RuntimeException: Unable to instantiate receiver com.embarcadero.XLRBoot: java.lang.ClassNotFoundException: Didn't find class "com.embarcadero.XLRBoot" on path: DexPathList[[zip file "/data/app/com.embarcadero.XLRBoot-OHpYv4loPMPls2q6DuLOLA==/base.apk"],nativeLibraryDirectories=[/data/app/com.embarcadero.XLRBoot-OHpYv4loPMPls2q6DuLOLA==/lib/arm, /data/app/com.embarcadero.XLRBoot-OHpYv4loPMPls2q6DuLOLA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib, /system/vendor/lib/hw]] 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3174) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.app.ActivityThread.-wrap17(Unknown Source:0) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1675) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.os.Looper.loop(Looper.java:164) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6518) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: Caused by: java.lang.ClassNotFoundException: Didn't find class "com.embarcadero.XLRBoot" on path: DexPathList[[zip file "/data/app/com.embarcadero.XLRBoot-OHpYv4loPMPls2q6DuLOLA==/base.apk"],nativeLibraryDirectories=[/data/app/com.embarcadero.XLRBoot-OHpYv4loPMPls2q6DuLOLA==/lib/arm, /data/app/com.embarcadero.XLRBoot-OHpYv4loPMPls2q6DuLOLA==/base.apk!/lib/armeabi-v7a, /system/lib, /system/vendor/lib, /system/vendor/lib/hw]] 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:379) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at java.lang.ClassLoader.loadClass(ClassLoader.java:312) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: at android.app.ActivityThread.handleReceiver(ActivityThread.java:3169) 04-20 12:38:49.087 2769 2769 E AndroidRuntime: ... 8 more Any ideas what I did wrong here? Thank you.
-
Hello everyone, I am using Delphi 10.3.3 got here Android 10 (also Android 8). Battery Optimization is off . The problem only happens if my Device is on the charger. After approximately 48hrs it dies . I tried to solve this by waking the device up periodically (after 8hrs) . Today it last sent data to the server at 3:00 , so I thought it is dead. But to my big surprise , it still woke up at 08:00 . Unfortunately after touching the screen , to try to open something . Android forced me to close the app. Here is the part of the code : (excuse me for the length, it looks to be long , but is is the bare minimum , I thought I'd include every procedure and function I use in order to perhaps help someone smarter then me see if I am leaking memory or doing something horrible, note : this very same code is NOT crashing or hanging after weeks if Device is not on the charger) procedure TMain.Timer1Timer(Sender: TObject); var SyncTime : TDateTime; TransferTime : TDateTime; begin if FDEviceName = 'error' then Exit; Timer1.Enabled:=false; SyncTime:=inireadDt(FilePath+'/Configuration/settings.conf','Tasks','SyncTime'); if MinutesBetween(now,SyncTime) >= 1 then begin if isDeviceIdleMode = false then begin BatteryLevel := GetBatteryLevel; GetWifiStatus; SendDeviceStatus; iniwrite(FilePath+'/Configuration/settings.conf','Tasks','SyncTime',now); if GetBatteryCharging = 0 then WakeTime := 0; if GetBatteryCharging in [1,2] then inc(WakeTime); // to prevent app from dying we wake up device on the charger after 8 hrs if WakeTime = 480 then begin WakeUpNow; WakeTime:=0; end; end; end; Timer1.Enabled:=true; end; function TMain.GetBatteryLevel; var Filter: JIntentFilter; Battery: JIntent; begin Result:=-1; try Filter := TJIntentFilter.Create; Filter.addAction(TJIntent.JavaClass.ACTION_BATTERY_CHANGED); Battery := TAndroidHelper.Context.registerReceiver(NIL, filter); Result := Battery.getIntExtra(StringToJString('level'), -1); except Result:=-1; end; end; function TMain.GetBatteryCharging; var Filter: JIntentFilter; Battery: JIntent; begin Result:=-1; try Filter := TJIntentFilter.Create; Filter.addAction(TJIntent.JavaClass.ACTION_BATTERY_CHANGED); Battery := TAndroidHelper.Context.registerReceiver(NIL, filter); Result := Battery.getIntExtra(StringToJString('plugged'), -1); except Result:=-1; end; end; procedure TMain.WakeUpNow; var PowerManager : JPowerManager; WakeLock : JPowerManager_WakeLock; begin PowerManager := TJPowerManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.POWER_SERVICE)); WakeLock := PowerManager.newWakeLock(TJPowerManager.JavaClass.FULL_WAKE_LOCK or TJPowerManager.JavaClass.ACQUIRE_CAUSES_WAKEUP,StringToJString('NE_PACK')); WakeLock.acquire; WakeLock.release; WakeLock:=nil; end; procedure TMain.GetWifiStatus; var obj: JObject; WifiMgr : JWifiManager; WifiInfo : JWifiInfo; begin // ACCESS_FINE_LOCATION Permission and muss ALLOW LOCATION Services on Phone SignalStrength := 0; SSID := '-'; try obj := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.WIFI_SERVICE); WifiMgr := TJWifiManager.Wrap((obj as ILocalObject).GetObjectID); WifiInfo := WifiMgr.getConnectionInfo; case WifiInfo.getRssi of -49..0 : SignalStrength:=4; -59..-50 : SignalStrength:=3; -70..-60 : SignalStrength:=2; else SignalStrength:=1; end; SSID := JStringToString(WifiInfo.getSSID); except SignalStrength := 0; SSID := '-'; end; end; procedure TMain.SendDeviceStatus; var SQLConnection : TSQLConnection; Temp : TServerMethods1Client; begin try SQLConnection := TSQLConnection.Create(nil); try SQLConnection.DriverName:='DataSnap'; SQLConnection.Params.Clear; SQLConnection.Params.Add('DriverUnit=Data.DBXDataSnap'); SQLConnection.Params.Add('DriverAssemblyLoader=Borland.Data.TDBXClientDriverLoader,Borland.Data.DbxClientDriver,Version=24.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b'); SQLConnection.Params.Add('DriverName=DataSnap'); SQLConnection.Params.Add('HostName='+FServerIP); SQLConnection.Params.Add('Port='+FServerPort); SQLConnection.Params.Add('Filters={}'); SQLConnection.Params.Add('CommunicationIPVersion=IP_IPv4'); SQLConnection.Params.Add('CommunicationProtocol=tcp/ip'); SQLConnection.Params.Add('DatasnapContext=datasnap/'); SQLConnection.Params.Add('DSProxyPort=8888'); SQLConnection.Params.Add('CommunicationTimeout=500'); SQLConnection.Params.Add('ConnectTimeout=500'); SQLConnection.Connected:=true; Temp := TServerMethods1Client.Create(SQLConnection.DBXConnection); try FOwner := IntToStr(WakeTime); Temp.DEVICE_STATUS(FDeviceName,FOwner,SSID,SoftwareVersion,SignalStrength,BatteryLevel); finally Temp.Free; end; SQLConnection.Close; finally SQLConnection.Free; end; except on E : Exception do begin // nothing end; end; end; Here is the Log file from the last crash : 03-31 07:15:16.070 30336 30374 F libc : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 30374 (RenderThread), pid 30336 (rcadero.NE_PACK) 03-31 07:15:16.296 14307 14307 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 03-31 07:15:16.296 14307 14307 F DEBUG : Build fingerprint: 'Zebra/TC21PG/TC21:10/10-16-10.00-QG-U14-STD-HEL-04/18:user/release-keys' 03-31 07:15:16.296 14307 14307 F DEBUG : Revision: '0' 03-31 07:15:16.296 14307 14307 F DEBUG : ABI: 'arm' 03-31 07:15:16.297 14307 14307 F DEBUG : Timestamp: 2021-03-31 07:15:16+0200 03-31 07:15:16.297 14307 14307 F DEBUG : pid: 30336, tid: 30374, name: RenderThread >>> com.embarcadero.NE_PACK <<< 03-31 07:15:16.297 14307 14307 F DEBUG : uid: 10227 03-31 07:15:16.297 14307 14307 F DEBUG : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr -------- 03-31 07:15:16.297 14307 14307 F DEBUG : Abort message: 'terminating with uncaught exception of type std::__1::system_error: thread constructor failed: Try again' 03-31 07:15:16.297 14307 14307 F DEBUG : r0 00000000 r1 000076a6 r2 00000006 r3 c5d2eb20 03-31 07:15:16.297 14307 14307 F DEBUG : r4 c5d2eb34 r5 c5d2eb18 r6 00007680 r7 0000016b 03-31 07:15:16.297 14307 14307 F DEBUG : r8 c5d2eb30 r9 c5d2eb20 r10 c5d2eb50 r11 c5d2eb40 03-31 07:15:16.298 14307 14307 F DEBUG : ip 000076a6 sp c5d2eaf0 lr ef7e34fb pc ef7e350e 03-31 07:15:16.411 14307 14307 F DEBUG : 03-31 07:15:16.411 14307 14307 F DEBUG : backtrace: 03-31 07:15:16.412 14307 14307 F DEBUG : #00 pc 0006050e /apex/com.android.runtime/lib/bionic/libc.so (abort+166) (BuildId: 8549daf46b82d53f76c6449b777e63ee) 03-31 07:15:16.412 14307 14307 F DEBUG : #01 pc 0003606b /system/lib/libc++.so (abort_message+86) (BuildId: ed0f2f56655f3bf72ea2135f610dee0b) 03-31 07:15:16.412 14307 14307 F DEBUG : #02 pc 000361f3 /system/lib/libc++.so (demangling_terminate_handler()+178) (BuildId: ed0f2f56655f3bf72ea2135f610dee0b) 03-31 07:15:16.412 14307 14307 F DEBUG : #03 pc 00046837 /system/lib/libc++.so (std::__terminate(void (*)())+2) (BuildId: ed0f2f56655f3bf72ea2135f610dee0b) 03-31 07:15:16.412 14307 14307 F DEBUG : #04 pc 00046091 /system/lib/libc++.so (__cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception*)+12) (BuildId: ed0f2f56655f3bf72ea2135f610dee0b) 03-31 07:15:16.412 14307 14307 F DEBUG : #05 pc 00045ffd /system/lib/libc++.so (__cxa_throw+72) (BuildId: ed0f2f56655f3bf72ea2135f610dee0b) 03-31 07:15:16.412 14307 14307 F DEBUG : #06 pc 000826cf /system/lib/libc++.so (std::__1::__throw_system_error(int, char const*)+82) (BuildId: ed0f2f56655f3bf72ea2135f610dee0b) 03-31 07:15:16.412 14307 14307 F DEBUG : #07 pc 0000e65f /system/lib/libEGL.so (android::egl_cache_t::setBlob(void const*, long, void const*, long)+230) (BuildId: 338a4d9b681c482215c94f50c9c7e1b8) 03-31 07:15:16.412 14307 14307 F DEBUG : #08 pc 0000e515 /system/lib/libEGL.so (android::setBlob(void const*, long, void const*, long)+20) (BuildId: 338a4d9b681c482215c94f50c9c7e1b8) 03-31 07:15:16.412 14307 14307 F DEBUG : #09 pc 001000eb /vendor/lib/egl/libGLESv2_adreno.so (BuildId: 98c923de8a462f5fbc3bd0621f98282b) 03-31 07:15:16.412 14307 14307 F DEBUG : #10 pc 000945dd /vendor/lib/egl/libGLESv2_adreno.so (BuildId: 98c923de8a462f5fbc3bd0621f98282b) 03-31 07:15:16.412 14307 14307 F DEBUG : #11 pc 001cd267 /system/lib/libhwui.so (GrGLCompileAndAttachShader(GrGLContext const&, unsigned int, unsigned int, char const*, int, GrGpu::Stats*, SkSL::Program::Settings const&)+86) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #12 pc 001cc245 /system/lib/libhwui.so (GrGLProgramBuilder::compileAndAttachShaders(char const*, int, unsigned int, unsigned int, SkTDArray<unsigned int>*, SkSL::Program::Settings const&, SkSL::Program::Settings::Inputs const&)+32) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #13 pc 001cb57b /system/lib/libhwui.so (GrGLProgramBuilder::CreateProgram(GrRenderTarget*, GrSurfaceOrigin, GrPrimitiveProcessor const&, GrTextureProxy const* const*, GrPipeline const&, GrProgramDesc*, GrGLGpu*)+866) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #14 pc 001c7957 /system/lib/libhwui.so (GrGLGpu::ProgramCache::refProgram(GrGLGpu*, GrRenderTarget*, GrSurfaceOrigin, GrPrimitiveProcessor const&, GrTextureProxy const* const*, GrPipeline const&, bool)+190) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #15 pc 001c6dfd /system/lib/libhwui.so (GrGLGpu::flushGLState(GrRenderTarget*, GrSurfaceOrigin, GrPrimitiveProcessor const&, GrPipeline const&, GrPipeline::FixedDynamicState const*, GrPipeline::DynamicStateArrays const*, int, bool)+72) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #16 pc 001c68ff /system/lib/libhwui.so (GrGLGpu::draw(GrRenderTarget*, GrSurfaceOrigin, GrPrimitiveProcessor const&, GrPipeline const&, GrPipeline::FixedDynamicState const*, GrPipeline::DynamicStateArrays const*, GrMesh const*, int)+86) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #17 pc 001c689f /system/lib/libhwui.so (GrGLGpuRTCommandBuffer::onDraw(GrPrimitiveProcessor const&, GrPipeline const&, GrPipeline::FixedDynamicState const*, GrPipeline::DynamicStateArrays const*, GrMesh const*, int, SkRect const&)+30) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #18 pc 001858d3 /system/lib/libhwui.so (GrGpuRTCommandBuffer::draw(GrPrimitiveProcessor const&, GrPipeline const&, GrPipeline::FixedDynamicState const*, GrPipeline::DynamicStateArrays const*, GrMesh const*, int, SkRect const&)+166) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #19 pc 00185633 /system/lib/libhwui.so (GrOpFlushState::executeDrawsAndUploadsForMeshDrawOp(GrOp const*, SkRect const&, GrProcessorSet&&, unsigned int, GrUserStencilSettings const*)+310) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #20 pc 003d800f /system/lib/libhwui.so (_ZN12_GLOBAL__N_121ShadowCircularRRectOp9onExecuteEP14GrOpFlushStateRK6SkRect$3d75113d8bcc59e80cffa524fd584b8c+50) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #21 pc 001b435f /system/lib/libhwui.so (GrOp::execute(GrOpFlushState*, SkRect const&)+50) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #22 pc 001b41bf /system/lib/libhwui.so (GrRenderTargetOpList::onExecute(GrOpFlushState*)+282) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.412 14307 14307 F DEBUG : #23 pc 001f9deb /system/lib/libhwui.so (GrDrawingManager::flush(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess, GrFlushFlags, int, GrBackendSemaphore*, void (*)(void*), void*)+1086) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #24 pc 001f9921 /system/lib/libhwui.so (GrDrawingManager::prepareSurfaceForExternalIO(GrSurfaceProxy*, SkSurface::BackendSurfaceAccess, GrFlushFlags, int, GrBackendSemaphore*, void (*)(void*), void*)+128) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #25 pc 001f97eb /system/lib/libhwui.so (GrRenderTargetContext::prepareForExternalIO(SkSurface::BackendSurfaceAccess, GrFlushFlags, int, GrBackendSemaphore*, void (*)(void*), void*)+86) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #26 pc 001f978b /system/lib/libhwui.so (SkGpuDevice::flush()+22) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #27 pc 001b87fd /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaPipeline::renderFrame(android::uirenderer::LayerUpdateQueue const&, SkRect const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode>>> const&, bool, android::uirenderer::Rect const&, sk_sp<SkSurface>, SkMatrix const&)+140) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #28 pc 001b852b /system/lib/libhwui.so (android::uirenderer::skiapipeline::SkiaOpenGLPipeline::draw(android::uirenderer::renderthread::Frame const&, SkRect const&, SkRect const&, android::uirenderer::LightGeometry const&, android::uirenderer::LayerUpdateQueue*, android::uirenderer::Rect const&, bool, android::uirenderer::LightInfo const&, std::__1::vector<android::sp<android::uirenderer::RenderNode>, std::__1::allocator<android::sp<android::uirenderer::RenderNode>>> const&, android::uirenderer::FrameInfoVisualizer*)+266) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #29 pc 001f4ff5 /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::draw()+236) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #30 pc 001f45c1 /system/lib/libhwui.so (android::uirenderer::renderthread::DrawFrameTask::run()+156) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #31 pc 00202789 /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+164) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #32 pc 002025e1 /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+72) (BuildId: f865daa467db141161db34e821858eaa) 03-31 07:15:16.413 14307 14307 F DEBUG : #33 pc 0000da2b /system/lib/libutils.so (android::Thread::_threadLoop(void*)+214) (BuildId: abcd5dd14a985ca140ae57aced79ae67) 03-31 07:15:16.413 14307 14307 F DEBUG : #34 pc 000aaa3b /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: 8549daf46b82d53f76c6449b777e63ee) Help would be much appriciated. Thank you for your time.
-
I would not believe this if not seeing it with my own eyes . it looks like I need to check if I am in Interactive mode . If I am not in interactive mode then I must do the Reports Back to the Server less often . 15 Minutes instead of 1 Minutes for example. And behold I started the App on 31.03.2021 14:02:40 , and it is 06.04.2021 06:11 and is still running . All other Versions with Anonymous Threads etc. all died. Only this one with 15 Minutes between the jobs survived. I've read somewhere that an app is only allowed to execute once in 10 minutes if in Doze mode. But can't seem to recall where . Maybe this was the reason why it was killed after two days when running on a 1 Minute Interval. The code looks like this : if isInteractive = true then SyncPeriod := 1 else SyncPeriod := 15; SyncTime:=inireadDt(FilePath+'/Configuration/settings.conf','Tasks','SyncTime'); if MinutesBetween(now,SyncTime) >= SyncPeriod then begin if isDeviceIdleMode = false then begin BatteryLevel := GetBatteryLevel; GetWifiStatus; SendDeviceStatus; iniwrite(FilePath+'/Configuration/settings.conf','Tasks','SyncTime',now); end; end;
-
I am running in Kiosk mode 🙂 ( sorry I thought it was irrelevant... ) but this only helps that much if my app dies... it is simply restart... but only if the user actually interacts with the thing.
-
it is Reproducible 🙂 it dies after approx 48hrs 😞 . Always but only on Charger. I made now this above version and another where I only send data every 15 minutes to see if that makes a difference. If neither of them does . Then I will simply check if I am on charger and send data for maybe 8 hrs and after that stop until someone turns the device on . Maybe I am attacking this from a completely wrong standpoint, maybe the Android Device is not meant to be used like this. (if I only have the timer... it works, I am dying 100% because of sending data, and this only happens on the Charger, which is perhaps happening because on the Charger the Android Device is doing a lot more Maintenance jobs and maybe killing my app to release memory for itself... )
-
I have altered the WakeUpNow procedure a bit : procedure TMain.WakeUpNow; var PowerManager : JPowerManager; WakeLock : JPowerManager_WakeLock; begin PowerManager := TJPowerManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.POWER_SERVICE)); // WakeLock := PowerManager.newWakeLock(TJPowerManager.JavaClass.FULL_WAKE_LOCK or TJPowerManager.JavaClass.ACQUIRE_CAUSES_WAKEUP,StringToJString('NE_PACK')); WakeLock := PowerManager.newWakeLock(TJPowerManager.JavaClass.PARTIAL_WAKE_LOCK,StringToJstring('NE_PACK')); WakeLock.acquire; WakeLock.release; WakeLock:=nil; end; I am not 100% sure , but this will wake up the CPU and imediatelly allow it to go back to sleep or whatever it was doing. I also altered the Timer1.Timer1Timer Procedure a bit , for more security I start a Anonymous Thread for this job. Also I have changed the Connection and Communication Timeout to 100ms instead of 500ms . procedure TMain.Timer1Timer(Sender: TObject); var SyncTime : TDateTime; TransferTime : TDateTime; begin if FDEviceName = 'error' then Exit; Timer1.Enabled:=false; SyncTime:=inireadDt(FilePath+'/Configuration/settings.conf','Tasks','SyncTime'); if MinutesBetween(now,SyncTime) >= 1 then begin if isDeviceIdleMode = false then begin // created a thread and set the timeout to 100 intead of 500 TThread.CreateAnonymousThread(procedure() begin BatteryLevel := GetBatteryLevel; GetWifiStatus; SendDeviceStatus; end).Start; iniwrite(FilePath+'/Configuration/settings.conf','Tasks','SyncTime',now); if GetBatteryCharging = 0 then WakeTime := 0; if GetBatteryCharging in [1,2] then inc(WakeTime); // to prevent app from dying we wake up device on the charger after 8 hrs if WakeTime = 480 then begin WakeUpNow; WakeTime:=0; end; end; end; Timer1.Enabled:=true; end; Now I will have to wait. Unfortunately for me it takes almost 2 Days to find out if this solved my problem . Or not.
-
Hi, I only do this FULL_WAKEUP because it keeps my software running actually longer . (But only when on charger. ) So I only wake up in order to help my software stay alive, i would be fine without this... maybe I will do it with PARTIAL_WAKE_LOCK instead. If the Device is NOT on the charger ... it runs for weeks (with or without FULL_WAKEUP).