|
void | onReceive (@NonNull Context context, @NonNull Intent intent) |
|
Definition at line 22 of file NetworkStateReceiver.java.
◆ isConnectedTo3G()
static boolean com.freerdp.freerdpcore.application.NetworkStateReceiver.isConnectedTo3G |
( |
Context |
context | ) |
|
|
inlinestatic |
Definition at line 25 of file NetworkStateReceiver.java.
26 {
27 ConnectivityManager connectivity =
28 (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
29 NetworkInfo info = connectivity.getActiveNetworkInfo();
30
31
32 if (info == null || !info.isConnected())
33 return false;
34
35 return (info.getType() != ConnectivityManager.TYPE_WIFI &&
36 info.getType() != ConnectivityManager.TYPE_WIMAX);
37 }
◆ onReceive()
void com.freerdp.freerdpcore.application.NetworkStateReceiver.onReceive |
( |
@NonNull Context |
context, |
|
|
@NonNull Intent |
intent |
|
) |
| |
|
inline |
Definition at line 39 of file NetworkStateReceiver.java.
40 {
41 String action = intent.getAction();
42 if (!action.equals("android.net.conn.CONNECTIVITY_CHANGE"))
43 {
44 return;
45 }
46
47
48 if (intent.getExtras() != null)
49 {
50 NetworkInfo info =
51 (NetworkInfo)intent.getExtras().get(ConnectivityManager.EXTRA_NETWORK_INFO);
52
53
54 if (info != null)
55 {
56 if (info.isConnected())
57 {
58
59 Log.d("app", "Connected via type " + info.getTypeName());
60 GlobalApp.ConnectedTo3G = (info.getType() != ConnectivityManager.TYPE_WIFI &&
61 info.getType() != ConnectivityManager.TYPE_WIMAX);
62 }
63
64 Log.v("NetworkState", info.toString());
65 }
66 }
67 }
The documentation for this class was generated from the following file: