Answer the question
In order to leave comments, you need to log in
Network access via gsm with a connected wifi point without a network on Android 10?
There is an Android and a device connected via wifi. (the device itself does not have access to enthernet)
When connected to it, Android does not have a network to access the server.
I got around the problem by connecting to the device and disconnecting. And then connected to the server.
Android 10 came out - and now you can't disconnect from the network (I turned off the wifi module).
The connection and disconnection process itself should occur automatically without the knowledge of the user!
How can you access a network without disconnecting from wifi that does not have access to ethernet?
The gsm has access to the network - I did not find anything on this topic.
Answer the question
In order to leave comments, you need to log in
There is no Internet access in the WiFi network - so on purpose.
Found a solution.
First we request access to use wifi -
val networkRequest = NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
.removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
.setNetworkSpecifier(
WifiNetworkSpecifier.Builder()
.setSsid(ssid)
.setWpa2Passphrase(pass)
.build()
)
.build()
...
val request = NetworkRequest.Builder()
.addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
.addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
.build()
_cm.registerNetworkCallback(request, object : ConnectivityManager.NetworkCallback() {
override fun onAvailable(network: Network) {
if (server_test(network))
_cm.bindProcessToNetwork(network)
LogUtils.i("onAvailable")
}
}
...
Of course, you described the problem quite difficultly, for a long time I could not understand what was not working and what was needed.
Try in the "For Developers" section to find and enable the "Do not disable data transfer" setting.
(in the screenshot below)
It all depends on what it means
При подключении к ней, в Android нет сети, для доступа к серверу.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question