Giter VIP home page Giter VIP logo

Comments (12)

crystalcase avatar crystalcase commented on June 12, 2024 1

I added some logging and can confirm, that both methods are not getting called. So I assume there is a problem with the nearby messaging api itselft. I also tested setting the Strategy of subscribeOptions to BLE_ONLY, which did not help.

So I think we are stuck here and have no option to get the distance with the nearby messaging api.

from react-native-google-nearby-messages.

mrousavy avatar mrousavy commented on June 12, 2024

Hi! I'm not sure if the native APIs expose a "distance" property, couldn't find one in the API Reference (GNSMessage) 🤔

EDIT: Nevermind, found it in the Android API reference (Advanced features) - shouldn't be that difficult to implement, but unfortunately I currently have no time for this. I would gladly accept any help (PRs) though!

from react-native-google-nearby-messages.

crystalcase avatar crystalcase commented on June 12, 2024

Hey, I am looking at Android at the first place and found [RSSI and distance callbacks] in the API Reference. I tried to use the old library, where those methods are implemented, but it looks like the callbacks do not get triggered. (https://developers.google.com/nearby/messages/android/advanced#rssi_and_distance_callbacks)

from react-native-google-nearby-messages.

mrousavy avatar mrousavy commented on June 12, 2024

Yup, see my edit above.

If you want to take a look at this yourself I'd gladly give you some pointers, it really shouldn't be difficult. Not sure what the best approach for the JS API is though - we could add the distance property to the Message object so the user doesn't have to keep track of the references (which message belongs to which distance) themself.

from react-native-google-nearby-messages.

crystalcase avatar crystalcase commented on June 12, 2024

Yes a few hints would be nice, I am not familiar with Kotlin though. I think I understood the old java code and the API doc, so i have kind of an idea what to do. I would give it a try

from react-native-google-nearby-messages.

mrousavy avatar mrousavy commented on June 12, 2024
  1. This is the messages listener. You can override the distance changed events in here and simply call handleOnFound with the new distance (add it to the payload)
  2. You probably have to remove onFound though, since that would theoretically emit twice (once onFound and then immediately onDistanceChanged, you gotta test this though. we can also fire both.)
  3. Since this is not wanted behavior for all use cases, we might want to add a configration prop in the parameter to the connect() functhough (e.g. "enableDistanceListening")

from react-native-google-nearby-messages.

crystalcase avatar crystalcase commented on June 12, 2024

Alright, I will take a look and try my best. I am new to working on react native libs. Is there a best practice to test my code?

from react-native-google-nearby-messages.

crystalcase avatar crystalcase commented on June 12, 2024

I have added some code, see here Unfortunately, I got the same result as with the old repository. Even with the same issues.

First, both methods do not get called.

Second, I experience an unexpected behaviour: One of my devices 'holds' a found message only for about 5-10 secs and loses it afterwards. Just to find it again in <1s. I am using a Huawei P20 lite and Honor 9 lite and both had that problem at least once, while the other was ruinning fine. I have no idea why this is happening

from react-native-google-nearby-messages.

mrousavy avatar mrousavy commented on June 12, 2024

@crystalcase did you check if they get called by putting breakpoints/log statements in the native code?

Not sure about the message being lost, but if you're aware of your re-renders (i.e.: don't re-invoke connect() or subscribe() everytime the component re-renders) and checked the native side then it might actually the official native Google Nearby Messages API causing those problems.

from react-native-google-nearby-messages.

crystalcase avatar crystalcase commented on June 12, 2024

I tried to add some logs but I dont get any of the logs written in the native code, only in JS. How do I read the native code logs or debug the whole thing? I am new to this kind of development and just edited the file in node_modules directly for testing.

from react-native-google-nearby-messages.

mrousavy avatar mrousavy commented on June 12, 2024

Too bad. You might want to report a bug at the Google Nearby Messages API bug reporter so this can get fixed soon.

from react-native-google-nearby-messages.

crystalcase avatar crystalcase commented on June 12, 2024

I do not think that will help, because it works with BLE beacons only and the google beacon platform is deprecated:

The Google beacon platform is deprecated as of December 7, 2020. The platform will shut down on April 1, 2021. After this shut down, beacons will no longer be supported within the Nearby Messages API

Maybe I am missing something, but I do not know how to solve this.

from react-native-google-nearby-messages.

Related Issues (20)

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.