I am new to React native, we are looking to switch from cordova to React native...
I am finding a really hard time trying to think of a way to manage the ble scanning in the app.
so basically I have a raspberry pi emitting an encrypted BLE signal updated every second.
I want my app that scan for ble signals around it using react-native-ble-manager
I only want the app to start scanning after authentication and fetching the keys for decryption,
now my point of confusion is, i want to create a context BleScanning and wrap all the components that should show after authentication in it. Basically tab navigator for a Nearby devices screen, Site management screen, and profile screen. Inside side management many screens will be nested for management of the site and raspberry pi and access rights and so on...
now at every second the raspberry pi emits a signature, the app will detect a new device that doesn't understand it, i want to store this signature in a variable that doesn't force the components to update. decrypt the signature, see if the raspberry pi is setup to accept manual commands or automatic commands
if manual command: the device name should show up in Nearby devices screen
if automatic command: i do not need to update any of the screens, just make the phone emit a ble signature when the device in range specified (on any screen in the tab navigator).
my point of concern is how to manage all this without making every component wrapped in BleScanning context from updating on every signature scan
Related
I'm trying to scan devices on IOS when the app is in background mode. I've learned that I have to tell explicitly what service ID I'm looking for. I was trying with 180F which is the battery service but it didn't find anything. Is it possible at all on IOS? It works well on Android.
I'm using the react-native-ble-manager package.
Can you tell me maybe a common service UUID what every phone advertises?
My aim is to track every contact with phones which are nearby me and it should work when the app is in background mode.
I'm using react-native-navigation v1. In my app I'm letting 2 users compete solving a number of questions each one has his turn. What I want is when the one user kills the app, the other user is notified. How I detects when the user kills the app in a specific screen.
I have searched react-native-navigation docs and issues and did not find anything relevant.
This has nothing to do with the navigation itself and, as far a I know, you cannot detect easily if the App is being closed in React Native. If it goes well, you could simply have some kind of heartbeat or disconnection detection settled up in the server you are using. As soon as you "detect" the App being closed send a notification to the other user.
I have a requirement to save user's geolocation when react-native app is running in background. I know react-native-background-geolocation is available for this but I don't want to use any third party tool for this. Is there a way I can fetch users current location even if the app is running in the background?
With the last Expo SDK 32 you should be able to to it.
We’re excited to announce that this release includes initial support for background location, a highly requested feature from many Expo users. You can now define simple JavaScript tasks in your app and register them to receive location updates in the background. Additionally, you can set up geofencing tasks that are triggered when the device enters or leaves specific geographic regions
At the time of this post I believe that there are no geofencing modules available for react native so I would like to implement an alternative poor man's strategy. I discovered react native's geolocation module however the official doc is not clear:
1) Does the Geolocation module run in the background and get the current user coordinates automatically (even if the app is in the background)? If yes, are these stored in a variable or a state?
2) If (1) is true, how can I detect a change in state? Because once I detect a change in state (i.e. user's location) I would like to push this new location to a remote server and store it in a database. On the other hand I do not want to store each and every inch the user is moving!
Does this strategy make sense at all? My concerns are battery consumption as well of course..
1) You need to enable this feature in xcode Then save the location you get from the 'navigator.geolocation.getCurrentPosition' callback somewhere in you app e.g. in your AsyncStorage
2) The callback is only getting called if the location is changed. So you don't need explicitly detect any location change.
I'm building in FlashDevlop as pure AS3.
I'm looking at building a kiosk that uses two screens. Its used to administer tests. So one screen has the test, second the controls for admin the test. I have played with wide app but its not very elegant and I really would like both screens to run full screen on each screen. Is it possible to have one air app spawn two native air windows? A secondary question is it possible to detect multiple screens and target a screen to full screen to? Even something as simple as checking the window size to detect would work, im just not sure I can move and if the low level api will fullscreen on that screen. I could not find any examples of this in the docs.
What docs did you look into? I found it right away.
You'll need the Screen class if you want information on the screens that are connected to the PC. And here's some documentation on using it.
To create new windows, just instantiate a new NativeWindow class and call activate() on it when you're done configuring.
There's a lot of other useful stuff for you in the flash.display package. All the AIR stuff is marked with a little AIR icon. I have to admit that it would have been easier to find if they had put these classes in a separate AIR package.