-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInternetConectionManager.cs
47 lines (42 loc) · 1.67 KB
/
InternetConectionManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class InternetConectionManager : MonoBehaviour
{
public NotificationBar notificationManager;
string m_ReachabilityText;
public void checkForInternetConection()
{
if(Application.internetReachability == NetworkReachability.NotReachable)
{
//set the value of the message
notificationManager.NotificationBody = "Error. Check internet connection!";
//show notification
notificationManager.startSequenceNotification();
}
}
void Update()
{
//Output the network reachability to the console window
// Debug.Log("Internet : " + m_ReachabilityText);
//Check if the device cannot reach the internet
if (Application.internetReachability == NetworkReachability.NotReachable)
{
//Change the Text
m_ReachabilityText = "Not Reachable.";
Debug.Log("Internet : " + m_ReachabilityText);
}
//Check if the device can reach the internet via a carrier data network
else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork)
{
m_ReachabilityText = "Reachable via carrier data network.";
Debug.Log("Internet : " + m_ReachabilityText);
}
//Check if the device can reach the internet via a LAN
else if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
{
m_ReachabilityText = "Reachable via Local Area Network.";
Debug.Log("Internet : " + m_ReachabilityText);
}
}
}