2

In my app I need to schedule notification to user on specified date and time (for example 1st May at 10:00). At this moment notification must be shown and when user clicks on this notification, my app should be open. I see two ways to do it:

1. Scheduled notifications.
But if I use the Alarm class, I can not change the title of the notification (which is "Alarm" in English version of SDK).
Reminder class mostly suits me, but when it appears atop the lock screen and user clicks it, my app doesn't open.
May be is there a way around these moments?
Also I would like to get rid of listpicker with time (5 min, 10 min, 1 hour, etc.) and the "snooze" button, but it's not critical.

2. Toast (or tile) notifications from background agent.
But I'm not sure that my background agent runs at the right time. As I understand the background agents runs by the system, and their launch is limited by several factors (phone battery charge, the presence of the running applications or other background agents). It may not even start. There is a way to force the agent at a specific time by using the LaunchForTest, but everywhere write that this method can be used only for debugging purposes, and before the publication of the application it must be removed.
If I do not delete this method, will my application be certified? Also I don't like that the toast notification is only opens for 10 seconds and then disappears without a trace. Something can be done about it?

I need to notification was guaranteed shown at the right time, and when you click on it my application was open. What is the best way to do this?
If this is not possible in Windows Phone 7, is there a way to do this in Windows Phone 8?

Thanks.

2
  • You can use external notification server and send Toast notification from there. Mar 28, 2013 at 10:48
  • Yes, but as far as I know push notifications do not always come at the right time (may be delays). And besides, the user may not have the internet, then push-notification will not come to him. Mar 28, 2013 at 10:59

1 Answer 1

3

I think you should use the Reminders for this. When you click them your application will open. Something like:

var reminder = ScheduledActionService.Find("MyAppReminder");
if (reminder != null)
{
    ScheduledActionService.Remove("MyAppReminder");
}

reminder = new Reminder("MyAppReminder")
{
    Title = "Bla",
    BeginTime = DateTime.Now.AddDays(2),
    Content = message,
    NavigationUri = new Uri("/Start.xaml", UriKind.Relative),
    RecurrenceType = RecurrenceInterval.None
};

ScheduledActionService.Add(reminder);

As for the application not opening when the notification appears on the lock screen, it makes sense. Would be a big security hole if you could open apps directly from the lock screen! Hope it helps.

1
  • Yes, you're right about security, but Toast Notifications opens its apps when user clicks on them. But I do not like them because of their short lifetime (10 seconds and no notification center to store them. I'm really disappointed about this). Mar 28, 2013 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.