Open vishalyad16 opened 3 months ago
try change foregroundServiceType
from android:foregroundServiceType="shortService"
to android:foregroundServiceType="mediaProjection"
then add new permission at your AndroidManifest.xml
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
ref: https://developer.android.com/about/versions/14/changes/fgs-types-required#media-projection
@BagasNS does this solution working for you ?
Hi,
We have already included the
@Rapsssito Since we need to release this on the Play Store, we have to fix this issue as soon as possible.
Thanks
@Rapsssito waiting for your response
FATAL EXCEPTION: main Process: com.explorastory, PID: 902 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1001, result=-1, data=Intent { (has extras) }} to activity {com.explorastory/io.agora.rtc2.extensions.MediaProjectionMgr$LocalScreenCaptureAssistantActivity}: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION at android.app.ActivityThread.deliverResults(ActivityThread.java:5898) at android.app.ActivityThread.handleSendResult(ActivityThread.java:5937) at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:67) at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:144) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:101) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2643) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:257) at android.os.Looper.loop(Looper.java:368) at android.app.ActivityThread.main(ActivityThread.java:8839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:572) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1049) Caused by: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
@BagasNS ?
@BagasNS ?
please refer to this url https://github.com/Rapsssito/react-native-background-actions/issues/228#issuecomment-2298775963
Thanks, @BagasNS! The app is no longer crashing, but the microphone isn't working while the app is in the background. However, it functions properly in the foreground, where both camera and microphone permissions are granted. https://github.com/Rapsssito/react-native-background-actions/issues/242#issuecomment-2385632656
"react-native-background-actions": "^4.0.1",
buildToolsVersion = "34.0.0" minSdkVersion = 23 compileSdkVersion = 34 targetSdkVersion = 34 ndkVersion = "26.2.11394342" kotlinVersion = "1.9.22"
`package com.asterinet.react.bgactions;
import android.annotation.SuppressLint; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Bundle;
import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.app.NotificationCompat;
import com.facebook.react.HeadlessJsTaskService; import com.facebook.react.bridge.Arguments; import com.facebook.react.jstasks.HeadlessJsTaskConfig;
final public class RNBackgroundActionsTask extends HeadlessJsTaskService {
} ` @Rapsssito, I need to release the app on the Play Store with target SDK 34. Please mark this as urgent. Thanks
FATAL EXCEPTION: main Process: com.explorastory, PID: 16580 java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1001, result=-1, data=Intent { (has extras) }} to activity {/io.agora.rtc2.extensions.MediaProjectionMgr$LocalScreenCaptureAssistantActivity}: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
Originally posted by @vishalyad16 in https://github.com/Rapsssito/react-native-background-actions/issues/223#issuecomment-2252544570