Rapsssito / react-native-background-actions

React Native background service library for running background tasks forever in Android & iOS.
MIT License
814 stars 116 forks source link

java.lang.RuntimeException: Unable to start service com.asterinet.react.bgactions.RNBackgroundActionsTask@c931e06 with Intent java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Activity com.facebook.react.bridge.ReactContext.getCurrentActivity()' on a null object reference #154

Open nahidmbstu opened 2 years ago

nahidmbstu commented 2 years ago

java.lang.RuntimeException: Unable to start service com.asterinet.react.bgactions.RNBackgroundActionsTask@c931e06 with Intent java.lang.NullPointerException: Attempt to invoke virtual method 'android.app.Activity com.facebook.react.bridge.ReactContext.getCurrentActivity()' on a null object reference

Arsalan9212 commented 1 year ago

did you solution of this or not, if done it then kindly share with me , i have also same issue

dankocher commented 9 months ago

I also have same issue

vishalyad16 commented 3 months ago

"Has anyone found a solution for the app crashing while sharing the screen when the app goes into the foreground or background mode?"

FATAL EXCEPTION: main Process: com.explorastory, PID: 7659 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 at android.os.Parcel.createExceptionOrNull(Parcel.java:3087) at android.os.Parcel.createException(Parcel.java:3071) at android.os.Parcel.readException(Parcel.java:3054) at android.os.Parcel.readException(Parcel.java:2996) at android.media.projection.IMediaProjection$Stub$Proxy.start(IMediaProjection.java:313) at android.media.projection.MediaProjection.(MediaProjection.java:84) at android.media.projection.MediaProjection.(MediaProjection.java:75) at android.media.projection.MediaProjectionManager.getMediaProjection(MediaProjectionManager.java:236) at io.agora.rtc2.extensions.MediaProjectionMgr.onRequestResult(MediaProjectionMgr.java:172) at io.agora.rtc2.extensions.MediaProjectionMgr$LocalScreenCaptureAssistantActivity.onActivityResult(MediaProjectionMgr.java:257) at android.app.Activity.dispatchActivityResult(Activity.java:9116) at android.app.ActivityThread.deliverResults(ActivityThread.java:5891) 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: android.os.RemoteException: Remote stack trace: at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:1111) at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:192) at android.os.Binder.execTransactInternal(Binder.java:1387) at android.os.Binder.execTransact(Binder.java:1299)

HosamCS commented 3 months ago

I also have same issue

vishalyad16 commented 2 months ago

@HosamCS does your problem sloved?