Skip to content

Commit

Permalink
Recover service after crash
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Jan 3, 2025
1 parent 12733ff commit 5844bb6
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ class ConnectivityService : Service() {
override fun onCreate() {
if (isStarted) return

Log.d("ConnectivityService", "onCreate")

isStarted = true
startForeground(1, createNotification())

Expand Down Expand Up @@ -177,4 +179,9 @@ class ConnectivityService : Service() {
}
super.onDestroy()
}

override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
Log.d("ConnectivityService", "onStartCommand")
return START_STICKY
}
}

0 comments on commit 5844bb6

Please sign in to comment.