|
|
|
@ -3,6 +3,7 @@ package io.github.acedroidx.frp
|
|
|
|
|
import android.content.BroadcastReceiver
|
|
|
|
|
import android.content.Context
|
|
|
|
|
import android.content.Intent
|
|
|
|
|
import android.os.Build
|
|
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
|
|
|
|
|
|
|
class AutoStartBroadReceiver : BroadcastReceiver() {
|
|
|
|
@ -13,11 +14,13 @@ class AutoStartBroadReceiver : BroadcastReceiver() {
|
|
|
|
|
val auto_start = editor.getBoolean("auto_start", false)
|
|
|
|
|
if (ACTION == intent.action && auto_start) {
|
|
|
|
|
//开机启动
|
|
|
|
|
val mainIntent = Intent(context, MainActivity::class.java)
|
|
|
|
|
mainIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
|
|
|
|
context.startActivity(mainIntent)
|
|
|
|
|
val mainIntent = Intent(context, ShellService::class.java)
|
|
|
|
|
mainIntent.putExtra("filename", BuildConfig.FrpcFileName)
|
|
|
|
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
|
|
|
context.startForegroundService(mainIntent)
|
|
|
|
|
}else{
|
|
|
|
|
context.startService(mainIntent)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|