I've tried to use Nearby Connections, but I keep getting the dialog "Google Play Services" has crashed. The logcat shows a stack trace like this:
04-08 20:01:32.309 8904-11589/? E/AndroidRuntime: FATAL EXCEPTION: highpool[3]
Process: com.google.android.gms.nearby.connection, PID: 8904
java.lang.NullPointerException: Attempt to read from field 'java.lang.Object pu.a' on a null object reference
at vsb.e(:com.google.android.gms:244)
at vsr.run(:com.google.android.gms:344)
at lmq.run(:com.google.android.gms:450)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at lra.run(:com.google.android.gms:17)
at java.lang.Thread.run(Thread.java:818)
Where the specific random letters can change.
After further investigation, it seems to occur when a device is attempting to discover advertising devices and the timeout it specifies ends.
I went to report the issue and found someone already had:
Very few apps seem to use Nearby Connections; I know of none. The official documentation isn't great. Heck, Nearby.Connections.startAdvertising()
still wants a AppMetadata
parameter, which Google has deprecated.
The official code example, https://github.com/googlesamples/android-nearby , is obsolete and non-functional.
So my question is: how can I work around these issues? Is there a modern, working example of Nearby Connections anywhere? Or is the Nearby Connections API itself simply unused and completely broken?