Open Yashi1919 opened 1 month ago
You need foreground service permissions for every foreground service type, that you use.
For instance I use dataSync and Microphone
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.wallodynamo">
<!-- Existing permissions -->
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<!-- Add permissions for specific foreground service types -->
<!-- Example for Camera Service -->
<uses-permission android:name="android.permission.CAMERA" />
<!-- Add other specific permissions as needed -->
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/wallo"
android:roundIcon="@mipmap/wallo"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wallodynamo" />
</intent-filter>
</activity>
<!-- Service Declaration -->
<service
android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask"
android:exported="false"
android:foregroundServiceType="location|mediaPlayback|dataSync"
android:permission="android.permission.BIND_JOB_SERVICE"
tools:replace="android:foregroundServiceType">
</service>
</application>
still getting crashed may i am not asking permissions can anyone help me with the permissions that i have to ask from user to run my foreground service
I am also getting same issue.
<!-- Existing permissions --> <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> <uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.SET_WALLPAPER" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> <uses-permission android:name="android.permission.SET_WALLPAPER_HINTS" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"/> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" /> <!-- Add permissions for specific foreground service types --> <!-- Example for Camera Service --> <uses-permission android:name="android.permission.CAMERA" /> <!-- Add other specific permissions as needed --> <application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/wallo" android:roundIcon="@mipmap/wallo" android:allowBackup="false" android:theme="@style/AppTheme" android:supportsRtl="true"> <activity android:name=".MainActivity" android:label="@string/app_name" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" android:launchMode="singleTask" android:windowSoftInputMode="adjustResize" android:exported="true"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter android:label="filter_react_native"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="wallodynamo" /> </intent-filter> </activity> <!-- Service Declaration --> <service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:exported="false" android:foregroundServiceType="location|mediaPlayback|dataSync" android:permission="android.permission.BIND_JOB_SERVICE" tools:replace="android:foregroundServiceType"> </service> </application>
still getting crashed may i am not asking permissions can anyone help me with the permissions that i have to ask from user to run my foreground service
If you use Android Studio, you can see what happens when your app crashes. In the crash/error log you should see what permission you need to request.
The crash issue I encountered was resolved by following these steps:
Step 1: Reinstall the Latest Version Ensure you are using the latest version of the lib, which is 4.0.1.
Step 2: Add Foreground Service Permissions Include the following permissions in your AndroidManifest.xml file to allow foreground services:
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
Step 3: Add Service Declaration in Manifest
In the
<application>
<service android:name=".RNBackgroundActionsTask" android:foregroundServiceType="dataSync" />
</application>
Final Manifest Example: After making the above changes, your manifest file should resemble this:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.asterinet.react.bgactions">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<application>
<service android:name=".RNBackgroundActionsTask" android:foregroundServiceType="dataSync" />
</application>
</manifest>
These steps resolved the crash issue for me. I hope this helps others facing similar problems.
While the app is in the background, the microphone isn't working. However, it functions properly when the app is in the foreground, where both camera and microphone permissions are granted.
how can i solve this @chandanpradhanin @mikkeldanielsen @Yashi1919 ?
You need foreground service permissions for every foreground service type, that you use.
For instance I use dataSync and Microphone
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
How can I handle the background issue since the microphone isn’t working when the app is in the background?
Not able to release app playstore blocking the release requesting for a video with foreground service, please help with solution! BTW why do we need FOREGROUND_SERVICE_DATA_SYNC?? @mikkeldanielsen @Yashi1919 @chandanpradhanin
I am getting the same issue after migrating app to React Native 0.75.3 @mikkeldanielsen @Yashi1919 @chandanpradhanin
this is my android manifest.xml please resolve this issue i have to upload this in oplaystore please
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.wallodynamo">