Skip to content

Instantly share code, notes, and snippets.

@Arunshaik2001
Created November 22, 2022 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Arunshaik2001/f9fd7de40ecb0237fc603b614da3dd77 to your computer and use it in GitHub Desktop.
Save Arunshaik2001/f9fd7de40ecb0237fc603b614da3dd77 to your computer and use it in GitHub Desktop.
fun createFullScreenIntentNotification(context: Context){
val fullScreenIntent = Intent(context, MainActivity2::class.java)
val fullScreenPendingIntent = PendingIntent.getActivity(context, 0,
fullScreenIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_MUTABLE)
val notificationBuilder =
NotificationCompat.Builder(context, NotificationChannels.CHANNEL1)
.setSmallIcon(R.drawable.desk)
.setContentTitle("Incoming call")
.setContentText("+9178458787XXX")
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setFullScreenIntent(fullScreenPendingIntent, true)
val incomingCallNotification = notificationBuilder.build()
with(NotificationManagerCompat.from(context)) {
notify(1445457, incomingCallNotification)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment