70.5 Creating the PendingIntent
The steps to creating the PendingIntent are the same as those outlined in the “An Android Notifications Tutorial” chapter, with the exception that the intent will be configured to launch MainActivity. Remaining within the MainActivity.kt file, add the code to create the PendingIntent as follows:
fun sendNotification(view: View) {
.
.
val resultIntent = Intent(this, MainActivity::class.java)
val resultPendingIntent = PendingIntent.getActivity(
this,
0,
resultIntent,
PendingIntent.FLAG_UPDATE_CURRENT
)
}