I have now read a lot about this problem and there seems to be a solution if you program an app in Java/Kotlin, which I can’t do, but I can’t find a solution to do this with codular.
I have created an app that uses the “websocket client extension”, but it seems to affect all connections and not just websockets. The app establishes a WiFi connection to a measuring device which acts as an access point and transmits measurements, but does not provide an internet connection. I have tested the app successfully on Android 6,7 and 8, but on Android 9 and 10 it does not run on most devices. The WiFi connection is established, but no data is transferred.
After a lot of experimenting I found out that this is only the case if a mobile data connection is available e.g. over 4G. If I switch the phone into flight mode (and then turn WiFi back on) or disable “mobile data” in the settings, the data transfer works fine.
The problem: The operating system from Android 9 on tries to send the data preferably over an internet connection (here 4G), and not over the WiFi connection.
Now I have found solutions to this problem, but they require that you program the app in Java/Kotlin. There you can connect a process to a network (“bindProcessToNetwork(network)”). This means that this process always sends its data over a fixed connection, in this case WiFi and not trying to use 4G.
How can I implement this in Kodular?
Is there a way to disable “mobile data” for the duration of the app running?
I only found the solution to open the appropriate menu for the user and let him do it manually. That would be a very ugly workaround.
Translated with www.DeepL.com/Translator (free version)