Skip to content

Commit

Permalink
Merge pull request #44 from KoalaSat/fix-app-recover-on-boot
Browse files Browse the repository at this point in the history
Fix app recovery on boot
  • Loading branch information
KoalaSat authored Nov 14, 2024
2 parents 55d6876 + 4085b16 commit e26ecb4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/src/main/java/com/koalasat/pokey/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

EncryptedStorage.init(this)
ExternalSigner.init(this)
init()

binding = ActivityMainBinding.inflate(layoutInflater)
setContentView(binding.root)
Expand Down Expand Up @@ -73,4 +72,9 @@ class MainActivity : AppCompatActivity() {
}
}
}

fun init() {
EncryptedStorage.init(this)
ExternalSigner.init(this)
}
}
2 changes: 2 additions & 0 deletions app/src/main/java/com/koalasat/pokey/service/BootReceiver.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Intent
import android.os.Build
import android.util.Log
import com.koalasat.pokey.Pokey
import com.koalasat.pokey.models.EncryptedStorage

class BootReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Expand Down Expand Up @@ -38,6 +39,7 @@ class BootReceiver : BroadcastReceiver() {
if (intent.action == Intent.ACTION_BOOT_COMPLETED) {
Log.d("BootReceiver", "Starting ConnectivityService ACTION_BOOT_COMPLETED")
if (Pokey.isForegroundServiceEnabled(context)) {
EncryptedStorage.init(context)
context.startForegroundService(
Intent(
context,
Expand Down

0 comments on commit e26ecb4

Please sign in to comment.