Skip to content

Instantly share code, notes, and snippets.

@alperenbabagil
Created August 17, 2020 06:49
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 alperenbabagil/18264a532fb4d76cbb1f4ba5514513fc to your computer and use it in GitHub Desktop.
Save alperenbabagil/18264a532fb4d76cbb1f4ba5514513fc to your computer and use it in GitHub Desktop.
val builder = NotificationCompat.Builder(context, AppNavigator.NOTF_CHANNEL_ID)
.setSmallIcon(android.R.drawable.arrow_up_float)
.setContentTitle(context.getString(R.string.app_name))
.setContentText(context.getString(R.string.channel_description))
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setCategory(NotificationCompat.CATEGORY_CALL)
.setAutoCancel(true)
val pendingIntent = PendingIntent.getActivity(context,
0,
Intent(context, RingActivity::class.java),
PendingIntent.FLAG_UPDATE_CURRENT)
builder.setFullScreenIntent(pendingIntent,true) // setting full screen intent here
val mgr =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
mgr.cancel(notfId)
mgr.notify(notfId,builder.build())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment