NetworkUtils

class NetworkUtils

Types

NetworkType
Link copied to clipboard
enum NetworkType

Functions

getDomainAddress
Link copied to clipboard
open fun getDomainAddress(domain: String): String
Return the domain address.
getIPAddress
Link copied to clipboard
open fun getIPAddress(useIPv4: Boolean): String
Return the ip address.
getMobileDataEnabled
Link copied to clipboard
open fun getMobileDataEnabled(): Boolean
Return whether mobile data is enabled.
getNetworkOperatorName
Link copied to clipboard
open fun getNetworkOperatorName(): String
Return the name of network operate.
getNetworkType
Link copied to clipboard
open fun getNetworkType(): NetworkUtils.NetworkType
Return type of network.
getWifiEnabled
Link copied to clipboard
open fun getWifiEnabled(): Boolean
Return whether wifi is enabled.
is4G
Link copied to clipboard
open fun is4G(): Boolean
Return whether using 4G.
isAvailableByPing
Link copied to clipboard
open fun isAvailableByPing(): Boolean
Return whether network is available using ping.
open fun isAvailableByPing(ip: String): Boolean
Return whether network is available using ping.
isConnected
Link copied to clipboard
open fun isConnected(): Boolean
Return whether network is connected.
isMobileData
Link copied to clipboard
open fun isMobileData(): Boolean
Return whether using mobile data.
isWifiAvailable
Link copied to clipboard
@RequiresPermission(allOf = [])
open fun isWifiAvailable(): Boolean
Return whether wifi is available.
isWifiConnected
Link copied to clipboard
open fun isWifiConnected(): Boolean
Return whether wifi is connected.
openWirelessSettings
Link copied to clipboard
open fun openWirelessSettings()
Open the settings of wireless.
setMobileDataEnabled
Link copied to clipboard
open fun setMobileDataEnabled(enabled: Boolean)
Set mobile data enabled.
setWifiEnabled
Link copied to clipboard
open fun setWifiEnabled(enabled: Boolean)
Set wifi enabled.