Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[react-native] How to run at background #46

Closed
yasintz opened this issue Oct 9, 2023 · 2 comments
Closed

[react-native] How to run at background #46

yasintz opened this issue Oct 9, 2023 · 2 comments

Comments

@yasintz
Copy link

yasintz commented Oct 9, 2023

I want to watch geofence changes even if the app is in the background. I am using react-native-background-actions library for background actions. When I start the background process, the indoor atlas works until I close the app. After that, I can see numbers provided by forloop (check the image) but there is no data logged for location or geofence.

Screenshot 2023-10-09 at 22 56 18
@XahimA
Copy link

XahimA commented Oct 26, 2023

well I am telling you this from experience doing background tasks like geofence and activityrRecongnition is nearly immpossible if you need do it checkOut how bridging work in react native you have to create an bridge between react native app and native code where you have to write geofence implementation code in kotlin

@matti-ida
Copy link
Contributor

Hi,

for Android, we recommend using a foreground service to run IndoorAtlas SDK on background. There is an example at
https://github.com/IndoorAtlas/android-sdk-examples/blob/master/Basic/src/main/AndroidManifest.xml#L102
https://github.com/IndoorAtlas/android-sdk-examples/blob/master/Basic/src/main/java/com/indooratlas/android/sdk/examples/foregroundservice/ForegroundService.java

for iOS you need appropriate background permissions, see iOS example:
https://github.com/IndoorAtlas/ios-sdk-examples/blob/master/example/sdk-examples-Info.plist#L37C7-L37C51
https://github.com/IndoorAtlas/ios-sdk-examples/blob/master/example/src/Examples/BackgroundViewController.m

Unfortunately we don't currently have any examples or direct way to set those up in the IndoorAtlas React Native plugin.

It's important to include android:foregroundServiceType="location" in the manifest foreground service declaration. By quick look it doesn't look like the RN library you linked uses that, maybe that is the issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants