locked
Which systemTrigger to use for BackgroundTask to check internet disconnected RRS feed

  • Question

  • I have a function to detect if internet connection is connected when user launch my app. To ensure good user experience,I have the following questions to prepare my app for diff scenario:

    1. Signal strength

    will it change drastically within 12feet radius in the basement or poor signal reception area? 

    How to detect that the internet connection is not connected after the first detected internet connection is connected? Assume the user got the first internet connection and he walks to the basement or poor reception area.

    I wanted to use background Task but find that there is no System trigger for this scenario. If there is such system trigger for this scenario, which one to use? What are methods to solve my problem?

    Thanks

    Thursday, December 12, 2013 7:57 AM

Answers

All replies

  • Hi,

    You can use the network information class to get the network connectivity status and the connectivity strength


    You can use a switch case to check what you want to do at a particular connectivity level

    Ex:

    var connectionProfile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile(); switch(connectionProfile )

    {

    case NetworkConnectivityLevel.ConstrainedInternetAccess:

    //DO Something

    break;

    case NetworkConnectivityLevel.InternetAccess:

    //DO Something

    break;

    case NetworkConnectivityLevel.None:

    //DO Something

    break;

    case NetworkConnectivityLevel.ConstrainedInternetAccess:

    //DO Something

    break;

    default:

    //DO Something

    break;

    }


    Hope this helps .. All the best !

    Thursday, December 12, 2013 2:44 PM
  • Hi,

    The NetworkStatusChanged event occurs when the network status changes for a connection. The information accessed from a ConnectionProfile can be used to determine the current connectivity level, data usage, or identify the network adapter used to maintain a connection. Your app can register for NetworkStatusChanged change events and use ConnectionProfiles to get the latest connection information to make the right choices when adapting its behavior. You can refer to the link below: 

    http://msdn.microsoft.com/en-us/library/windows/apps/hh452991.aspx

    And see the Network Information Sample

    Best Wishes!


    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. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, December 13, 2013 3:06 AM
  • Background tasks has InternetAvailable & NetworkStateChange system trigger. You can use that in your background task implementation.

    Quickstart: Create and register a background task (Windows Store apps using C#/VB/C++ and XAML)

    • Marked as answer by Anne Jing Thursday, December 19, 2013 1:32 AM
    Friday, December 13, 2013 10:29 AM