locked
Background task' callback is not triggered on PushNotificationTrigger RRS feed

  • Question

  • Background task is not triggered on PushNotificationTrigger on only device phone but Visual studio emulator when the app remained in offed visibility's state.
    after push notification is sent to app, background task's call back function is triggered only when the state of app's visibility is chanaged from off to on.

    the task works well in below 3 case.
    ---------------------------------------------------------------------------------------------------------
    1. if the app's visibility is on, the task is triggered well.
    2. if the app is running on Visual studio emulator and visibility is off, the task is triggered well.
    3. if the app is lunched on device phone through Visual studio, the task is triggered well.
    ---------------------------------------------------------------------------------------------------------

    in summary the task's trigger function not works in case that the app's visibility is off, and the app's package is created and deployed on device phone by Windows Phone Application Deployment 8.1.
    and the function works well both on emulator and app is lunched on device phone through Visual studio.


    i tested with the sample(URL : https://code.msdn.microsoft.com/windowsapps/Raw-notifications-sample-3bc28c5d)

    i only added some code sending toast notification in BackgroundTaskCompleted(callback function) function in Scenario1_Registering.xaml

    this is my source code

    --------------------------------------------------------------------------------------------------------------------

    private void BackgroundTaskCompleted(IBackgroundTaskRegistration sender, BackgroundTaskCompletedEventArgs args)
    {
        SendToast("toast");
    }

    public void SendToast(string strKey)
    {
        string strXML = "<toast launch=\"" + strKey + "\"><visual><binding template=\"ToastText02\"><text id=\"1\">Receive Key</text><text id=\"2\">" + strKey + "</text></binding> </visual></toast>";

        XmlDocument XML = new XmlDocument();
        XML.LoadXml(strXML);

        ToastNotification Toast = new ToastNotification(XML);

        ToastNotificationManager.CreateToastNotifier().Show(Toast);
    }

    --------------------------------------------------------------------------------------------------------------------
    Monday, October 20, 2014 7:39 AM

Answers

  • Hi Estmob,

    Since your app is working fine on emulator and device deployed through visual studio, I think there is no incorrect stuff in your code. Are you missing something on using deployment tool? Try following this documentation to deploy your app.

    Did you want to test your app to prepare for release? I would recommend you use Windows phone store beta. It can help us testing app in real-world environment.

    If I misunderstand you, please feel free to let me know.

    Regards,


    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.

    Tuesday, October 21, 2014 7:49 AM