Skip to content

Commit

Permalink
Add a pending intent
Browse files Browse the repository at this point in the history
  • Loading branch information
erikrios committed Feb 9, 2021
1 parent ff7be64 commit 91c9dfd
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package com.erikriosetiawan.simplenotif

import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.View
Expand All @@ -28,9 +31,13 @@ class MainActivity : AppCompatActivity() {
}

fun sendNotification(view: View) {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("http://dicoding.com"))
val pendingIntent = PendingIntent.getActivity(this, 0, intent, 0)

val mNotificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val mBuilder = NotificationCompat.Builder(this, CHANNEL_ID)
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_baseline_notifications_24)
.setLargeIcon(
BitmapFactory.decodeResource(
Expand Down

0 comments on commit 91c9dfd

Please sign in to comment.