Comments (12)
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.
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.
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.
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.
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.
- 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) - You probably have to remove
onFound
though, since that would theoretically emit twice (onceonFound
and then immediatelyonDistanceChanged
, you gotta test this though. we can also fire both.) - 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.
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.
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.
@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.
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.
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.
I do not think that will help, because it works with BLE beacons only and the google beacon platform is deprecated:
Maybe I am missing something, but I do not know how to solve this.
from react-native-google-nearby-messages.
Related Issues (20)
- `new NativeEventEmitter()` was called with a non-null argument without the required `removeListeners` method.
- [BUG] Compile error in Swift code HOT 7
- [QUESTION] Can this work with two android emulators on the same computer?
- [QUESTION] Check if nearby service is allowed on the device
- Fix missing override keyword
- [QUESTION] HOT 2
- plugin with id 'maven' not found HOT 1
- [BUG] IllegalArgumentException on Android [ConnectionResult=APP_NOT_OPTED_IN] HOT 1
- 2 duplicate symbols architecture arm64 (unless I use a pod post-install script) HOT 3
- StackOverflow onFound - android HOT 1
- [QUESTION] Unkown error occured while connection HOT 20
- Can I list all nearby devices that use my app? [QUESTION] HOT 2
- Need to work this Google Nearby Feature Without Internet and wifi HOT 8
- [BUG] Not working in background job (https://www.npmjs.com/package/react-native-background-job) HOT 6
- [BUG] If Device A publishes again after initial load, it disconnects from Device B HOT 5
- what this library do HOT 3
- Communication between iOS and Android devices is broken HOT 1
- [QUESTION] Why unpublish() is not declared as async in index.ts ? HOT 3
- Unknown Error occured while connecting
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-google-nearby-messages.