2022-10-02 23:06:56 +02:00
|
|
|
package android.net;
|
|
|
|
|
|
2024-03-17 18:36:48 +01:00
|
|
|
class Network {}
|
|
|
|
|
|
2022-10-02 23:06:56 +02:00
|
|
|
public class ConnectivityManager {
|
2023-09-12 23:18:47 +02:00
|
|
|
|
2024-03-17 18:36:48 +01:00
|
|
|
public class NetworkCallback {
|
|
|
|
|
public void onAvailable(Network network) {}
|
|
|
|
|
public void onLost(Network network) {}
|
|
|
|
|
}
|
2023-09-12 23:18:47 +02:00
|
|
|
|
2023-06-22 11:45:46 +02:00
|
|
|
public NetworkInfo getNetworkInfo(int networkType) {
|
2022-10-02 23:06:56 +02:00
|
|
|
return null; // this means the network type is not supported, which should make properly coded apps cease any attempts to use network-related APIs
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-22 11:45:46 +02:00
|
|
|
public NetworkInfo getActiveNetworkInfo() {
|
2024-03-17 18:36:48 +01:00
|
|
|
return new NetworkInfo(nativeGetNetworkAvailable());
|
2024-03-16 12:49:28 +01:00
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:36:48 +01:00
|
|
|
public native void registerNetworkCallback(NetworkRequest request, NetworkCallback callback);
|
2024-03-16 12:49:28 +01:00
|
|
|
|
2024-03-17 18:36:48 +01:00
|
|
|
public native boolean isActiveNetworkMetered();
|
|
|
|
|
|
|
|
|
|
protected native boolean nativeGetNetworkAvailable();
|
2022-10-02 23:06:56 +02:00
|
|
|
}
|