Skip to content

Commit

Permalink
update broadcast receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
virgile fantauzzi committed Oct 20, 2024
1 parent d8463f3 commit f43c6f1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/src/main/java/com/openclassrooms/rebonnte/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ class MainActivity : ComponentActivity() {
startBroadcastReceiver()
}

private fun startMyBroadcast() {
val intent = Intent("com.rebonnte.ACTION_UPDATE")
sendBroadcast(intent)
startBroadcastReceiver()
}

private fun startBroadcastReceiver() {
myBroadcastReceiver = MyBroadcastReceiver()
val filter = IntentFilter().apply {
Expand All @@ -96,9 +102,8 @@ class MainActivity : ComponentActivity() {
}

Handler().postDelayed({
val intent = Intent("com.rebonnte.ACTION_UPDATE")
sendBroadcast(intent)
}, 5000)
startMyBroadcast()
}, 200)
}


Expand Down

0 comments on commit f43c6f1

Please sign in to comment.