title: Android Kotlin - set a notification for a future date
body: <p>I've tried to follow this <a href="https://stackoverflow.com/q/28017943/14375385">Stack Overflow post</a> for setting a notification for future dates but something isn't working as the notification never comes. Let me know if more information is needed</p>
  <pre><code>class AddReminderActivity : AppCompatActivity() {
  
          val saveButton: Button = findViewById(R.id.reminder_save_button)
          saveButton.setOnClickListener {
              val editText: EditText = findViewById(R.id.reminder_title)
              val reminderTitle = editText.text.toString()
  
              val intent = Intent(this, Receiver::class.java)
              intent.putExtra(&quot;reminderTitle&quot;, reminderTitle)
              val pendingIntent = PendingIntent.getBroadcast(this, 1, intent, PendingIntent.FLAG_IMMUTABLE)
  
              val am: AlarmManager = getSystemService(ALARM_SERVICE) as AlarmManager
              am.set(AlarmManager.RTC_WAKEUP, combinedCal.timeInMillis, pendingIntent)
         }
  }
  
  
  
  class Receiver : Service() {
      lateinit var reminderTitle: String
      override fun onBind(intent: Intent): IBinder? {
          return null
      }
  
      override fun onCreate() {
          val intent = Intent(this, AddReminderActivity::class.java)
          val pattern = longArrayOf(0, 300, 0)
          val pi = PendingIntent.getActivity(this, 1234, intent, PendingIntent.FLAG_IMMUTABLE)
          reminderTitle = intent.getStringExtra(&quot;reminderTitle&quot;).toString()
  
          val builder = NotificationCompat.Builder(this)
              .setContentTitle(reminderTitle)
              .setVibrate(pattern).setAutoCancel(true)
  
          builder.setContentIntent(pi)
          builder.setDefaults(Notification.DEFAULT_SOUND)
          builder.setAutoCancel(true)
          val notificationManager =
              this.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
          notificationManager.notify(1234, builder.build())
  
      }
  }
  </code></pre>