Skip to content

Commit

Permalink
comments added
Browse files Browse the repository at this point in the history
  • Loading branch information
devrath committed Jan 4, 2024
1 parent a1c183f commit ff74b88
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ fun CurrentScreen() {
context.startService(it)
}
}) {
Text(text = "Start run")
Text(text = "Start Service")
}
Button(onClick = {
Intent(context,StopwatchService::class.java).also {
it.action = StopwatchService.Actions.STOP.toString()
context.startService(it)
}
}) {
Text(text = "Stop run")
Text(text = "Stop Service")
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ import com.istudio.app.util.Constants.NOTIFICATION_ID

class StopwatchService : Service() {

companion object {
}

override fun onBind(intent: Intent?): IBinder? {
return null
}


/**
* This method is triggered when another android component sends intent to the running service
*/
Expand All @@ -39,7 +35,7 @@ class StopwatchService : Service() {
val notification = NotificationCompat
.Builder(this,NOTIFICATION_CHANNEL_ID).setSmallIcon(R.mipmap.ic_launcher)
.setContentTitle("Stop Watch")
.setContentText("Timer running : 00:50")
.setContentText("Content of the notification")
.build()

startForeground(NOTIFICATION_ID,notification)
Expand Down

0 comments on commit ff74b88

Please sign in to comment.