mirror of https://github.com/lizongying/my-tv.git
parent
2b4b823946
commit
c8d59d5aab
@ -0,0 +1,19 @@ |
||||
package com.lizongying.mytv |
||||
|
||||
import android.content.BroadcastReceiver |
||||
import android.content.Context |
||||
import android.content.Intent |
||||
|
||||
class BootReceiver : BroadcastReceiver() { |
||||
|
||||
override fun onReceive(context: Context, intent: Intent) { |
||||
val sp = context.getSharedPreferences("MainActivity", Context.MODE_PRIVATE) |
||||
if (sp.getBoolean(MainActivity.BOOT_STARTUP, true)) { |
||||
context.startActivity( |
||||
Intent(context, MainActivity::class.java) |
||||
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) |
||||
) |
||||
} |
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue