android / connectivity-samples

Multiple samples showing the best practices in connectivity on Android.
Apache License 2.0
1.67k stars 1.32k forks source link

UWB sample ranging not working #284

Open jeorgearomal opened 1 year ago

jeorgearomal commented 1 year ago

The callback EndpointEvents.PositionUpdated -> endpointPositions[result.endpoint] = result.position is not received during connection. Also we are able to see the devices in the UI, but those are displayed in disconnectedEndpoints of the HomeScreen

Devices : two Samsung Galaxy Note20 Ultra 5G

Attached the demo, where expected is the identified device should be plotted in the graph. This does not happen since connectedEndpoints is empty

https://user-images.githubusercontent.com/17307808/213403884-b610bf2c-9dd7-44de-893e-ca86bf847b28.mov

nrichardson12 commented 1 year ago

I've had this issue as well on the Galaxy Note 20 Ultra. This issue also occurs on the Galaxy S22 Ultra. Also, the app does not seem to check if the user has UWB turned on in settings (Connections). However, turning on UWB does not fix this issue. Any help would be appreciated!

mg120137 commented 1 year ago

This issue also occurs on two Pixel 7 pro. I wonder if you could help me.

pozayo commented 1 year ago

UWB has not worked since January. Is there any issue of updating gms?

Other than this project, projects that I built separately do not work after any point in time.

uwbClient.startRanging(parametersBuilder.build(), callback).await() The following error occurs after calling the above function. (This error is the same for any UWB project.)

Caught a RuntimeException from the binder stub implementation. aacw: Expected size 4 got 12 (0xc) Parcel: pos=228 size=388 at aacx.O(:com.google.android.gms@230313044@23.03.13 (190400-503260631):2) at aacx.f(:com.google.android.gms@230313044@23.03.13 (190400-503260631):0) at bfax.createFromParcel(:com.google.android.gms@230313044@23.03.13 (190400-503260631):10) at aacx.m(:com.google.android.gms@230313044@23.03.13 (190400-503260631):2) at bfbb.createFromParcel(:com.google.android.gms@230313044@23.03.13 (190400-503260631):6) at glv.a(:com.google.android.gms@230313044@23.03.13 (190400-503260631):2) at bezi.eo(:com.google.android.gms@230313044@23.03.13 (190400-503260631):5) at glu.onTransact(:com.google.android.gms@230313044@23.03.13 (190400-503260631):5) at android.os.Binder.transact(Binder.java:1200) at amac.onTransact(:com.google.android.gms@230313044@23.03.13 (190400-503260631):17) at android.os.Binder.execTransactInternal(Binder.java:1321) at android.os.Binder.execTransact(Binder.java:1280)

zidaliu commented 1 year ago

I try the example code following the example code (https://developer.android.com/guide/topics/connectivity/uwb), however, the clientSession.prepareSession() returns an empty flow, is there anyone who successfully run the demo?

chinesco commented 1 year ago

Could you please let us know if this is still an issue, specially interested to see if it still happens with the two Samsung devices. If the issue is still present, could you please file a bug including a bug report here: https://issuetracker.google.com/issues/new?component=1185313&template=1680952 Thanks

sonic74 commented 1 year ago

Is this supposed to work with the Samsung Galaxy SmartTag+ EI-T7300 ?

chinesco commented 1 year ago

@sonic74 no, this sample is intended to demonstrate ranging between two Android phones.

vinstray commented 1 year ago

Hi, testing the sample I observe that ranging measurements stops after some seconds of acquisition (usually around 40 seconds). There is a reason for this behaviour? Thanks

Sn0wfreezeDev commented 1 year ago

Also on my Google Pixel 6 Pro the app suddenly stopped working.

HussainATS commented 1 year ago

Hi, can somebody provide me sample app or guidance on how to create UWB ranging app to find distance of a IOT device? Also can I use my Samsung Galaxy S21+ phone for this activity?

hzhou3 commented 1 year ago

Hi, I am still not able to run the sample code on Samsung S21+ and Pixel 7 Pro. It seems the NearbyConnection is not working (I cannot see the information listed on the ranging screen as the video showed, e.g., "UWB1"). Any advice is appreciated, thanks!

codetang-2417 commented 1 year ago

UWB has not worked since January. Is there any issue of updating gms?

Other than this project, projects that I built separately do not work after any point in time.

uwbClient.startRanging(parametersBuilder.build(), callback).await() The following error occurs after calling the above function. (This error is the same for any UWB project.)

Caught a RuntimeException from the binder stub implementation. aacw: Expected size 4 got 12 (0xc) Parcel: pos=228 size=388 at aacx.O(:com.google.android.gms@230313044@23.03.13 (190400-503260631):2) at aacx.f(:com.google.android.gms@230313044@23.03.13 (190400-503260631):0) at bfax.createFromParcel(:com.google.android.gms@230313044@23.03.13 (190400-503260631):10) at aacx.m(:com.google.android.gms@230313044@23.03.13 (190400-503260631):2) at bfbb.createFromParcel(:com.google.android.gms@230313044@23.03.13 (190400-503260631):6) at glv.a(:com.google.android.gms@230313044@23.03.13 (190400-503260631):2) at bezi.eo(:com.google.android.gms@230313044@23.03.13 (190400-503260631):5) at glu.onTransact(:com.google.android.gms@230313044@23.03.13 (190400-503260631):5) at android.os.Binder.transact(Binder.java:1200) at amac.onTransact(:com.google.android.gms@230313044@23.03.13 (190400-503260631):17) at android.os.Binder.execTransactInternal(Binder.java:1321) at android.os.Binder.execTransact(Binder.java:1280)

When I use the Samsung S21+, there will be an error when the Google service version of this phone is an old version. I have updated it to the latest version and it can be used normally

hzhou3 commented 1 year ago

Hi, thanks for replying! I also noticed it and have updated google play services. However, the graph is still not showing anything... Did you change any of the sample code? If so, do you mind sharing the code? Thanks in advance!

hzhou3 commented 1 year ago

I am get this error from system logs: NearbyMediums com.google.android.gms.persistent E MEDIUM_ERROR [NETWORK][BLUETOOTH][RECEIVE_PAYLOAD][RECEIVE_PAYLOAD_FAILED][UNKNOWN], Service ID : com.google.apps.hellouwb [CONTEXT service_id=54 ]

Does it mean the gms version is still not good?

I also see something like com.google.android.gms.common.api.ApiException: 8034: MISSING_PERMISSION_ACCESS_COARSE_LOCATION But in the manifest file, there are permissions given... Any advice is appreciated. Thanks

Sn0wfreezeDev commented 1 year ago

I manage to at maximum one measurement between two smartphones, then it stops working. However, a friend recently got the UWB Car Key and this seems to work without any issues on his Pixel.

hzhou3 commented 1 year ago

Hi @ Sn0wfreezeDev, can you share how you managed to get one measurement? What are the phones you use? I wonder when it stops working if you see the same message (i.e., medium error) or different errors. Thank you!

codetang-2417 commented 1 year ago

Due to the need to use S21+and embedded devices for ranging, I made significant changes to the source code. But I haven't made any changes to the core functions of UWB, so you can confirm if the GMS service of both phones is the latest version, and both devices have UWB function enabled in their settings. But I work for the company and the source code is not yet publicly available, so I'm sorry.

You can debug the source code in Android Studio, and view the debug log through the logcat function. If there is a problem in the create uwb client part, the debug log will tell you, but it may not be red, and may tell you in the form of a warning. This is usually caused by the driver bug of S21+. You need to turn on Airplane mode, restart UWB, or reboot the phone, and then check that Bluetooth, Nearby, uwb and other functions are all turned on, and enable the positioning function (may be required). Good luck to you!