美文网首页
Android apk崩溃后自动重启

Android apk崩溃后自动重启

作者: 冻柠猹 | 来源:发表于2019-08-09 11:49 被阅读0次

    首先在manifes中设置为系统级应用

    在manifest标签中添加android:sharedUserId="android.uid.system"

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.flyscale.atclient"
        android:sharedUserId="android.uid.system"
        >
    

    在application中添加属性

    在application标签添加android:persistent="true"

    <application
            android:name=".global.MyApplication"
            android:allowBackup="true"
            android:persistent="true" 
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/activity_Theme">
    

    这样你的进程就会在异常崩溃或者被杀死后会自动重启。

    相关文章

      网友评论

          本文标题:Android apk崩溃后自动重启

          本文链接:https://www.haomeiwen.com/subject/qvbcjctx.html