Android auto not working, file sharing in hotspot mode

96 views Asked by At

For a long time I observed the problem of transferring data directly between devices without a router and I cannot understand the reasons.

Example 1: you need to transfer a large file via Wifi from one phone to another. If both phones are connected to the router, then this is easy to do with any program such as SuperBeam or QuickPick. But when there is no common network nearby, I create an access point on one device, connect a second device to it, then these applications do not work, even if I manually specify the IP and the source port, the client cannot connect.

Example 2: exactly the same situation with Android Auto Wireless, when the car and the phone are connected to the same network, I can easily connect the phone to the car by specifying its IP:

    androidAutoWirelessIntent.setClassName("com.google.android.projection.gearhead", "com.google.android.apps.auto.wireless.setup.service.impl.WirelessStartupActivity");
    androidAutoWirelessIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    androidAutoWirelessIntent
            .putExtra("PARAM_HOST_ADDRESS", "192.168.1.155")
            .putExtra("PARAM_SERVICE_PORT", 5288)

But nothing happens when I create an access point on the phone and the car connects to it.

what i tried:

  1. Ping from terminal - successful

     ~ $  ping 192.168.154.83
     PING 192.168.154.83 (192.168.154.83) 56(84) bytes of data.
     64 bytes from 192.168.154.83: icmp_seq=1 ttl=64 time=556 ms
     64 bytes from 192.168.154.83: icmp_seq=2 ttl=64 time=100 ms
     64 bytes from 192.168.154.83: icmp_seq=3 ttl=64 time=42.4 ms
    
  2. Create a local server (open port) on one device and connect to it from another (via google chrome) - successfully

     serverSocket = new ServerSocket(port);
     while (!Thread.currentThread().isInterrupted()) {
         Socket clientSocket = serverSocket.accept();
         handleClient(clientSocket);
     }
    
  3. Run a web server in X-Plore on http://192.168.1.174:1111 and access it through google chrome - successfully

  4. Set static IP from subnet 192.168.1.x - successful

What am I missing? If I have a direct line of sight to the device on the network through the ip port, why does nothing work? What is the difference when I am connected through a router or directly through an access point?

Devices: OnePlus 9Pro (androind 11), OnePlus 3T (android 9)

Perhaps this is due: when a client is connected to my phone through my hotspot, this code says that there are no active connections at all.

Network ns = connectivityManager.getActiveNetwork(); // === NULL
0

There are 0 answers