How to use OnNetworkStateChanged callback function

In studio version 1.32.280 or higher, you can get notification callback from the engine when the network connection changes and switches off/on by using the "OnNetworkStateChanged(inNetworkName, inInternetReachable)" function.

  • The function is triggered by a state changed in the used network, and can prompt notification or trigger other action, as you define it.

  • If the function finds no available network, the function overloads get the following values:
    inNetworkName= None.
    inInternetReachable= false. 

  • If there is available network(s) the function overloads get the following values:
    inNetworkName= the used network name: Wifi, Mobile, etc.
    inInternetReachable= true. 


In the attached survey you can find an example of how OnNetworkStateChanged is used. see in the advanced script of the survey;

(here is an explanation on how to import a survey to your studio: )

1. Any function run begins with prompting text: "network change"

2. In case no available network is found (if inInternetReachable= false) the function prompts the message: "No Network Is Unavailable"

3. In case there is available network the function prompts the message:

"Network - " + inNetworkName + " Is Used"


Note the prompt messages are an example of how to use the function and it's overloads, you can change the messages to prompt, or the actions to take when such action occurs.

Also note the questions (and given answers) in the example survey has no relevance to the function's behavior, and are used to demonstrate how the function react to change in network connection, and some possible scenarios.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request



Please sign in to leave a comment.