This requirement for automation devices.
Hello, I want Send - Receive data using Static IPAddress and Port with WiFi connection. (It's working fine for me using TCPIP Socket Programming.)
Now, My phone connects with router wifi, but here Internet connection not available. Then after I want to do the above process between mobile devices and automation devices.
Is there any possible way to connect mobile devices and automation devices using only wifi connection (Wifi Internet connection not necessary in this case.)
Related
I have basic web view android app - client side, and Raspberry Pi as server side (NodeJS WEB server). Raspberry acts as Wifi access point and receive connections. Android app works when i have internet enabled on raspberry via lan port. When i try to connect and around me i have saved wifi connection wit INTERNET ACCESSS, app ignore raspberry pi wifi. How to force android app to connect to NON INTERNET WIFI and keep the connection?
I assume you want to know, how you can prevent Android from switching networks, when the OS detects no Internet Connection.
You could start by disabling the Google Connectivity Services App. This sometimes works for me. To do this go to Settings -> Apps -> Google Connectivity Services (On some phones you need to enable 'system apps')
This feature might have different names on some brands...
I have an Android App and an IoT device where the connectivity and the communication will be through Wi-Fi. The IoT device will provide an hotspot (without Internet) so that we can connect our Mobile Wi-Fi with that device hotspot. After connecting the Mobile with Wi-Fi, when we open the app, the app will try to find the device using TCP socket connection to connect and communicate to the IoT device.
The App works fine and communicates with the device successfully. But the problem here is, the connection and communication is not happening if the Mobile Data is turned ON. The app works only with the Mobile Data turned OFF.
I guess the App is searching for the IoT device through Mobile Data since the Mobile data has an active internet connection and the Wi-Fi does not. I want the App to look for the IoT device only through Wi-Fi even if Mobile Data is ON.
I have a similar App in React Native which has the same functionality and had the same problem. I fixed it with using react-native-tcp-socket package which has an option to make the app search through a particular interface (which has the options wifi, ethernet and cellular).
Both the Apps have an hardcoded IP Address for connecting to the IoT device. This works only when Mobile Data is turned Off. In the React Native App, I fixed it using that package mentioned previously with the Dynamic IP address by getting it from the WifiManager. When I tried the same with the Android App it did not work.
I looked into the package's native code and tried to replicate the same, but getting the below error:
java.net.ConnectException: failed to connect to /192.168.1.2 (port 6378) from /:: (port 39495): connect failed: ECONNREFUSED (Connection refused)
Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
Any Suggestions?
Is any other way of implementation possible to achieve the output?
The solution is to bind the socket to the Wi-Fi network. We must create a listener and get the Network from the listener's result.
So, Whenever we open or reopen a socket we must bind that socket to Wi-Fi network. This is what I was missing. After adding this, it worked fine.
network.bindSocket(socket);
And, another update is, in my case, The dynamic IP address didn't work but the pre-defined hardcoded IP address works and I am unable to find the reason, unlike my previous case which was vice-versa.
I created a sample app, with just 3 buttons, Connect , send msg, disconnect.
I am using TCP server on another mobile B, (any available tcp server app or test tool app).
and our client app is on mobile A.
Case 1. Both the Mobile A & B, are on same wifi network, app is working fine (connect, disconnect) if both have same internet or does not have any internet over wifi, and client device does not have internet availability on other network, like 4g.
Working
Case 2. Both the Mobile are on same wifi network, but in client app device, Mobile A has 4g connection with internet available, now the app is not connecting with tcp server over wifi network.
this wifi network does not have internet connectivity.
Not Working
so case 2 is not working. If devices are on same wifi, and client has other 3g/4g working internet , the app is not connecting over wifi.
I'm developing android applications which shows real-time data via UDP using WIFI connection on static IP addresses. I'm using AsyncTask class which is executed in one second period.
My problem is that the communication via UDP is interrupted by other applications (for example Facebook - ARP requests) because the WIFI is connected to the IP local device without internet connection.
The interruption is during execution method: socket.receive();
Is there a way to use wifi only for my developed application and has it disabled for other apps?
With an android app that uses an i-jetty server, I managed to connect to an android device from a PC web browser over wifi. However, I want to enable connecting over a 3g (mobile data) network. Is there a way to do that?