Guest User

Untitled

a guest
Jul 17th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. private fun fireNotification() {
  2. var anotherIntent:Intent=Intent(this,ReminderActivity::class.java)
  3. var p1:PendingIntent= PendingIntent.getActivity(this,0,anotherIntent,0)
  4. val defaultSoundUri=RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION)
  5.  
  6. var notifyManager: NotificationManager =getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
  7.  
  8. var notification:Notification=NotificationCompat.Builder(this)
  9. .setContentTitle("Medicine Time")
  10. .setSmallIcon(R.mipmap.ic_launcher)
  11. .setSound(defaultSoundUri)
  12. .setContentText("Time to take your medicine")
  13. .setContentIntent(p1)
  14. .setAutoCancel(true)
  15. .build()
  16. notifyManager.notify(0,notification)
  17. }
Add Comment
Please, Sign In to add comment