javaandroidfilegalaxygoogle-nearby

Problem sending file using Google Nearby Connections on specific device


I have 2 devices:

Both have the latest version of the Google Play Services.

On connection, the client app is sending some bytes to the server app; depending on those, it will send back bytes or a file. It works on all client devices I have except the Galaxy Tab 3 and I have no idea why. Sending bytes works, but not sending files (file is approx. 25Mo! i've tried 5Kb, same result : Payload Failure). On failing, client disconnects from server and then reconnects to it, only to fail again. After some tries, a pop-up often appears saying Play Services have stopped.

Does anyone have an idea why this is happening on this specific device?

I have some logs from my server app :

? I/NearbyConnections: EndpointManager failed the next Read read/write for endpoint ZPYv over its ENCRYPTED_BLUETOOTH EndpointChannel. [CONTEXT service_id=54 ]
    java.io.IOException: bt socket closed, read return: -1
        at android.bluetooth.BluetoothSocket.read(BluetoothSocket.java:550)
        at android.bluetooth.BluetoothInputStream.read(BluetoothInputStream.java:88)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:248)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:288)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:347)
        at java.io.DataInputStream.readFully(DataInputStream.java:198)
        at java.io.DataInputStream.readInt(DataInputStream.java:389)
        at agmx.e(:com.google.android.gms@203315046@20.33.15 (150400-330018294):1)
        at agoz.a(:com.google.android.gms@203315046@20.33.15 (150400-330018294):1)
        at agow.run(:com.google.android.gms@203315046@20.33.15 (150400-330018294):4)
        at agiy.run(Unknown Source:0)
        at qzr.b(:com.google.android.gms@203315046@20.33.15 (150400-330018294):12)
        at qzr.run(:com.google.android.gms@203315046@20.33.15 (150400-330018294):7)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at rfq.run(:com.google.android.gms@203315046@20.33.15 (150400-330018294):0)
        at java.lang.Thread.run(Thread.java:923)
? I/NearbyConnections: EndpointManager quit overall Read loop for endpoint ZPYv because the currently registered ENCRYPTED_BLUETOOTH EndpointChannel is in a failed state. [CONTEXT service_id=54 ]
? I/NearbyConnections: Failed to close write stream of ENCRYPTED_BLUETOOTH EndpointChannel BluetoothClassicSocket:C4:62:EA:38:FD:08: socket closed [CONTEXT service_id=54 ]
? I/NearbyConnections: EndpointChannelManager unregistered endpoint ZPYv [CONTEXT service_id=54 ]
? I/NearbyConnections: ClientProxy(80700159) ignoring onConnectionResult(ZPYv, ERROR) because this client has no pending connections to the endpoint [CONTEXT service_id=54 ]
? I/NearbyMediums: Closed Wifi Direct channel. [CONTEXT service_id=54 ]
? E/NearbyMediums: There's no Direct hotspot to stop when the Wi-Fi Direct channel disconnected. [CONTEXT service_id=54 ]

And the exception line from the bug report dialog on my client app (dialog doesn't show up every time so I don't know if this is the reason behind the Nearby's failure) :

java.lang.IllegalArgumentException: Requested flags 0x43, but only 0x3 are allowed

Solution

  • This is a bug in Nearby Connection's code! It's an instance of IllegalArgumentException in grantUriPermission on API level 19

    I've just submitted a fix, but it'll take roughly a month until it's rolled out to devices.

    Disclaimer: I work on Nearby