/ Miscellaneous

Improve the android service process priority

Improve the android service process priority

android-keeplive

Improve the android service process priority

Gradle

compile 'com.carmelo:keeplive:1.0.0'

usage

public class DemoService extends KeepliveService{
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        int i = super.onStartCommand(intent, flags, startId);
        //do something
        return i;
    }
}

在manifest.xml注册service并且指定进程为 :live

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.carmelo.androidkeeplive">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <service android:name=".DemoService"
            android:process=":live"/>
    </application>

</manifest>

GitHub