Open saim683 opened 3 weeks ago
🎉 This issue has been resolved in version 4.0.0 🎉
https://github.com/Rapsssito/react-native-background-actions/issues/200#issuecomment-2172709359
still issue persist
able to fixed it by add this patch
<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>
It's working now. Thanks
On Thu, Aug 29, 2024 at 5:03 PM ctTushar @.***> wrote:
able to fixed it by add this
— Reply to this email directly, view it on GitHub https://github.com/Rapsssito/react-native-background-actions/issues/237#issuecomment-2317454460, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5BZLLZ7PIE2D2YYVZ76ENTZT4E2HAVCNFSM6AAAAABMSGZF2KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJXGQ2TINBWGA . You are receiving this because you authored the thread.Message ID: @.*** com>
@ctTushar @saim683 @RitheanyFT @gasolin
I am still experiencing crashes while sharing my screen, and this has been happening for the past four weeks. How can I resolve this issue? Please help.
`
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<application>
<service android:name=".RNBackgroundActionsTask" android:foregroundServiceType="dataSync"/>
</application>
`
2)RNBackgroundTask.java
final PendingIntent contentIntent; if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { contentIntent = PendingIntent.getActivity(context,0, notificationIntent, PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_MUTABLE); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE); } else { contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); }
3)
handleAppStateChange = async (nextAppState) => { if (nextAppState === 'active') { isPipOpen=true; console.log('videoAgora', 'ForeGround'); clearInterval(this.intervalReset); clearInterval(this.intervalBackground); //this.restartTranslationRecognition('User Reset'); await BackgroundService.stop(); this.resetTimer(); } else{ clearInterval(this.intervalReset); console.log('videoAgora', 'BackgroundStart'); BackgroundService.stop(); BackgroundService.start(this.veryIntensiveTask, this.options); try{ // if (isPipOpen) { // PipHandler.enterPipMode(300, 214); // isPipOpen=false; // } } catch(error){ } } this.setState({appState: nextAppState}); // console.log('state', nextAppState); };
"react-native-background-actions": "^4.0.0",
This comment helped me a lot. https://github.com/Rapsssito/react-native-background-actions/issues/237#issuecomment-2317454460
I handled the 'com.asterinet.react.bgactions' package as follows:
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
/// ...
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
// ...
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="true"
android:theme="@style/AppTheme">
// ...
<service android:name="com.asterinet.react.bgactions.RNBackgroundActionsTask" android:foregroundServiceType="dataSync" />
</application>
</manifest>
In the official Android documentation below, it is written that additional processing is required for Android 14!
- https://developer.android.com/about/versions/14/changes/fgs-types-required
java.lang.RuntimeException: Unable to start service com.asterinet.react.bgactions.RNBackgroundActionsTask@7cf005d with Intent { cmp=com.officermetrics/com.asterinet.react.bgactions.RNBackgroundActionsTask (has extras) }: java.lang.IllegalArgumentException: Cannot set both FLAG_IMMUTABLE and FLAG_MUTABLE for PendingIntent
I am using the latest version of react-native-background-actions. But when my app start's after 10 seconds my app goes to crash. I am using android 14.