Git Product home page Git Product logo

google / nearby Goto Github PK

View Code? Open in Web Editor NEW
653.0 25.0 141.0 27.21 MB

🐿️ A collection of projects focused on connectivity that enable building cross-device experiences.

Home Page: https://developers.google.com/nearby

License: Apache License 2.0

CMake 0.02% Starlark 0.42% C++ 97.32% C 0.55% Python 0.01% Objective-C 1.00% Objective-C++ 0.28% Swift 0.16% Makefile 0.02% Shell 0.01% Smarty 0.01% Rust 0.17% Dart 0.02% Kotlin 0.02%

nearby's Introduction

Nearby

Nearby is a collection of projects focused on connectivity that enable building cross-device experiences.

This is not an officially supported Google product.

Projects

A peer-to-peer networking API that allows apps to easily discover, connect to, and exchange data with nearby devices in real-time, regardless of network connectivity.

Utilizes Bluetooth Low Energy (BLE) to discover nearby Bluetooth devices without using significant phone battery, enabling "magical" scenarios based on device proximity.

An extension to Nearby Connections that features an extensible identity model for authentication and restricted visibility, resource management for system health, and proximity detection through sensor fusion.

A lightweight implementation of Fast Pair intended for embedded systems.

Contributing

We encourage you to contribute to Nearby! Please check out the Contributing to Nearby guide for guidelines about how to proceed.

License

Nearby is released under the Apache License 2.0

nearby's People

Contributors

aaronyjz avatar acozzette avatar anayw2001 avatar anthonyrueda avatar apolyudov avatar bourdakos1 avatar chenwangg avatar chunzhang999 avatar crisrael avatar deling-google avatar edwinwugoog avatar edwinwutw avatar ftsui avatar ggli-google avatar gribozavr avatar hai007 avatar jbabs1 avatar jfcarroll-triplecrown avatar jgsobczak avatar johnsonlu072 avatar julietlevesque avatar nohle avatar proatgram avatar qinwangz avatar realp1us avatar rzhw avatar shwetathecodewarrior avatar suetfei avatar theshepord avatar xlythe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nearby's Issues

Duplicate `_main` symbol when linking abseil

I tried making an empty SwiftUI project and importing this but the build failed and gave me an error 1 duplicate symbol for architecture arm64. On M1 mac so I'm thinking this might have to do with this? I thought it had to do with this but turning off common blocks did not help. Goal here is to build a sample macOS (Desktop) app and see if I can send a file from my Android phone to Mac using this library.

[Nearby Connections] [Android] EndpointDiscoveryCallback -> onEndpointLost callback almost never called

Project

Nearby Connections

Language

Other

OS Platform

Other

What happened?

The EndpointDiscoveryCallback -> onEndpointLost callback is almost never called.

I tested this for all strategies, using 2 devices (Pixel 7 and Samsung Galaxy Tab S6 Lite) by advertising by either device, discovering, and then calling stop advertising. I used the NearbyConnectionsWalkieTalkie sample for testing. The onEndpointLost callback was very rarely called (Only once in testing it 100s of times).

What did you expect to happen?

The EndpointDiscoveryCallback -> onEndpointLost callback should be called reliably every time after an endpoint stops advertising after some time.

How can we reproduce it (as minimally and precisely as possible)?

  1. Start discovery on Device 1
  2. Start Advertising on Device 2
  3. Wait for onEndpointFound to be called on Device 1
  4. Stop Advertising on Device 2
  5. Expected: The onEndpointLost should be called on Device 1 after an interval but is almost never called.

How often does this bug happen?

Often

Standalone code to reproduce the issue

No response

Relevant log output

D/WalkieTalkie: onEndpointFound(endpointId=3X4F, serviceId=com.google.location.nearby.apps.walkietalkie.automatic.SERVICE_ID, endpointName=03927)
I/alkie.automatic: Compiler allocated 4413KB to compile void android.view.ViewRootImpl.performTraversals()
D/WalkieTalkie: onEndpointFound(endpointId=YLFD, serviceId=com.google.location.nearby.apps.walkietalkie.automatic.SERVICE_ID, endpointName=03927)
D/WalkieTalkie: onEndpointFound(endpointId=JAHV, serviceId=com.google.location.nearby.apps.walkietalkie.automatic.SERVICE_ID, endpointName=29343)
D/WalkieTalkie: onEndpointFound(endpointId=YPXP, serviceId=com.google.location.nearby.apps.walkietalkie.automatic.SERVICE_ID, endpointName=95561)
D/WalkieTalkie: onEndpointFound(endpointId=VB79, serviceId=com.google.location.nearby.apps.walkietalkie.automatic.SERVICE_ID, endpointName=71741)

Anything else we need to know?

No response

Linux dedicated app support?

It will be nice, if you will add some dedicated application for GNU/Linux (maybe you also add this feature for windows ) that will run in daemon mode. So if you start sharing something to laptop, you will get popup and you can accept file.

So you can transfer files without chrome opened

Nearby Connections no option for Earshot distance?

So I am working with trying to transfer data between two phones with Google Nearby Connections.

For example, say I want to transfer a variable from each phone to another and then show a toast containing the text from the other phone.

I have been looking into the Connections API but I can't seem to limit it to when two phones are really close to each other. I have seen that the Nearby Messages API has an Earshot distance option.

But there isn't an option for earshot distance in the Nearby Connections API since the Nearby messages API doesn't seem to contain what I need to make something like the example above work.

Hope you can help me :)

iOS connection error when advertising

Project

Nearby Connections

Language

Swift

OS Platform

Apple

What happened?

When using an iOS device as an advertiser, the connection fails after being accepted (via code automatically or using the iOS Example provided in the repository) due to a parsing error in the secure message.

What did you expect to happen?

I expected the connection to be accepted. When using the iOS device as a discoverer, I do not encounter any problems when connecting to an Android device that is advertising.

How can we reproduce it (as minimally and precisely as possible)?

I have run multiple scenarios, all resulting in the same output:

Devices:

iPhone running iOS 16.5
iPad running iOS 16.5
Steps:

(using cluster/star strategy)

  1. Start advertising on the iPad.
  2. Start discovering on the iPhone.
  3. The connection request is automatically sent and accepted.
  4. An error occurs, preventing the message from being sent, and the connection is rejected by the advertiser's side.

I have also tried other scenarios using the iOS device as an advertiser and tested the iOS Example provided in the repository. In all cases, the same error occurred. Occasionally, the connection was approved, but I was unable to determine the reason why.

How often does this bug happen?

Often

Standalone code to reproduce the issue

The error was able to be produce with the iOS example, let me know if you are not being able to reproduce it.

Relevant log output

<PATH>/SourcePackages/checkouts/nearby/third_party/protobuf/src/google/protobuf/message_lite.cc:134] Can't parse message of type "securemessage.SecureMessage" because it is missing required fields: (cannot determine missing fields for lite message)
[ERROR] VerifyDecryptPayload: error parsing SecureMessage.
[ERROR] DecodeMessageFromPeer: Failed to verify message.

Anything else we need to know?

  • Using a star strategy with the android as a advertiser and iOS devices with discovery worked perfectly.
  • When using breakpoints in the didReceiveConnectionRequestFrom and didReceive methods, with hardcoded values set to true, the connection process proceeds without any issues.

Add retry logic for Wi-Fi LAN advertising to avoid issues on iOS 14.8.1

I'm currently using the latest version of the Nearby SPM.

The exact same code runs ok, and I'm able to startAdvertising on iOS 16.6 but on iOS 14.8.1 it fails to start.

These are the logs that I have

[lvl=2] service_controller_router.cc:85() ServiceControllerRouter going up.
[lvl=2] client_proxy.cc:60() ClientProxy ctor event_logger=0x0
[lvl=2] analytics_recorder.cc:101() Start AnalyticsRecorder ctor event_logger_=0x0
[lvl=2] endpoint_manager.cc:377() EndpointManager received request to add registration of frame processor 0x12c0256b0 for frame type PAYLOAD_TRANSFER, self=0x12c025638
[lvl=2] endpoint_manager.cc:377() EndpointManager received request to add registration of frame processor 0x12c0257b8 for frame type BANDWIDTH_UPGRADE_NEGOTIATION, self=0x12c025638
[lvl=2] offline_service_controller.cc:41() Client -2222247868050356217 requested advertising to start.
[lvl=2] base_pcp_handler.cc:179() StartAdvertising with supported mediums: { WIFI_LAN }
[lvl=2] p2p_cluster_pcp_handler.cc:2055() P2pClusterPcpHandler::StartWifiLanAdvertising: service=myserviceid: start
[lvl=2] base_pcp_handler.cc:432() Waiting for future to complete: StartAdvertising(myserviceid)
[lvl=2] wifi_lan.cc:242() Failed to start accepting WifiLan connections for service_id=myserviceid
[lvl=2] p2p_cluster_pcp_handler.cc:2064() In StartWifiLanAdvertising(6970686f6e652038), client=-2222247868050356217 failed to start listening for incoming WifiLan connections to service_id=myserviceid
[lvl=3] p2p_cluster_pcp_handler.cc:174() Failed StartAdvertising(6970686f6e652038) for client=-2222247868050356217
[lvl=2] client_proxy.cc:932() ClientProxy [ExitHighVisibilityMode]: client=-2222247868050356217
[lvl=2] base_pcp_handler.cc:439() Future:[StartAdvertising(myserviceid)] completed with status:12

Enable BLE v2 support for iOS

here ask for all supported mediums but it returns only wifi lan
Screenshot 2023-05-03 alle 19 35 09
StartAdvertising with supported mediums: { WIFI_LAN }

Add CocoaPods support

What would you like to be added?

Add CocoaPods support as an alternative to Swift Package Manager for Nearby Connections.

Why is this needed?

Frameworks like Flutter and React Native rely on CocoaPods for their plugin system. This makes it nearly impossible to distribute Nearby Connections as a plugin for these frameworks.

Memory usage continues to increase when receiving Payload

Project

Nearby Connections

Language

Swift

OS Platform

Apple

What happened?

I'm trying to use the nearby connection api to connect an Android device to an IOS (Simulator), and both can connect perfectly.

However, when receiving Payload on iOS, I found that the memory usage increased over time. And that can happen even if the data received is not handled at all. It doesn't matter if the Payload received is of Stream or Data (Bytes) type. Both can cause it.

The data received is a real-time audio recording, so every few milliseconds the device will receive the data.

I am a newbie in Swift (IOS) by the way, I don't know if there is a way to free the received data in memory or not. I apologize if this was my mistake in handling the API, and this issue is not a bug. And I ask for help to resolve this issue


Attachment
image

What did you expect to happen?

Immediately free memory allocation once the received data is handled, or at least memory usage does not continue to increase

How can we reproduce it (as minimally and precisely as possible)?

  1. Start Advertising on android (or another IOS)
  2. Start Discovery on IOS
  3. Attempt to connect to discovered Android
  4. After both connected, try send Payload Stream from android, or send Payload Bytes continuously
  5. When receiving a Payload Stream or Bytes, open a debug session in navigation from Xcode
image

How often does this bug happen?

Every time

Standalone code to reproduce the issue

No response

Relevant log output

No response

Anything else we need to know?

No response

Build fails on latest Linux due to header inclusion change in gcc/clang 13

Project

Nearby Connections

Language

C++

OS Platform

Linux

What happened?

When building using the README with the Bazel build system, things fail to build due to C integer types not being "defined" (file not being included). This happens in some of the code in this repository, in internal/crypto/sha2.h, internal/crypto/nearby_base.h, internal/crypto/random.h and in third party libraries such as abseil-cpp. This is due to this change in GCC 13.

With the files in this repository, all that would need to be changed is adding #include <cstdint> or #include <stdint.h> and for abseil-cpp, increasing the submodule commit to a commit equal or greater to commit b957f0c.

What did you expect to happen?

I expected it to build successfully without error.

How can we reproduce it (as minimally and precisely as possible)?

  1. Update/use GCC 13 or higher.
  2. Follow the steps in the Nearby Connections README.

How often does this bug happen?

Every time

Standalone code to reproduce the issue

No response

Relevant log output

ERROR: /home/thetimbrick/google/nearby/internal/crypto/BUILD:23:11: Compiling internal/crypto/sha2.cc failed: (Exit 1): clang-15 failed: error executing command (from target //internal/crypto:crypto)
  (cd /home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__ && \
  exec env - \
    BAZEL_CXXOPTS='-std=c++17' \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin \
    PWD=/proc/self/cwd \
  /usr/bin/clang-15 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++17' -MD -MF bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/sha2.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/sha2.pic.o' -fPIC '-DBAZEL_CURRENT_REPOSITORY=""' -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/boringssl -iquote bazel-out/k8-fastbuild/bin/external/boringssl -iquote external/com_google_absl -iquote bazel-out/k8-fastbuild/bin/external/com_google_absl -isystem external/boringssl/src/include -isystem bazel-out/k8-fastbuild/bin/external/boringssl/src/include -DCRYPTO_IMPLEMENTATION -Ithird_party -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c internal/crypto/sha2.cc -o bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/sha2.pic.o)
# Configuration: a7b732125cae20632358513ffa9ec1499ce0ba5122adaa7480c6548305ecada8
# Execution platform: @local_config_platform//:host
In file included from internal/crypto/sha2.cc:15:
./internal/crypto/sha2.h:36:26: error: use of undeclared identifier 'uint8_t'
CRYPTO_EXPORT std::array<uint8_t, kSHA256Length> SHA256Hash(
                         ^
./internal/crypto/sha2.h:37:22: error: unknown type name 'uint8_t'
    absl::Span<const uint8_t> input);
                     ^
2 errors generated.
Target //connections:core failed to build
INFO: Elapsed time: 413.084s, Critical Path: 44.32s
INFO: 375 processes: 107 internal, 268 local.
FAILED: Build did NOT complete successfully


ERROR: /home/thetimbrick/google/nearby/internal/crypto/BUILD:23:11: Compiling internal/crypto/nearby_base.cc failed: (Exit 1): clang-15 failed: error executing command (from target //internal/crypto:crypto)
  (cd /home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__ && \
  exec env - \
    BAZEL_CXXOPTS='-std=c++17' \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin \
    PWD=/proc/self/cwd \
  /usr/bin/clang-15 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++17' -MD -MF bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/nearby_base.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/nearby_base.pic.o' -fPIC '-DBAZEL_CURRENT_REPOSITORY=""' -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/boringssl -iquote bazel-out/k8-fastbuild/bin/external/boringssl -iquote external/com_google_absl -iquote bazel-out/k8-fastbuild/bin/external/com_google_absl -isystem external/boringssl/src/include -isystem bazel-out/k8-fastbuild/bin/external/boringssl/src/include -DCRYPTO_IMPLEMENTATION -Ithird_party -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c internal/crypto/nearby_base.cc -o bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/nearby_base.pic.o)
# Configuration: a7b732125cae20632358513ffa9ec1499ce0ba5122adaa7480c6548305ecada8
# Execution platform: @local_config_platform//:host
In file included from internal/crypto/nearby_base.cc:15:
./internal/crypto/nearby_base.h:33:18: error: unknown type name 'uint8_t'
absl::Span<const uint8_t> as_bytes(absl::Span<T> s) noexcept {
                 ^
./internal/crypto/nearby_base.h:34:34: error: unknown type name 'uint8_t'
  return {reinterpret_cast<const uint8_t*>(s.data()), sizeof(T) * s.size()};
                                 ^
2 errors generated.
Target //connections:core failed to build
INFO: Elapsed time: 351.377s, Critical Path: 350.73s
INFO: 548 processes: 63 internal, 485 local.
FAILED: Build did NOT complete successfully


ERROR: /home/thetimbrick/google/nearby/internal/crypto/BUILD:23:11: Compiling internal/crypto/random.cc failed: (Exit 1): clang-15 failed: error executing command (from target //internal/crypto:crypto)
  (cd /home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__ && \
  exec env - \
    BAZEL_CXXOPTS='-std=c++17' \
    PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin \
    PWD=/proc/self/cwd \
  /usr/bin/clang-15 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++17' -MD -MF bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/random.pic.d '-frandom-seed=bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/random.pic.o' -fPIC '-DBAZEL_CURRENT_REPOSITORY=""' -iquote . -iquote bazel-out/k8-fastbuild/bin -iquote external/boringssl -iquote bazel-out/k8-fastbuild/bin/external/boringssl -iquote external/com_google_absl -iquote bazel-out/k8-fastbuild/bin/external/com_google_absl -isystem external/boringssl/src/include -isystem bazel-out/k8-fastbuild/bin/external/boringssl/src/include -DCRYPTO_IMPLEMENTATION -Ithird_party -no-canonical-prefixes -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c internal/crypto/random.cc -o bazel-out/k8-fastbuild/bin/internal/crypto/_objs/crypto/random.pic.o)
# Configuration: a7b732125cae20632358513ffa9ec1499ce0ba5122adaa7480c6548305ecada8
# Execution platform: @local_config_platform//:host
In file included from internal/crypto/random.cc:15:
./internal/crypto/random.h:37:41: error: use of undeclared identifier 'uint8_t'
CRYPTO_EXPORT void RandBytes(absl::Span<uint8_t> bytes);
                                        ^
1 error generated.
Target //connections:core failed to build
INFO: Elapsed time: 4.746s, Critical Path: 4.36s
INFO: 15 processes: 6 internal, 9 local.
FAILED: Build did NOT complete successfully


In file included from /home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.cc:16:
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:34:35: error: unknown type name 'uint8_t'
enum class FormatConversionChar : uint8_t;
                                  ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:35:38: error: unknown type name 'uint64_t'
enum class FormatConversionCharSet : uint64_t;
                                     ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:173:21: error: unknown type name 'uint8_t'
  enum class Enum : uint8_t {
                    ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:327:19: error: unknown type name 'uint64_t'
      static_cast<uint64_t>(a) |
                  ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:328:19: error: unknown type name 'uint64_t'
      static_cast<uint64_t>(FormatConversionCharSetUnion(rest...)));
                  ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:331:11: error: unknown type name 'uint64_t'
constexpr uint64_t FormatConversionCharToConvInt(FormatConversionChar c) {
          ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:332:10: error: use of undeclared identifier 'uint64_t'
  return uint64_t{1} << (1 + static_cast<uint8_t>(c));
         ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:332:18: error: expected ';' after return statement
  return uint64_t{1} << (1 + static_cast<uint8_t>(c));
                 ^
                 ;
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:335:11: error: unknown type name 'uint64_t'
constexpr uint64_t FormatConversionCharToConvInt(char conv) {
          ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:348:35: error: no return statement in constexpr function
constexpr FormatConversionCharSet FormatConversionCharToConvValue(char conv) {
                                  ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
  ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_(ABSL_INTERNAL_CHAR_SET_CASE, )
  ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:147:9: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(c) X_SEP X_VAL(s) X_SEP \
        ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:147:24: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(c) X_SEP X_VAL(s) X_SEP \
                       ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:149:9: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(d) X_SEP X_VAL(i) X_SEP X_VAL(o) X_SEP \
        ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:149:24: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(d) X_SEP X_VAL(i) X_SEP X_VAL(o) X_SEP \
                       ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:149:39: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(d) X_SEP X_VAL(i) X_SEP X_VAL(o) X_SEP \
                                      ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:150:9: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(u) X_SEP X_VAL(x) X_SEP X_VAL(X) X_SEP \
        ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:150:24: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(u) X_SEP X_VAL(x) X_SEP X_VAL(X) X_SEP \
                       ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:150:39: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(u) X_SEP X_VAL(x) X_SEP X_VAL(X) X_SEP \
                                      ^
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:357:3: error: default initialization of an object of const type 'const absl::FormatConversionCharSet'
/home/thetimbrick/.cache/bazel/_bazel_thetimbrick/54eafa58feb1122e78a2e515ed11b705/execroot/__main__/external/com_google_ukey2/third_party/absl/absl/strings/internal/str_format/extension.h:152:9: note: expanded from macro 'ABSL_INTERNAL_CONVERSION_CHARS_EXPAND_'
  X_VAL(f) X_SEP X_VAL(F) X_SEP X_VAL(e) X_SEP X_VAL(E) X_SEP \
        ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
5 warnings and 20 errors generated.
make[2]: *** [third_party/absl/absl/strings/CMakeFiles/absl_str_format_internal.dir/build.make:104: third_party/absl/absl/strings/CMakeFiles/absl_str_format_internal.dir/internal/str_format/extension.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:2408: third_party/absl/absl/strings/CMakeFiles/absl_str_format_internal.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-fastbuild/bin/connections/implementation/ukey2_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-fastbuild/bin/connections/implementation/ukey2_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-fastbuild/bin/connections/implementation/ukey2_foreign_cc/CMake.log

Target //connections:core failed to build
INFO: Elapsed time: 494.212s, Critical Path: 481.14s
INFO: 4 processes: 2 internal, 2 local.
FAILED: Build did NOT complete successfully

Anything else we need to know?

Adding #include <cstdint> or #include <stdint.h> to internal/crypto/sha2.h, internal/crypto/nearby_base.h, and internal/crypto/random.h should fix the issue in the internal sources.

Updating the commit for the abseil-cpp submodule to a version greater than or equal to b957f0c in third_party/absl should solve that same issue for this dependency.

In the third party library ukey2, the same thing is happening with the C integer inclusion in their submodule for abseil-cpp, although that is a problem with that project and not this one. I am trying to build ukey2 by itself but it doesn't seem to want to build when I am not building using the build for Nearby Connections. The solution to this would to also increase the commit hash for it's abseil-cpp dependency to the one that fixes this issue. There is a PR in google/ukey2 that would remove the need for abseil-cpp that would solve that issue for that repository, but the PR and issue have been stagnant.

This bug might be relevant in other projects in this repository but they did not have instructions on how to build them, and since I'm not familiar with the Bazel build system I have not been able to build and test them yet.

The current GCC version in Ubuntu Latest is GCC 10 it looks like, so the issue will most likely not be reproducable in that enviornment.

How to get Provider's Public Key?

In Fast Pair Procedure
When handling a write request from a Fast Pair Seeker, Seeker first enables Notifications on the Key-based Pairing characteristic, and then writes the data in Table 1.1 to it.

It's confusing to create uint128 Encrypted Request without knowing Public Key of Provider.

In order to create shared_secret it requires Bob's(Seeker's) Private Key and Alice's(Provider's) Public Key.

Can I know how to get Provider's Public Key?

Cross platform connection failure

We are attempting to establish a connection between an Android phone and an iPhone. However, despite being in the same WIFI LAN, the two devices are unable to discover each other. Upon inspecting the logs, it appears that the iPhone is advertising and discovering on the WIFI_LAN medium, while the Android device is using NFC.

The testing conditions are as follows:

  • Both devices are connected to the same WIFI LAN network.
  • They are utilizing the same communication strategy (star configuration).
  • The same service ID is being used for the communication attempt.

how to build it

it's a great work! I really like it. but i don't know how to build it, anybody knows?

ConnectionManager is unable to distinguish the same device when discovered multiple times

Project

Nearby Connections Examples

Language

Swift

OS Platform

Apple

What happened?

I'm using the iOS example applications, completely out of the box, on the following devices:

  • iPhone 13 - iOS 16.5.1
  • iPad Air - iPadOS 16.5.1

And the following happens:

RPReplay_Final1687951904.MP4

This is not app related, as I've ran into this issue on an app I'm developing before testing with the example.
It's also not strategy related as I'm running Point-to-Point on my app and Cluster on the example.

What did you expect to happen?

The device list should not have duplicates.

How can we reproduce it (as minimally and precisely as possible)?

  1. Start advertising on device 1
  2. Start discovery on device 2
  3. Toggle discovery between on and off several times
  4. See the list grow

How often does this bug happen?

Every time

Standalone code to reproduce the issue

NA

Relevant log output

NA

Anything else we need to know?

NA

Unsafe dependency error while building an Xcode flutter project

Hello,

I'm developing a flutter app with native iOS code, I'm trying to use the nearby connections library within my project yet it refuses to compile with the following error:

Target Integrity (Xcode): The package product 'NearbyCoreAdapter' cannot be used as a dependency of this target because it uses unsafe build flags
Encountered error while building for device.

Is there a way to enable unsafe compilation within the Xcode part of the project or another way to solve this issue?

Thanks

Connectins background Advertisement on IOS

I want to use connections to advertise in the background with WIFI and BLE on IOS but other devices only find me when I'm in the foreground. The background task runs without errors, how can I fix it?

The background task stops and restarts advertising every 30 seconds

With the Messages API it works calling publish every 30 seconds

Nearby share source code

It's not google nearby share source code? Do you know where can I find google nearby share one?

Data handling & privacy policies

Hello, I am currently exploring Google Nearby Connections API for exchanging file data across devices.
I would like to understand more about the data handling & privacy practices associated with this API, but could not find informations on the main developers API site.
More specifically, I'm interested in learning whether Google collects or has access to any data about the files that are sent through the Google Nearby API. Could you provide context or information on how data transmitted through the API is treated, stored, and used?

Thank you for your help.

Nearby networking really unstable with a large number of devices

I am trying to integrate Google Nearby Connections into an Android app to create a star network because a server tablet and multiple client tablets and send messages.
The problem I have is that everything seems to work find in my development environment with 2 devices, but in the real world, with 25 devices over a couple of hours, there are a lot of disconnections, especially coming from the advertiser.
Is there any known network size limitation or other issue with this technology that doesn't make it suitable for this kind of use case?

Device discovering itself after calling stopAdvertising

Hello, I am writing an application that makes use of NearbyConnections' advertising and discovery simultaneously. However, I've encountered some unexpected behavior on Android 14 after running the following (rough) sequence of steps, and I'm trying to understand what is happening:

//turn on Nearby
startAdvertising()
startDiscovery()

//turn off Nearby
stopAdvertising()
stopAllEndpoints()
stopDiscovery()

//turn on Nearby a 2nd time
startAdvertising()
startDiscovery()

The second call to startDiscovery() results in the device discovering a phantom endpoint from the first call of startAdvertising() for a few seconds before losing it. This also happens after completely closing the app before calling startDiscovery() a second time. If I do this multiple times, I can occasionally get it to discover more than one phantom endpoint from the prior invocations. Any intuition as to why this might be happening? It seems to me that stopAdvertising() isn't entirely releasing the OS resources used for advertising.

Other details that might be relevant:

  • I am using P2P_CLUSTER mode
  • The bug doesn't seem to happen on Android 12, which I am running on another phone that I have
  • Calling startDiscovery() before startAdvertising() seems to fix the problem, but I doubt the above is the intended behavior

Changes in NearbyShare as a result of merging with QuickShare

Hi,
I am working on a project that relies on how the NearbyShare app works and uses the Nearby Connections API. Google and Samsung just announced in CES 2024 that Nearby Share and Quick Share are merging into one service which will be called Quick Share. Do you have any information about how the new Quick Share is going to work internally? Is the protocol about to change somehow? Is the Desktop Nearby Share app going to change somehow internally other than UI changes?
I am afraid of a scenario where I will develop something that relies on how NearbyShare works today but it will all be for nothing as it will maybe change in the next month. It will be extremely helpful if you can provide information about if and what is going to change in the protocol internally so I can prepare

Build fail on Mac on master

CC=clang CXX=clang++ bazel build -s --check_visibility=false //connections:core --spawn_strategy=standalone --verbose_failures

In file included from ./internal/platform/base_input_stream.h:19:
./internal/platform/exception.h:108:23: error: no matching constructor for initialization of 'location::nearby::Exception'
Exception exception_{Exception::kFailed};
^~~~~~~~~~~~~~~~~~~~
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'location::nearby::Exception::Value' to 'const location::nearby::Exception' for 1st argument
struct Exception {
^
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'location::nearby::Exception::Value' to 'location::nearby::Exception' for 1st argument
struct Exception {
^
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
./internal/platform/exception.h:90:20: error: no matching constructor for initialization of 'location::nearby::Exception'
exception_ = Exception{Exception::kSuccess};
^ ~~~~~~~~~~~~~~~~~~~~~
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'location::nearby::Exception::Value' to 'const location::nearby::Exception' for 1st argument
struct Exception {
^
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'location::nearby::Exception::Value' to 'location::nearby::Exception' for 1st argument
struct Exception {
^
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
In file included from internal/platform/byte_utils.cc:20:
./internal/platform/base_input_stream.h:38:12: error: no matching conversion for functional-style cast from 'size_t' (aka 'unsigned long') to 'ExceptionOr<size_t>' (aka 'ExceptionOr')
return ExceptionOr<size_t>(real_offset);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./internal/platform/exception.h:72:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'const location::nearby::ExceptionOr' for 1st argument
class ExceptionOr {
^
./internal/platform/exception.h:72:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'size_t' (aka 'unsigned long') to 'location::nearby::ExceptionOr' for 1st argument
./internal/platform/exception.h:85:12: note: candidate template ignored: could not match 'ExceptionOr' against 'unsigned long'
explicit ExceptionOr(ExceptionOr value) {
^
./internal/platform/exception.h:74:3: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
ExceptionOr() = default;
^
In file included from internal/platform/byte_utils.cc:20:
./internal/platform/base_input_stream.h:43:12: error: no matching constructor for initialization of 'location::nearby::Exception'
return {Exception::kSuccess};
^~~~~~~~~~~~~~~~~~~~~
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'location::nearby::Exception::Value' to 'const location::nearby::Exception' for 1st argument
struct Exception {
^
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'location::nearby::Exception::Value' to 'location::nearby::Exception' for 1st argument
./internal/platform/exception.h:25:8: note: candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided
4 errors generated.

Entry point for using Connections API in a Windows app

I am trying to add the library to a Windows app. I need the Nearby File share functionality over all supported mediums. Is there documentation on the entry point in this library to make use of it? And smallest set of files/components needed from all that is available in this repo? If there is a sample Windows app, that would be best to understand the code.

Swift Error scanning BLE Swift

ble_v2.cc:97() New peripheral imp=0x280803f88, callback the proxy peripheral=0x16d912018
[lvl=2] discovered_peripheral_tracker.cc:81() Ignoring BLE advertisement header because the peripheral is invalid or the given service data is empty.

I scan from an Iphone an android device, the Android phone can find me but iphone can't find the android. How I can try to solve this?

iOS NearbyConnections doesn't work with React Native

Project

Nearby Connections

Language

Swift

OS Platform

Apple

What happened?

When trying to use React Native with Nearby Connections on iOS, the app crashes with an sdallocx error in OPENSSL_free (inside of the BoringSSL-grpc package) when requesting a connection to another endpoint. Note that discovering/advertising works, it only crashes when requesting a connection.

This issue seems very similar to apple/swift-nio-ssl#189 (read the thread for more details, specifically the last few comments). Additionally, the fix used in that package here fixes the issue above.

What did you expect to happen?

No error/crash to happen when requestingConnection

How can we reproduce it (as minimally and precisely as possible)?

  1. Create a react native project
  2. Create a react native swift package with a method that calls discover and requests connection to any endpoints found
  3. Call this method from react native
  4. The app will crash immediately after requesting connection to a discovered endpoint

How often does this bug happen?

Every time

Standalone code to reproduce the issue

Can't provide any code for this since it's very involved. The steps above should be enough to repro 100% of the time

Relevant log output

No response

Anything else we need to know?

The workaround doesn't seem to introduce any issues so not an urgent issue, just a QOL improvement

Build failed on Ubuntu 20.04.4 LTS

Follow the build step, build failed, with "Protobuf tests failed; can't use this protobuf."

Env:
Description: Ubuntu 20.04.4 LTS
Release: 20.04
without local protobuf.

Log here:
[ OK ] IoTest.StringIo (0 ms)
[ RUN ] IoTest.LargeOutput
CMake Error at cmake/local_build_protobuf.cmake:36 (message):
Protobuf tests failed; can't use this protobuf
Call Stack (most recent call first):
CMakeLists.txt:35 (include)

-- Configuring incomplete, errors occurred!
See also "/root/.cache/bazel/_bazel_root/1ce23f7b6c14f468f41df4f296fc9236/execroot/main/bazel-out/k8-fastbuild/bin/connections/implementation/ukey2.build_tmpdir/CMakeFiles/CMakeOutput.log".
_____ END BUILD LOGS _____
rules_foreign_cc: Build wrapper script location: bazel-out/k8-fastbuild/bin/connections/implementation/ukey2_foreign_cc/wrapper_build_script.sh
rules_foreign_cc: Build script location: bazel-out/k8-fastbuild/bin/connections/implementation/ukey2_foreign_cc/build_script.sh
rules_foreign_cc: Build log location: bazel-out/k8-fastbuild/bin/connections/implementation/ukey2_foreign_cc/CMake.log

Target //connections:core failed to build
INFO: Elapsed time: 537.925s, Critical Path: 507.26s
INFO: 2 processes: 2 internal.
FAILED: Build did NOT complete successfully

Bazel not finding varref and vardef

Building the library is impossible for me, as Bazel cannot find the names of vardef and varref in the windows client. How do I fix this?

ERROR: C:/Users/[user]/nearby/connections/clients/windows/BUILD:51:1: name 'vardef' is not defined
ERROR: C:/Users/[user]/nearby/connections/clients/windows/BUILD:60:15: name 'varref' is not defined
ERROR: C:/Users/[user]/nearby/internal/platform/implementation/BUILD:16:11: no such target '//connections/clients/windows:types': target 'types' not declared in package 'connections/clients/windows' defined by C:/Users/[user]/nearby/connections/clients/windows/BUILD and referenced by '//internal/platform/implementation:types'
INFO: Repository rules_python instantiated at:
  C:/Users/[user]/nearby/WORKSPACE:85:14: in <toplevel>
  C:/Users/[user]/_bazel_[user]/7w2phohm/external/com_google_protobuf/protobuf_deps.bzl:60:21: in protobuf_deps
Repository rule http_archive defined at:
  C:/Users/[user]/_bazel_[user]/7w2phohm/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
INFO: Repository rules_proto instantiated at:
  C:/Users/[user]/nearby/WORKSPACE:85:14: in <toplevel>
  C:/Users/[user]/_bazel_[user]/7w2phohm/external/com_google_protobuf/protobuf_deps.bzl:52:21: in protobuf_deps
Repository rule http_archive defined at:
  C:/Users/[user]/_bazel_[user]/7w2phohm/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
INFO: Repository com_google_glog instantiated at:
  C:/Users/[user]/nearby/WORKSPACE:55:13: in <toplevel>
Repository rule http_archive defined at:
  C:/Users/[user]/_bazel_[user]/7w2phohm/external/bazel_tools/tools/build_defs/repo/http.bzl:353:31: in <toplevel>
ERROR: Analysis of target '//connections:core' failed; build aborted:
INFO: Elapsed time: 8.555s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (65 packages loaded, 297 targets configured)
    currently loading: @com_google_protobuf//

Need the help to activate my Fast Pair project

What would you like to be added?

Even if the registration of a new Fast Pair device completed, I still can't find my device from Google Fast Pair Validator.
In the development console, I notice the message: "All new Fast Pair projects will be considered 'provisional' and any models created under new projects will not trigger Fast Pair discovery until the project is made active. To request a project become active, please raise a bug against the FP component with the model ID."

Can you guide me how I make my project become active?
My model ID is 0x441C4C.
Thanks in advance.

Why is this needed?

Our customer is requesting for an example of Fast Pair.
Hence, I need to implement using our start kit.

Can't add library using SPM

Project

Nearby Connections

Language

Swift

OS Platform

Windows

What happened?

Followed instructions from this page:
https://github.com/google/nearby/

Searching for google/nearby using Xcode 14.3.1 results in nothing found.

The documentation should link to this GitHub page instead to make it easier to find the library.

Added https://github.com/google/nearby in SPM and this results in Xcode suggesting to check out the main branch? Why is not a specific version suggested?

Selecting "Up to Next Major Version" and typing in 1.0.0 results in:
"Failed to resolve dependencies Dependencies could not be resolved because no versions of 'nearby' match the requirement 1.0.0.. <2.0.0 and root depends o..."

What did you expect to happen?

Library was successfully added to project.

How can we reproduce it (as minimally and precisely as possible)?

  1. go to https://developers.google.com/nearby/connections/swift/get-started
  2. follow instructions on how to add project to an Xcode project using SPM

Notice that nothing is found when using the search term provided on this page.

How often does this bug happen?

Every time

Standalone code to reproduce the issue

No response

Relevant log output

No response

Anything else we need to know?

No response

Wifi Direct for cross platform transferring?

Hi there,

Thanks a lot for your work.

I learnt from this documentation that Android p2pWifiManager allow connection with devices that does not support Wifi Direct.

Would you consider also utilize Wifi direct for cross platform sharing cases? perhaps use BLE to figure out the medium first?

Thank you!

Clarification on iOS/Android compatibility and future

Hello, first of all thanks for your great work!
I am right now really confused on the state and direction of the Google Nearby products.
The Nearby Messages API (which communicates via the cloud) works for Android and iOS but will be discontinued.
For the Nearby Connections API on the other hand, the documentation states at various places that it only supports Android.
However, looking at the examples at this repository, communication between Android and iOS seems possible.
I understand that the iOS implementation is still work-in-progress.
But, is the general idea that the new Nearby Connections API will replace the use cases of the former Nearby Messages API?
And the documentation of the Nearby Connections API will be updated to reflect iOS support once ready?

I am also wondering how this all relates to the cross-device-sdk https://github.com/google/cross-device-sdk which has seen barely any development since its announcement on Google I/O 22 and has som similar objectives.

It would be nice if you could provide some information, although I understand that you probably can not make any statements about Goolgle policies and/or product decisions.

Build error for nearby embedded sdk

Build embedded sdk error on ubuntu 22

cd nearby/embedded
./build.sh gLinux dist DEBUG=1
./build.sh: 15: [: gLinux: unexpected operator

make: 进入目录“/home/mi/gfps/nearby/embedded”
mkdir -p out/gLinux/common/source/
clang -c -Wall -g -MD -Werror -Wno-deprecated-declarations -DARCH_GLINUX -fsanitize=address -fno-omit-frame-pointer -DARCH_GLINUX -DNEARBY_ALL_MODULE_DEBUG -DNEARBY_UNIT_TEST_ENABLED  -O0 -DNEARBY_TRACE_LEVEL=NEARBY_TRACE_LEVEL_VERBOSE -I. -Icommon/source/gLinux -Icommon/target -Icommon/target/gLinux -Icommon/source -o out/gLinux/common/source/nearby_fp_library.o -D__NEARBY_SHORT_FILE__='"nearby_fp_library.c"' common/source/nearby_fp_library.c
mkdir -p out/gLinux/common/source/
clang -c -Wall -g -MD -Werror -Wno-deprecated-declarations -DARCH_GLINUX -fsanitize=address -fno-omit-frame-pointer -DARCH_GLINUX -DNEARBY_ALL_MODULE_DEBUG -DNEARBY_UNIT_TEST_ENABLED  -O0 -DNEARBY_TRACE_LEVEL=NEARBY_TRACE_LEVEL_VERBOSE -I. -Icommon/source/gLinux -Icommon/target -Icommon/target/gLinux -Icommon/source -o out/gLinux/common/source/nearby_message_stream.o -D__NEARBY_SHORT_FILE__='"nearby_message_stream.c"' common/source/nearby_message_stream.c
mkdir -p out/gLinux/common/source/
clang -c -Wall -g -MD -Werror -Wno-deprecated-declarations -DARCH_GLINUX -fsanitize=address -fno-omit-frame-pointer -DARCH_GLINUX -DNEARBY_ALL_MODULE_DEBUG -DNEARBY_UNIT_TEST_ENABLED  -O0 -DNEARBY_TRACE_LEVEL=NEARBY_TRACE_LEVEL_VERBOSE -I. -Icommon/source/gLinux -Icommon/target -Icommon/target/gLinux -Icommon/source -o out/gLinux/common/source/nearby_utils.o -D__NEARBY_SHORT_FILE__='"nearby_utils.c"' common/source/nearby_utils.c
mkdir -p out/gLinux/client/source/
clang -c  -Wall -g -MD -Werror -Wno-deprecated-declarations -DARCH_GLINUX -fsanitize=address -fno-omit-frame-pointer -DARCH_GLINUX -DNEARBY_ALL_MODULE_DEBUG -DNEARBY_UNIT_TEST_ENABLED  -O0 -DNEARBY_TRACE_LEVEL=NEARBY_TRACE_LEVEL_VERBOSE -I. -Icommon/source/gLinux -Icommon/target -Icommon/target/gLinux -Icommon/source -Icommon/target -Iclient/source -Iclient/target -o out/gLinux/client/source/nearby_fp_client.o -D__NEARBY_SHORT_FILE__='"nearby_fp_client.c"' client/source/nearby_fp_client.c
mkdir -p out/gLinux/
ar rcs out/gLinux/libnearby.a out/gLinux/common/source/nearby_fp_library.o out/gLinux/common/source/nearby_message_stream.o out/gLinux/common/source/nearby_utils.o out/gLinux/client/source/nearby_fp_client.o
'out/gLinux/PHONY_FIRMWARE_VERSION' -> 'out/gLinux/FIRMWARE_VERSION'

=====ERROR=====
Missing copyright in common/target/nearby.h
make: *** [Makefile:126:dist/gLinux/nearby.h] 错误 1
make: 离开目录“/home/mi/gfps/nearby/embedded”

Failed to start discovery with Google Play services 23.34.14

Project

Nearby Connections

Language

Kotlin

OS Platform

Android (com.google.android.gms:play-services-nearby:18.7.0)

What happened?

With Google Play services 23.34.14 I get attached error every time I call startDiscovery. It doesn't matter which strategy I choose. With older version of Google Play services everything works as expected. Tested e.g. on 22.06.18.

Issue can be reproduced on different phones (OnePlus 6 - Android 11, Samsung S20 FE - Android 12, Samsung A21s - Android 11).

What did you expect to happen?

Nearby Connections should start discovery successfully on the latest version of Google Play services

How can we reproduce it (as minimally and precisely as possible)?

  1. Call startDiscovery method on a phone with Google Play services 23.34.14 installed

How often does this bug happen?

Every time

Relevant log output

Failed to start discovery.
                                                                                                    com.google.android.gms.common.api.ApiException: 17: API: Nearby.CONNECTIONS_API is not available on this device. Connection failed with: ConnectionResult{statusCode=INTERNAL_ERROR, resolution=null, message=null}
                                                                                                    	at com.google.android.gms.common.api.internal.zad.zad(com.google.android.gms:play-services-base@@18.0.1:1)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.zaE(com.google.android.gms:play-services-base@@18.0.1:7)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.zaD(com.google.android.gms:play-services-base@@18.0.1:2)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.zar(com.google.android.gms:play-services-base@@18.0.1:24)
                                                                                                    	at com.google.android.gms.common.api.internal.zabq.onConnectionFailed(com.google.android.gms:play-services-base@@18.0.1:1)
                                                                                                    	at com.google.android.gms.common.internal.zai.onConnectionFailed(com.google.android.gms:play-services-base@@18.0.1:1)
                                                                                                    	at com.google.android.gms.common.internal.zzf.zzb(com.google.android.gms:play-services-basement@@18.1.0:2)
                                                                                                    	at com.google.android.gms.common.internal.zza.zza(com.google.android.gms:play-services-basement@@18.1.0:3)
                                                                                                    	at com.google.android.gms.common.internal.zzc.zze(com.google.android.gms:play-services-basement@@18.1.0:3)
                                                                                                    	at com.google.android.gms.common.internal.zzb.handleMessage(com.google.android.gms:play-services-basement@@18.1.0:31)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:226)
                                                                                                    	at android.os.Looper.loop(Looper.java:313)
                                                                                                    	at android.os.HandlerThread.run(HandlerThread.java:67)

Anything else we need to know?

startAdvertising method works as expected

Need help on encoding of BLE during receive

    // SLAAUMHj       oSSHbu           TW90byBQb3dlck        ul/BWLwZ6e       ALE
    // ------------|-----------|---Base64 of "Moto Power"--|---------------|-------| 

How naming of Bluetooth on receive device generated ?

Video stream on both Android and iOS

Hi,

This looks a great, very much needed project!

My question: I would like to set up a realtime webRTC video stream from an IoT device (running Linux) to both Android and iOS (iPhones mostly).
The setup would look like the following: the IoT device creates a wifi hotspot; the phone needs to connect to it but without dropping its internet data as the IoT device won't have any internet; the streams from IoT to phone starts.

First I was considering wifi-direct, however, iOS doesn't support it. Would I be able to use Nearby instead?

Thanks!

Use case without bluetooth support?

First of all, thank you for open sourcing this library!

On my Android phone it says that: Nearby Share uses Bluetooth scanning to find nearby devices. I guess this means that until you get around to implement Bluetooth support, the use cases for this library are pretty limited. Is that correct?

Or is there a way to force initial discovery to happen via Wifi LAN?

Cannot sign into Nearby Share for Windows Beta

Project

Other

Language

Other

OS Platform

Windows

What happened?

I have downloaded and installed the latest Nearby Share for Windows Beta, but can't seem to sign into it. Clicking sign in takes me to the standard Google OAuth sign in page, but once I sign in it displays the following cryptic error:

image

The URL of this error page is https://accounts.google.com/info/unknownerror

Any help would be much appreciated thank you.

What did you expect to happen?

OAuth token passed back to the Nearby Share app so it can sign in.

How can we reproduce it (as minimally and precisely as possible)?

  1. Install Nearby Share for Windows
  2. Attempt to sign in

How often does this bug happen?

Every time

Standalone code to reproduce the issue

No response

Relevant log output

No response

Anything else we need to know?

No response

Build fails (connections, Arch Linux)

CC=clang CXX=clang++ bazel build -s --check_visibility=false //connections:core --spawn_strategy=standalone --verbose_failures

Starting local Bazel server and connecting to it...
Server crashed during startup. Now printing /home/alba4k/.cache/bazel/_bazel_alba4k/08dd8884ffe2d5fea3ae4d4b8a6e5ff3/server/jvm.out
Unrecognized option: --add-opens=java.base/java.lang=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Is there anything that I am doing wrong? (I followed the instructions in the relevant README.md.

bazel 6.3.0
up-to-date arch linux system
openjre and openjdk 11

Unable to discover and advertise in iOS

Project

Nearby Connections

Language

Swift

OS Platform

Apple

What happened?

While I try to advertise its throwing error with error message Error Domain=kNWErrorDomainDNS Code=-65555 "DNS Error: NoAuth" UserInfo={NSDescription=DNS Error: NoAuth}

when I try to discover its throwing a error message as Failed StartDiscovery() for client=2228946243778077910 because we couldn't scan on Bluetooth, BLE, or WifiLan for serviceId

What did you expect to happen?

Advertise and Discover should work as expected

How can we reproduce it (as minimally and precisely as possible)?

  1. Start discoverer
  2. Start advertiser

How often does this bug happen?

Every time

Standalone code to reproduce the issue

  1. Start discoverer
  2. Start advertiser

Relevant log output

iOS Example[15260:8251441] [browser] nw_browser_fail_on_dns_error_locked [B1] DNSServiceBrowse failed: NoAuth(-65555)

StartDiscovery() Error starting discovery for service type<_307BEAB11028._tcp.>: Error Domain=kNWErrorDomainDNS Code=-65555 "DNS Error: NoAuth" UserInfo={NSDescription=DNS Error: NoAuth}

Example[15260/0x16f39b000] [lvl=3] p2p_cluster_pcp_handler.cc:1010() Failed StartDiscovery() for client=2228946243778077910 because we couldn't scan on Bluetooth, BLE, or WifiLan for service_id=com.google.location.nearby.apps.helloconnections

Anything else we need to know?

No response

Connection upgrade failure on Lenovo Tab M10 leads to constant disconnection

I am developing an app for music bands where musicians can connect to a conductor's tablet, even when there is no internet connection in a basement or something like that. I am using Google Nearby Connections in a STAR strategy, using Flutter but going through version 19.0.0 of Google Nearby and un up-to-date Google Play Services on a couple of Lenovo Tab M10s.

I am testing my application in a setup where none of the tablets are connected to the internet, but Wifi is enabled on both, as well as bluetooth. The initial connection from the musician tablet to the conductor tablet works great, and they are even able to exchange payloads. But after a few seconds, the conductor (the hub in the star) disconnects without the user doing anything, and so all the spokes disconnect as well. I have made it so that when spokes receive the disconnection callback, they immediately try to reconnect to the same endpoint, and sometimes it works, sometimes it doesn't, but it never lasts, because soon enough, the hub disconnects again.

When we test with other devices, or with an internet connection, it seems to work fine. So my working hypothesis is that it's a hardware issue, that some tablets just don't support the wifi hotspot configuration properly and the connection upgrade fails or something, which seems to be confirmed by this logcat extract:

2023-10-13 10:09:48.346  1791-15556 NearbyMediums           com.google.android.gms.persistent    E  Failed to start a Wifi hotspot for service com.example.myapp
2023-10-13 10:09:48.346  1014-1014  UnisocWifiService       system_server                        D  action = android.net.wifi.WIFI_STATE_CHANGED
2023-10-13 10:09:48.346  1014-1014  Looper                  system_server                        W  Drained
2023-10-13 10:09:48.347  1367-1367  StatusBarSignalPolicy   com.android.systemui                 D  WifiIconState(resId=17302885, visible=true, dualWifiVisible=false)
2023-10-13 10:09:48.348  1791-15707 NearbyMediums           com.google.android.gms.persistent    E  There's no Direct hotspot to stop when the Wi-Fi Direct channel disconnected for service com.example.myapp.
2023-10-13 10:09:48.348  1791-15556 NearbyConnections       com.google.android.gms.persistent    E  BandwidthUpgradeManager couldn't complete the upgrade for endpoint WNI4 because it failed to initialize the BANDWIDTH_UPGRADE_NEGOTIATION.UPGRADE_PATH_AVAILABLE OfflineFrame. [CONTEXT service_id=54 ]
                                                                                                    bjmd: WifiHotspotBandwidthUpgradeMedium couldn't complete the Wifi upgrade for endpoint WNI4 because it failed to start a Wifi hotspot.
                                                                                                    	at bjwg.d(:com.google.android.gms@[email protected] (190400-570218080):318)
                                                                                                    	at bjma.run(:com.google.android.gms@[email protected] (190400-570218080):563)
                                                                                                    	at bjdt.run(:com.google.android.gms@[email protected] (190400-570218080):15)
                                                                                                    	at ahzo.c(:com.google.android.gms@[email protected] (190400-570218080):50)
                                                                                                    	at ahzo.run(:com.google.android.gms@[email protected] (190400-570218080):97)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                                                                                                    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
                                                                                                    	at aiet.run(:com.google.android.gms@[email protected] (190400-570218080):8)
                                                                                                    	at java.lang.Thread.run(Thread.java:1012)
2023-10-13 10:09:48.349  1791-15556 NearbyMediums           com.google.android.gms.persistent    I  Cannot disconnect from the Wifi hotspot when it was never connected.
2023-10-13 10:09:48.349  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  [BandwidthUpgradeProtocol] Remove upgrading medium WIFI_HOTSPOT for WNI4
2023-10-13 10:09:48.350  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  [BandwidthUpgradeProtocol] Fallback or reset BandwidthUpgradeState because the next medium is the same with the connected one for WNI4.
2023-10-13 10:09:48.350  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  [BandwidthUpgradeProtocol] The next medium is WIFI_DIRECT on BANDWIDTH_24_GHZ for WNI4
2023-10-13 10:09:48.350  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  [BandwidthUpgradeProtocol] Set upgrading medium WIFI_DIRECT for WNI4
2023-10-13 10:09:48.351  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  Retry bandwidth upgrade after 2000 ms
2023-10-13 10:09:48.352  1014-1154  AppOps                  system_server                        D  noteOperation() called with: code = [1], uid = [10127], packageName = [com.google.android.gms], attributionTag = [nearby_connections], shouldCollectAsyncNotedOp = [true], message = [android.app.AppOpsManager.noteOp(AppOpsManager.java:8307)
                                                                                                    com.android.server.wifi.util.WifiPermissionsUtil.noteAppOpAllowed(WifiPermissionsUtil.java:455)
                                                                                                    com.android.server.wifi.util.WifiPermissionsUtil.checkCallersLocationPermission(WifiPermissionsUtil.java:164)
                                                                                                    com.android.server.wifi.util.WifiPermissionsUtil.checkCanAccessWifiDirect(WifiPermissionsUtil.java:393)
                                                                                                    com.android.server.wifi.p2p.WifiP2pServiceImpl$P2pStateMachine$DefaultState.processMessage(WifiP2pServiceImpl.java:1196)
                                                                                                    com.android.wifi.x.com.android.internal.util.StateMachine$SmHandler.processMsg(StateMachine.java:993)
                                                                                                    ], shouldCollectMessage = [true]
2023-10-13 10:09:48.354  1014-1508  PowerController.RecogA  system_server                        D  packageName:com.google.android.gms mFgEvent:APP_COMPONENT_USED mLastTimeFgEventChanged:7805746 mLastLaunchTime:0 mProcState:PROCESS_STATE_CACHED_EMPTY mLastTimeProcStateChanged:0 mNotificationState:0 mLastTimeNotificationStateChanged:0 mAudioState:0 mLastTimeAudioStateChanged:0 mRequestGps:true mAvoidConstraintGps:false mBehaviorType:0 mScreenOn:true mLastTimeScreenStateChanged:0 mLastBgTime:0 mFgDuration:0 mAudioDuration:0 mBgAudioDuration:0 mHasNoClearNotificationWhenNavi:false
2023-10-13 10:09:48.354  1791-15556 NearbyMediums           com.google.android.gms.persistent    I  Failed to remove group for WIFI_DIRECT because no group was found.
2023-10-13 10:09:48.355  1014-1154  WifiP2pService          system_server                        D  Remove client - com.google.android.gms
2023-10-13 10:09:48.356  1791-1791  NearbyMediums           com.google.android.gms.persistent    I  WiFi Direct channel has disconnected.
2023-10-13 10:09:48.357  1791-15556 NearbyMediums           com.google.android.gms.persistent    I  Closed WiFi Direct channel.
2023-10-13 10:09:48.357  1791-15556 NearbyMediums           com.google.android.gms.persistent    I  Successfully stopped WiFi Direct group for service com.example.myapp
2023-10-13 10:09:48.357  1791-15707 NearbyMediums           com.google.android.gms.persistent    I  Closed WiFi Direct channel.
2023-10-13 10:09:48.357  1791-15556 NearbyMediums           com.google.android.gms.persistent    I  Stopped accepting WiFi Direct connections for service com.example.myapp.
2023-10-13 10:09:48.357  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  [BandwidthUpgradeProtocol] Remove upgrading medium WIFI_DIRECT for 832G
2023-10-13 10:09:48.357  1791-15556 NearbyConnections       com.google.android.gms.persistent    I  [BandwidthUpgradeProtocol] Remove [BandwidthUpgradeState] 6GHz Mediums: [], 5GHz Mediums: [], 2.4GHz Mediums: [WIFI_DIRECT, WIFI_HOTSPOT, BLUETOOTH], [Initial Bandwidth: BANDWIDTH_24_GHZ][Current Bandwidth: BANDWIDTH_24_GHZ][Index: 0] for 832G
2023-10-13 10:09:48.357  1791-15538 NearbyMediums           com.google.android.gms.persistent    E  MEDIUM_ERROR [SYSTEM][WIFI_DIRECT][START_LISTENING_INCOMING_CONNECTION][ACCEPT_CONNECTION_FAILED][SOCKET_CLOSED], Service ID : com.example.myapp
2023-10-13 10:09:48.357  1791-15538 NearbyMediums           com.google.android.gms.persistent    E  Extra Sensitive/PII message : Socket closed
2023-10-13 10:09:48.358  1014-3167  WifiP2pService          system_server                        W  close(): no death recipient for binder
2023-10-13 10:09:48.359  7805-7805  nearby_connections      usap64                               D  ad.onDisconnected

But before I tell that to my customer, I would like to be sure.

Is my diagnosis correct? Can it be a hardware issue (we seem to have a similar issue with a Samsung Galaxy Tab S9)? If not, what else can it be and how can I troubleshoot this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.