Skip to content

Commit

Permalink
v1.1-apk
Browse files Browse the repository at this point in the history
  • Loading branch information
Scout4all committed Feb 27, 2023
1 parent e089a51 commit 339ca62
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ fun sendNotification(context: Context, reminderDataItem: ReminderDataItem) {

val intent = ReminderDescriptionActivity.newIntent(context.applicationContext, reminderDataItem)

val pendingIntentFlag = if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S){
PendingIntent.FLAG_IMMUTABLE
}else{
PendingIntent.FLAG_UPDATE_CURRENT
}

//create a pending intent that opens ReminderDescriptionActivity when the user clicks on the notification
val stackBuilder = TaskStackBuilder.create(context)
.addParentStack(ReminderDescriptionActivity::class.java)
.addNextIntent(intent)
val notificationPendingIntent = stackBuilder
.getPendingIntent(reminderDataItem.notification_id, PendingIntent.FLAG_UPDATE_CURRENT)
.getPendingIntent(reminderDataItem.notification_id, pendingIntentFlag)
val contentText = "you have arrived to ${reminderDataItem.location}"
// build the notification object with the data to be shown
val notification = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
Expand All @@ -52,4 +58,3 @@ fun sendNotification(context: Context, reminderDataItem: ReminderDataItem) {
notificationManager.notify(reminderDataItem.notification_id, notification)
}

//private fun getUniqueId() = ((System.currentTimeMillis() % 10000).toInt())

0 comments on commit 339ca62

Please sign in to comment.