70.3 Creating the Notification Channel
As with the example in the previous chapter, a channel must be created before a notification can be sent. Edit the MainActivity.kt file and add code to create a new channel as follows:
.
.
import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.Context
import android.graphics.Color
.
.
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
private var notificationManager: NotificationManager? = null
private val channelID = "com.ebookfrenzy.directreply.news"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater...