Unfortunately, not only live Internet radio players are designed to play in background. GPS navigation apps which gives people voice instructions how to travel and when The phone screen have been turned off is The next example. So what if somebody would try to develop such apps by using PPCJVM, Android JVM target. Somebody would like to develop for Android? I have found out, that simply using manage application startups and run in background system setting will really not solve this programmers issue. Simply adding some permissions to androidmanifest.xml without A corresponding code is also not a functioning solution.
So what should we had to do to solve this problem? Simply do not panic. Use even incomplete Android Pascal Api header files. Here is The code example. Add <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> to The androidmanifest.xml And add The following lines to yours Pascal code. To The variables declaration source code part) pm: AOPowerManager; intent: ACIntent; And to The relevant other source code part pm:= AOPowerManager(getSystemService(ACContext.POWER_SERVICE)) ; if (AOBuild.InnerVERSION.fSDK_INT >= AOBuild.InnerVERSION_CODES.M) then begin if (not pm.isIgnoringBatteryOptimizations(getPackageName())) then begin // Prompt the user to disable battery optimization intent := ACIntent.create; intent.setAction(APSettings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); startActivity(intent); end; end; In this case, you will have 100 % insurance that yours app will never stop run in background. It is for ANdroid 7 and newer. _______________________________________________ fpc-other maillist - fpc-other@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-other