I am using React Native together with Expo to build an app for tracking workouts. I want to implement a foreground service for ongoing workouts but also to keep Expo in my project.
I tried to use this approach: https://github.com/cristianoccazinsp/react-native-foreground-service
For this, permissions are needed to be added in Android Manifest file, in order to do that, I added the permissions in the app.json file:
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF",
"permissions": ["FOREGROUND_SERVICE", "WAKE_LOCK"]
}
},
the next step would be to add the service into the Android Manifest file:
<meta-data android:name="com.zinspector.foregroundservice.notification_channel_name"
android:value="zInspector Service"/>
<meta-data android:name="com.zinspector.foregroundservice.notification_channel_description"
android:value="zInspector Service."/>
<meta-data android:name="com.zinspector.foregroundservice.notification_color"
android:resource="@color/orange"/>
<service android:name="com.zinspector.foregroundservice.ForegroundService"></service>
<service android:name="com.zinspector.foregroundservice.ForegroundServiceTask"></service>
```
The problem is that I did not find a solution to use expo and add those service properties using app.json
Could anyone help me with this issue or provide another solution for having a foreground service and keep using Expo ? Thank you