locked
[WP8.1]How to know windows phone 8.1 is active or not RRS feed

  • Question

  • Hi,

    I am developing a windows phone 8.1 chat application I want to generate a notification when app is not active.I want to know whether my app is in active or not is there any event to know the status of app and how can I create a notification.

    Thanks,

    Alok 


    Thursday, September 24, 2015 10:52 AM

Answers

  • Hi Alok varma,

    Welcome to the Developing Universal Windows apps forum!

    Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools

    >>I am developing a windows phone 8.1 chat application I want to generate a notification when app is not active

    In my mind I think we can generate a Toast notification in the OnSuspending event as following:

    private void OnSuspending(object sender, SuspendingEventArgs e)
            {
                ToastNotification _toast;
                var notificationXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01);
                var toeastElement = notificationXml.GetElementsByTagName("text");
                toeastElement[0].AppendChild(notificationXml.CreateTextNode("App is inactive"));
                _toast = new ToastNotification(notificationXml)
                {
                    ExpirationTime = DateTimeOffset.Now.AddSeconds(5)
    
                };
                ToastNotificationManager.CreateToastNotifier().Show(_toast);          
                var deferral = e.SuspendingOperation.GetDeferral();
                deferral.Complete();
            }

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.



    Friday, September 25, 2015 7:00 AM