How to detect when a player's internet connection becomes active?

Hi, I’m wondering how ho detect when a player connects to the internet. Like if they had wi-fi turned off, then turned it on and connected to their network.

I need to know when that happens so I can try to fetch an ad again (previous attempts will have failed). Does MonoBehaviour have an event like that, or do we have to just keep doing it every 1 minute or something when ad fetching fails?

what system are you using?

I think use Network class (which is used to check player connection status).

Then there is Application.InternetReachibility status

The Application.InternetReachability is not meant for checking if the device is connected to the internet, it is for checking if it is using mobile data or WiFi. The NetworkReachablity function, tells you if the device is connected to the internet by any source

2 Likes

Yeah I know about those, I was hoping there was an actual event that fires when it changes so we wouldn’t have to keep checking periodically.

I’m using iOS.

Googled a while and this was the best I found:
https://github.com/xamarin/monotouch-samples/tree/master/ReachabilitySample

Hope it helps…

Thanks! I’ll check it out.

give a suggestion to the unity devs to see if they can do it

But wouldn’t the thing that’s going to file off the event need to be checking periodically anyway? I’d rather be in control of that rather than have something checking on by behalf in situations when I don’t care to know.