Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nearby Connections API not working in some devices #145

Closed
perugugoutham opened this issue Dec 5, 2016 · 21 comments
Closed

Nearby Connections API not working in some devices #145

perugugoutham opened this issue Dec 5, 2016 · 21 comments
Labels
migrated googlesamples Migrated from old googlesamples repos NearbyConnections

Comments

@perugugoutham
Copy link

Tested connections-quickstart sample with Nexus 9 (5.0) and moto g2(6.0 rooted) with both devices in the same WiFi network. Both show success status in advertising and discovery. But doesn't show nearby devices (i.e. fails to go into onEndPointFound() method). The same was the result when tried with Nexus 9 (5.0) and Nexus 9 (7.0). But when tested with Galaxy tab S(5.0.3) with moto g2(6.0 rooted) works good for some time (say 5 times) and later requires reboot of Galaxy device to work good again.
P.s. My WiFi network do support mDNS discoverability and I've also tested with various other WiFi networks

May be an update on Nearby API samples is needed.

@reznor
Copy link

reznor commented Dec 8, 2016

Hi Goutham,

Could you tell us what versions of GooglePlayServices you are using on these devices? Does the same version work on Nexus 9, but not on your Galaxy Tab S?

Also, what version of the client SDK are you building your app against?

@perugugoutham
Copy link
Author

Varun,

I'm using GooglePlayServices version 10.0.1 and compileSdkVersion and targetSdkVersion is 24. And please note that the app which I built or the 'connections-quickstart' didn't work in Nexus 9 with other mobiles however the advertise and discover statuses where shown success. But Galaxy worked with my moto g2 alone, however on testing the app (close and running again) after say 5 times, it doesn't work. Please share your ideas to solve the issue bro.

@djavan-bertrand
Copy link

Hi there,
I seem to have the same issue. I first thought it was a Samsung issue, but today my Nexus 5X can't connect either to a Nearby device after having called Nearby.Connections.startAdvertising and can't discover other devices after having called Nearby.Connections.startDiscovery.
However, a Nexus 5 can. They are both on the same network, they have both the Play Services 10.0.84.
This exact setup was working a few days ago.

In my app, I'm using: compile 'com.google.android.gms:play-services-nearby:10.0.1'.

Do you have an idea about what's going on?
Thanks,
Djavan

@samtstern
Copy link

Thanks all for the reports. @djavan-bertrand your case is interesting, are you saying the setup with the same devices and the same WiFi network no longer works? Is there anything unusual in the logcat?

@djavan-bertrand
Copy link

djavan-bertrand commented Dec 22, 2016

More precisely, I'm saying that the setup with the same device and the same Wifi network sometimes works, and sometimes (in my case most of the time) does not work.

Please note that I've tested on other networks (Android phone access point, my home's Wifi, my work place's wifi) with the same result.

Here are some logs:

As you can see in the advertiser logs, mdns seems to correctly advertise on the network:

12-22 19:20:43.480  19342-19394/? D/mdns﹕ Announcing Samsung\032SM-G930F._googlenearby._tcp.local. (TXT) 6
12-22 19:20:43.480  19342-19394/? D/mdns﹕ Announcing _services._dns-sd._udp.local. (PTR) 6
12-22 19:20:43.480  19342-19394/? D/mdns﹕ Announcing _googlenearby._tcp.local. (PTR) 6
12-22 19:20:43.480  19342-19394/? D/mdns﹕ Announcing Samsung\032SM-G930F._googlenearby._tcp.local. (SRV) 6

On the discoverer, I don't really understand what mdns is doing, maybe you'll have a better understanding that me.

12-22 19:30:04.436  5930  7154 D mdns    : Received Response from 192.168.1.8     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  2 Answers,  0 Authorities,  1 Additional  77 bytes LLQType 0
12-22 19:30:04.437  5930  7154 D mdns    : Received Response from FE80:0000:0000:0000:AE5F:3EFF:FEC8:81F1 addressed to FF02:0000:0000:0000:0000:0000:0000:00FB on D80C3800 with  0 Questions,  2 Answers,  0 Authorities,  1 Additional  77 bytes LLQType 0
12-22 19:30:04.578  5930  7154 D mdns    : Announcing 83.1.168.192.in-addr.arpa. (PTR) 5
12-22 19:30:04.579  5930  7154 D mdns    : Announcing 1.4.E.A.3.E.E.F.F.F.6.6.2.6.A.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.E.F.ip6.arpa. (PTR) 5
12-22 19:30:04.579  5930  7154 D mdns    : Announcing Android-2.local. (Addr) 5
12-22 19:30:04.579  5930  7154 D mdns    : Announcing Android-2.local. (AAAA) 5
12-22 19:30:04.579  5930  7154 D mdns    : SendResponses: Sending 0 Deregistrations, 4 Announcements, 0 Answers, 4 Additionals on D80C3800
12-22 19:30:04.579  5930  7154 D mdns    : Received Response from 192.168.1.83    addressed to 224.0.0.251     on D80C3800 with  0 Questions,  4 Answers,  0 Authorities,  4 Additionals 265 bytes LLQType 0
12-22 19:30:04.580  5930  7154 D mdns    : Received Response from FE80:0000:0000:0000:0A62:66FF:FEE3:AE41 addressed to FF02:0000:0000:0000:0000:0000:0000:00FB on D80C3800 with  0 Questions,  4 Answers,  0 Authorities,  4 Additionals 265 bytes LLQType 0
12-22 19:30:05.569  5930  7154 D mdns    : Received Response from 192.168.1.1     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 329 bytes LLQType 0
12-22 19:30:05.572  5930  7154 D mdns    : Received Response from 192.168.1.1     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 329 bytes LLQType 0
12-22 19:30:05.573  5930  7154 D mdns    : Received Response from 192.168.1.1     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 314 bytes LLQType 0
12-22 19:30:06.494  5930  7154 D mdns    : Received Response from 192.168.1.1     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 329 bytes LLQType 0
12-22 19:30:06.495  5930  7154 D mdns    : Received Response from 192.168.1.83    addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 533 bytes LLQType 0
12-22 19:30:06.495  5930  7154 D mdns    : Received Response from 192.168.1.83    addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 533 bytes LLQType 0
12-22 19:30:06.495  5930  7154 D mdns    : Received Response from 192.168.1.83    addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 518 bytes LLQType 0
12-22 19:30:06.588  5930  7154 D mdns    : Received Response from 192.168.1.1     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 329 bytes LLQType 0
12-22 19:30:06.588  5930  7154 D mdns    : Received Response from 192.168.1.1     addressed to 224.0.0.251     on D80C3800 with  0 Questions,  1 Answer,   0 Authorities,  3 Additionals 314 bytes LLQType 0

Thanks anyway!

@djavan-bertrand
Copy link

Hi, any new about that problem?

Thx

@AntonVasiliev
Copy link

AntonVasiliev commented Jan 18, 2017

Hey, @djavan-bertrand !
Seems like your issue and our issue android/android-nearby#34 are related. Can you try reverting Google Play Services to factory version as described in that topic?
This can help prove that this is regression in Google Play Services and help us attract attention of developers from Google.

@djavan-bertrand
Copy link

Hi.

Not sure what to think about this experiment.
I reverted all the Google Play services of my devices to factory version:

  • Samsung Galaxy S7: 9.8.79
  • Nexus 5: 8.1.22
  • Nexus 5X: 9.8.79

In my app, I set the play services version to 8.1.0.
The Nexus 5 is connecting with the 5X in both ways. However, the S7 can't see nor discover any other devices.

Don't know what to guess about these results... But it's an important problem since the whole Nearby API can't be trusted :'(

@AntonVasiliev
Copy link

Hi!

Sad to hear that. What's the factory version of Google Play Service on S7? According to my investigation it works on 8.7.* and broken on 9.8.*. Not sure about other versions yet.

@djavan-bertrand
Copy link

As mentioned, S7 factory version of Google Play Services is 9.8.79.
Note that the Nexus 5X factory version is also 9.8.79.

@AntonVasiliev
Copy link

Seems not as straightforward as I thought. =(

@riggaroo
Copy link

I'm experiencing similar problems.. Running the sample on a couple devices and the services cant find the endpoints

@djavan-bertrand
Copy link

@samtstern do you have update on this bug?
I've tested with the latest release of GooglePlayServices (10.2.0 on gradle, 10.2.98 on my phones), there is no changes in the behavior of the app: I can not find any endpoints.

I can post other logs if you want.

@CorentinPacaud
Copy link

Hello,
The Google sample code doesn't work on both my Xperia XZ and my Xperia Z. They've never been connected, but they both say "Advertising SUCCESS" and "Discovering SUCCESS". I am running the latest GPS version.

@floatingmuseum
Copy link

same problem on my huawei v8 and oneplus a001

@ImDevinC
Copy link

ImDevinC commented May 4, 2017

I'm assuming there's no fix for this? I'm having this same issue between my Pixel XL and my Nexus 6

@ImDevinC
Copy link

ImDevinC commented May 9, 2017

I think I found the issue, at least on my Pixel device. Below is what happens when I try to startAdvertising on my Pixel. Notice this line in the middle
05-08 18:09:53.466 25074 28546 D mdns : SetupOneInterface: wlan0 192.168.1.138 failed to register 98

05-08 18:09:53.464 25074 28546 I NearbyApp: Registering Google Pixel XL with service type _googlenearby._tcp. and service ID com.google.example.connectionsquickstart.service
05-08 18:09:53.465 25074 28546 D mdns    : Adding cache storage for 512 more records (94208 bytes)
05-08 18:09:53.465 25074 28546 D mdns    : No unicast UDP responses
05-08 18:09:53.466 25074 28546 D mdns    : SetupInterfaceList
05-08 18:09:53.466 25074 28546 D mdns    : SetupOneInterface: wlan0 192.168.1.138 failed to register 98
05-08 18:09:53.467 25074 28546 D mdns    : SetupOneInterface: lo 127.0.0.1 failed to register 98
05-08 18:09:53.467 25074 28546 I NearbyApp: Successfully initialized embedded mDNS.
05-08 18:09:53.467 25074 28546 I NearbyApp: Thread started.
05-08 18:09:53.468 25074 28546 D mdns    : mDNS_Register_internal: Adding to active record list   21 Google\032Pixel\032XL._googlenearby._tcp.local. SRV 0 0 37484 Android.local.
05-08 18:09:53.468 25074 28546 D mdns    : mDNS_Register_internal: Adding to active record list   75 Google\032Pixel\032XL._googlenearby._tcp.local. TXT id=HT69M0204897:0¦si=com.google.example.connectionsquickstart.service¦ac=1
05-08 18:09:53.468 25074 28546 D mdns    : ServiceCallback: Google\032Pixel\032XL._googlenearby._tcp.local. (TXT) Name Registered (0)
05-08 18:09:53.468 25074 28546 D mdns    : mDNS_Register_internal: Adding to active record list   26 _services._dns-sd._udp.local. PTR _googlenearby._tcp.local.
05-08 18:09:53.468 25074 28546 D mdns    : ServiceCallback: _services._dns-sd._udp.local. (PTR) Name Registered (0)
05-08 18:09:53.468 25074 28546 D mdns    : mDNS_Register_internal: Adding to active record list   42 _googlenearby._tcp.local. PTR Google\032Pixel\032XL._googlenearby._tcp.local.
05-08 18:09:53.468 25074 28546 D mdns    : ServiceCallback: _googlenearby._tcp.local. (PTR) Name Registered (0)
05-08 18:09:53.468 25074 28546 I NearbyApp: DNSServiceRegister immediate call succeeded
05-08 18:09:53.468 25074 28548 D mdns    : mDNS_Execute: Skipping LocalAuthRecord   21 Google\032Pixel\032XL._googlenearby._tcp.local. SRV 0 0 37484 Android.local.
05-08 18:09:53.468 25074 28548 D mdns    : mDNS_Execute: Delivering Add event with LocalAuthRecord   75 Google\032Pixel\032XL._googlenearby._tcp.local. TXT id=HT69M0204897:0¦si=com.google.example.connectionsquickstart.service¦ac=1
05-08 18:09:53.468 25074 28548 D mdns    : mDNS_Execute: Delivering Add event with LocalAuthRecord   26 _services._dns-sd._udp.local. PTR _googlenearby._tcp.local.
05-08 18:09:53.468 25074 28548 D mdns    : mDNS_Execute: Delivering Add event with LocalAuthRecord   42 _googlenearby._tcp.local. PTR Google\032Pixel\032XL._googlenearby._tcp.local.
05-08 18:09:53.621 25074 28548 D mdns    : mDNS_Execute: Just one LocalAuthRecord   21 Google\032Pixel\032XL._googlenearby._tcp.local. SRV 0 0 37484 Android.local., breaking out of the loop early
05-08 18:09:53.733 27665 27735 D ClClient: Not sending keepalive.  Current connection state=STOPPED
05-08 18:09:53.871 25074 28548 D mdns    : mDNS_Execute: Just one LocalAuthRecord   21 Google\032Pixel\032XL._googlenearby._tcp.local. SRV 0 0 37484 Android.local., breaking out of the loop early
05-08 18:09:54.121 25074 28548 D mdns    : mDNS_Execute: Just one LocalAuthRecord   21 Google\032Pixel\032XL._googlenearby._tcp.local. SRV 0 0 37484 Android.local., breaking out of the loop early
05-08 18:09:54.121 25074 28548 D mdns    : ServiceCallback: Google\032Pixel\032XL._googlenearby._tcp.local. (SRV) Name Registered (0)
05-08 18:09:54.121 25074 28548 I NearbyApp: DNSServiceRegister callback success

On my Nexus device, the line instead shows success.
05-08 18:11:36.889 24759 28846 D mdns : SetupOneInterface: wlan0 192.168.1.141 Registered

05-08 18:11:36.885 24759 28846 D mdns    : Adding cache storage for 512 more records (77824 bytes)
05-08 18:11:36.885 24759 28846 D mdns    : No unicast UDP responses
05-08 18:11:36.888 24759 28846 D mdns    : SetupInterfaceList
05-08 18:11:36.888 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list    4 Android.local. Addr 192.168.1.141
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   15 141.1.168.192.in-addr.arpa. PTR Android.local.
05-08 18:11:36.889 24759 28846 D mdns    : Not creating HINFO record: platform support layer provided no information
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_StartQuery: _sleep-proxy._udp.local. (PTR)
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_StartQuery: Question _sleep-proxy._udp.local. (PTR) Interface A6E04800 Now 1959812287 Send in 342 Answer in 0 (A6E04808) not duplicate (00000000)
05-08 18:11:36.889 24759 28846 D mdns    : SetupOneInterface: wlan0 192.168.1.141 Registered
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   16 Android.local. AAAA FE80:0000:0000:0000:C485:E8FF:FE15:D61A
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   15 A.1.6.D.5.1.E.F.F.F.8.E.5.8.4.C.0.0.0.0.0.0.0.0.0.0.0.0.0.8.E.F.ip6.arpa. PTR Android.local.
05-08 18:11:36.889 24759 28846 D mdns    : Not creating HINFO record: platform support layer provided no information
05-08 18:11:36.889 24759 28846 D mdns    : SetupOneInterface: dummy0 FE80:0000:0000:0000:C485:E8FF:FE15:D61A Registered
05-08 18:11:36.889 24759 28846 D mdns    : SetupOneInterface: wlan0 FE80:0000:0000:0000:EE88:92FF:FE04:0AAF is an alias of 192.168.1.141
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   16 Android.local. AAAA FE80:0000:0000:0000:EE88:92FF:FE04:0AAF
05-08 18:11:36.889 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   15 F.A.A.0.4.0.E.F.F.F.2.9.8.8.E.E.0.0.0.0.0.0.0.0.0.0.0.0.0.8.E.F.ip6.arpa. PTR Android.local.
05-08 18:11:36.889 24759 28846 D mdns    : Not creating HINFO record: platform support layer provided no information
05-08 18:11:36.889 24759 28846 D mdns    : SetupOneInterface: wlan0 FE80:0000:0000:0000:EE88:92FF:FE04:0AAF Registered
05-08 18:11:36.892 24759 28846 I NearbyApp: Successfully initialized embedded mDNS.
05-08 18:11:36.892 24759 28846 I NearbyApp: Thread started.
05-08 18:11:36.892 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   21 Motorola\032Nexus\0326._googlenearby._tcp.local. SRV 0 0 37484 Android.local.
05-08 18:11:36.892 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   73 Motorola\032Nexus\0326._googlenearby._tcp.local. TXT id=ZX1G22BP2K:0¦si=com.google.example.connectionsquickstart.service¦ac=1
05-08 18:11:36.892 24759 28846 D mdns    : ServiceCallback: Motorola\032Nexus\0326._googlenearby._tcp.local. (TXT) Name Registered (0)
05-08 18:11:36.892 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   26 _services._dns-sd._udp.local. PTR _googlenearby._tcp.local.
05-08 18:11:36.892 24759 28846 D mdns    : ServiceCallback: _services._dns-sd._udp.local. (PTR) Name Registered (0)
05-08 18:11:36.892 24759 28846 D mdns    : mDNS_Register_internal: Adding to active record list   43 _googlenearby._tcp.local. PTR Motorola\032Nexus\0326._googlenearby._tcp.local.
05-08 18:11:36.892 24759 28846 D mdns    : ServiceCallback: _googlenearby._tcp.local. (PTR) Name Registered (0)
05-08 18:11:36.892 24759 28846 I NearbyApp: DNSServiceRegister immediate call succeeded

@samtstern It doesn't look like this project has been updated in awhile, are you able to provide any insight?

@CorentinPacaud
Copy link

I think this project is dead.... sadly,

@samtstern
Copy link

Hey all. I no longer work on Nearby Connections but I do still get these notifications. In the recent 11.0.1 release there was a big update to the API:
https://developers.google.com/android/guides/releases#june_2017_-_version_110

Has anyone tried the new methods? Any improvement?

@djavan-bertrand
Copy link

Thanks @samtstern. I just tried briefly and it seems to be better now.
The ResultCallback<Connections.StartAdvertisingResult> returned errors that made me add these additional permissions:

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

I think the previous versions did not returned these errors.
With these permissions added, I was able to discover my device.

@codingjeremy codingjeremy transferred this issue from googlearchive/android-nearby Sep 18, 2019
@codingjeremy codingjeremy added the migrated googlesamples Migrated from old googlesamples repos label Sep 18, 2019
@isaidamier
Copy link
Contributor

Hi All,

We very recently published a codelab that shows how to implement the Nearby Connections API. I believe it should help resolve your issues. If it doesn't please, reopen with additional comments.

Best,

Isai

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migrated googlesamples Migrated from old googlesamples repos NearbyConnections
Projects
None yet
Development

No branches or pull requests