Closed Sohailbhutto closed 3 years ago
Background processing has been severely limited by both Android and iOS in the latest months. iOS will kill any process that is running in the background for over 15 mins. Android is easier, but it can also kill the process. On Android, you have to register a service to start the adv and scanning there.
Try using the https://www.npmjs.com/package/react-native-background-fetch to register the services and run Scheduled tasks that activate both scanning and advertising.
@vitorpamplona can you please share the example code using https://www.npmjs.com/package/react-native-background-fetch
You can see the Android Background running here: https://github.com/vitorpamplona/ble-tracker-client
I am not sure how to use it on iOS (not required for the app I made)
@vitorpamplona correction. For background, i mean to say that app is not killed, app is in background. In my scenario i just want to scan and broadcast when app is in foreground or background, not the case that app is killed.
@vitorpamplona i want to implement the scenario like this app, app is in foreground or background, but not killed. https://www.tracetogether.gov.sg/
Then you can probably use the https://www.npmjs.com/package/react-native-background-fetch library.
How to keeps scanner and broadcasting running even app is in background for both android and ios. Please share the code snippet.