应用永驻,避免被low memory kill

作者 by adtxl / 2022-02-21 / 暂无评论 / 339 个足迹

可以添加android:persistent="true",这样会在开机时启动该应用

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.xxx.SubTitleService"
    android:versionCode="1"
    android:versionName="1.0"
    android:sharedUserId="android.uid.system">
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="xxx.permission.SYSTEM_CONTROL" />
    <application
        android:persistent="true">
        <service
            android:name=".SubTitleServer"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.xxx.SubTitleServer"/>
            </intent-filter>
        </service>
    </application>
</manifest>

独特见解