Search code examples
c#windows-phone-7

How can I launch an application page when alarm give notification in windows phone 7?


I am making an application in which I have to launch an game page when the alarm shoots on windows phone actually you saw someone reply in a post n m really like to know how is it possible?


Solution

  • You can do this by setting up a reminder. Use the following code to do this -

    //Create a reminder
    Reminder myReminder = new Reminder("buy milk");
    myReminder.Title = "Buy Milk";
    myReminder.Content = "Don't forget to buy milk!";
    myReminder.BeginTime = DateTime.Now.AddSeconds(10);
    myReminder.ExpirationTime = DateTime.Now.AddSeconds(15);
    myReminder.RecurrenceType = RecurrenceInterval.None;
    myReminder.NavigationUri = new Uri("/MainPage.xaml?fromReminder=1",         UriKind.Relative);
    
    //Add the reminder to the ScheduledActionService
    ScheduledActionService.Add(myReminder);
    

    The NavigationUri property is used to specify the page to which you want to launch the application to. Here are a couple of links for more information

    Tutorial

    MSDN