Android Question Any ideas why this other app is able to keep running during device stress when my app can not?

JohnC

Expert
Licensed User
Longtime User
Below is the manifest of an app that is very good at making sure it keeps running, even when the device is under huge stress from a benchmark test app.

Some background: This other app and my app both have an "animated" visual indicator (in an overlay) to indicate that our apps are actively running.

I will start boths apps, then run a benchmark app that does a lot of memory/storage tests that causes both apps to crash (the indicator goes away or stops animation) during the multiple tests the benchmakr app does over a 5 minute period.

But for some reason this other app stays running 99+% of the time during the test and is ALWAYS running at the end of the test.

But my app will only run around 75% of the time (respawning multiple times) and sometimes my app won't even be running by the end of the test.

My app tries to respawn in multiple ways like setting it's service to "Sticky" (both apps are targeting SDK 21), and I am using StartServiceAt at multiple points.

So, below is the manifest of this other app and I am hoping that someone might see something in it that might be the reason why it keeps alive so well:
B4X:
<?xml version="1.0" encoding="UTF-8"?>
-<manifest platformBuildVersionName="13" platformBuildVersionCode="33" package="com.KeepAlive.app" android:compileSdkVersionCodename="13" android:compileSdkVersion="33" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>

-<application android:name="android.app.Application" android:label="KeepAlive" android:icon="@mipmap/ic_launcher" android:appComponentFactory="androidx.core.app.CoreComponentFactory">

-<activity android:name="com.keepalive.app.MainActivity" android:windowSoftInputMode="adjustResize" android:theme="@style/LaunchTheme" android:launchMode="singleTop" android:hardwareAccelerated="true" android:exported="true" android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|orientation|screenLayout|screenSize|smallestScreenSize|uiMode">
<meta-data android:name="io.flutter.embedding.android.NormalTheme" android:resource="@style/NormalTheme"/>
-<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
</intent-filter>
</activity>

<service android:name="flutter.overlay.window.flutter_overlay_window.OverlayService" android:exported="false"/>
<service android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmService" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"/>
<receiver android:name="dev.fluttercommunity.plus.androidalarmmanager.AlarmBroadcastReceiver" android:exported="false"/>
-<receiver android:name="dev.fluttercommunity.plus.androidalarmmanager.RebootBroadcastReceiver" android:exported="false" android:enabled="false">
-<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

<meta-data android:name="flutterEmbedding" android:value="2"/>

-<service android:name="com.google.firebase.components.ComponentDiscoveryService" android:exported="false" android:directBootAware="true">
<meta-data android:name="com.google.firebase.components:io.flutter.plugins.firebase.crashlytics.FlutterFirebaseAppRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:io.flutter.plugins.firebase.analytics.FlutterFirebaseAppRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:io.flutter.plugins.firebase.core.FlutterFirebaseCoreRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.crashlytics.CrashlyticsRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
<meta-data android:name="com.google.firebase.components:com.google.firebase.installations.FirebaseInstallationsRegistrar" android:value="com.google.firebase.components.ComponentRegistrar"/>
</service>

<receiver android:name="com.dexterous.flutterlocalnotifications.ActionBroadcastReceiver" android:exported="false"/>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" android:exported="false"/>
-<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver" android:exported="false">
-<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>

-<provider android:name="com.crazecoder.openfile.FileProvider" android:exported="false" android:grantUriPermissions="true" android:authorities="com.keepalive.app.fileProvider.com.crazecoder.openfile">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths"/>
</provider>
<service android:name="id.flutter.flutter_background_service.BackgroundService" android:exported="true" android:enabled="true" android:stopWithTask="false"/>
<receiver android:name="id.flutter.flutter_background_service.WatchdogReceiver" android:exported="true" android:enabled="true"/>
-<receiver android:name="id.flutter.flutter_background_service.BootReceiver" android:exported="true" android:enabled="true">
-<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
</intent-filter>
</receiver>

<uses-library android:name="androidx.window.extensions" android:required="false"/>
<uses-library android:name="androidx.window.sidecar" android:required="false"/>

<provider android:name="com.google.firebase.provider.FirebaseInitProvider" android:exported="false" android:directBootAware="true" android:authorities="com.keepalive.app.firebaseinitprovider" android:initOrder="100"/>
-<provider android:name="androidx.startup.InitializationProvider" android:exported="false" android:authorities="com.keepalive.app.androidx-startup">
<meta-data android:name="androidx.work.WorkManagerInitializer" android:value="androidx.startup"/>
</provider>

<service android:name="androidx.work.impl.background.systemalarm.SystemAlarmService" android:exported="false" android:enabled="@bool/enable_system_alarm_service_default" android:directBootAware="false"/>
<service android:name="androidx.work.impl.background.systemjob.SystemJobService" android:exported="true" android:permission="android.permission.BIND_JOB_SERVICE" android:enabled="@bool/enable_system_job_service_default" android:directBootAware="false"/>
<service android:name="androidx.work.impl.foreground.SystemForegroundService" android:exported="false" android:enabled="@bool/enable_system_foreground_service_default" android:directBootAware="false"/>

<receiver android:name="androidx.work.impl.utils.ForceStopRunnable$BroadcastReceiver" android:exported="false" android:enabled="true" android:directBootAware="false"/>
-<receiver android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryChargingProxy" android:exported="false" android:enabled="false" android:directBootAware="false">
-<intent-filter>
<action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
</intent-filter>
</receiver>

-<receiver android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryNotLowProxy" android:exported="false" android:enabled="false" android:directBootAware="false">
-<intent-filter>
<action android:name="android.intent.action.BATTERY_OKAY"/>
<action android:name="android.intent.action.BATTERY_LOW"/>
</intent-filter>
</receiver>

-<receiver android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$StorageNotLowProxy" android:exported="false" android:enabled="false" android:directBootAware="false">
-<intent-filter>
<action android:name="android.intent.action.DEVICE_STORAGE_LOW"/>
<action android:name="android.intent.action.DEVICE_STORAGE_OK"/>
</intent-filter>
</receiver>

-<receiver android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy" android:exported="false" android:enabled="false" android:directBootAware="false">
-<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>
</intent-filter>
</receiver>

-<receiver android:name="androidx.work.impl.background.systemalarm.RescheduleReceiver" android:exported="false" android:enabled="false" android:directBootAware="false">
-<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.TIME_SET"/>
<action android:name="android.intent.action.TIMEZONE_CHANGED"/>
</intent-filter>
</receiver>

-<receiver android:name="androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver" android:exported="false" android:enabled="@bool/enable_system_alarm_service_default" android:directBootAware="false">
-<intent-filter>
<action android:name="androidx.work.impl.background.systemalarm.UpdateProxies"/>
</intent-filter>
</receiver>

-<receiver android:name="androidx.work.impl.diagnostics.DiagnosticsReceiver" android:exported="true" android:permission="android.permission.DUMP" android:enabled="true" android:directBootAware="false">
-<intent-filter>
<action android:name="androidx.work.diagnostics.REQUEST_DIAGNOSTICS"/>
</intent-filter>
</receiver>

<receiver android:name="com.google.android.gms.measurement.AppMeasurementReceiver" android:exported="false" android:enabled="true"/>
<service android:name="com.google.android.gms.measurement.AppMeasurementService" android:exported="false" android:enabled="true"/>
<service android:name="com.google.android.gms.measurement.AppMeasurementJobService" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE" android:enabled="true"/>
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<service android:name="androidx.room.MultiInstanceInvalidationService" android:exported="false" android:directBootAware="true"/>

-<service android:name="com.google.android.datatransport.runtime.backends.TransportBackendDiscovery" android:exported="false">
<meta-data android:name="backend:com.google.android.datatransport.cct.CctBackendFactory" android:value="cct"/>
</service>

<service android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService" android:exported="false" android:permission="android.permission.BIND_JOB_SERVICE"/>

<receiver android:name="com.google.android.datatransport.runtime.scheduling.jobscheduling.AlarmManagerSchedulerBroadcastReceiver" android:exported="false"/>

</application>

</manifest>
 
Last edited:
Top