3

I have 3 questions:

  1. I have 2 tables category and task. category table contains the following fields

id(int), name(text), status(int))

enter image description here

and the task table contains following fields:

id(int), category_id(Foreign_key referenced from category table), name(text), createdDate(datetime), modifiedDate(datetime), dueDate(timestamp)

enter image description here

I have to notify the user 30 minutes before the dueDate(timestamp), in my case there will be n no of tasks for the same time so I have to show local notification for all the tasks. How can I achieve this?

  1. For both the category and task I'm having the edit and delete functionality with context option. If I update the task the local notification should change accordingly. How can I achieve this?

  2. Onclick the notification, it should redirect to the corresponding task page which is a child activity of Category(MainActivity or Parent activity). How can I achieve this?

Note: For this app I'm using SQLite local storage. One notification should not override another notification by any chance.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Shiva
  • 454
  • 5
  • 10

1 Answers1

1
  1. Run a scheduler in 1 minute interval and compare the due date for 30 minutes difference each minute.
  2. When ever it matches just create a notification with task_id (Of matched row) as notification id.
  3. Keep all the data you want to display on task page in a bundle.
  4. Put that bundle as extra in the Intent containing the activity (Task page).
  5. Keep that Intent in a Pending Intent.
  6. Attach that pendingIntent object with your notification builder like mBuilder.setContentIntent(pendingIndent).
  7. Issue the notification.

As all the task_id (Assigned as Notification_ID) are unique hence one notification will not override another notification by any chance.

Nimantha
  • 6,405
  • 6
  • 28
  • 69
Koustuv Ganguly
  • 897
  • 7
  • 21