You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I followed the set up according to your README. Works great if ScreenshotActionOrder.pixelCopyFirst() is used. However, I need to support devices older than SDK 24. So, I tested setting ScreenshotActionOrder.mediaProjectionFirst() and it caused my app to crash.
Below is the crash log:
2021-10-12 17:37:32.318 12146-12146/io.github.rexmtorres.android.screenshot E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.github.rexmtorres.android.screenshot, PID: 12146
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {io.github.rexmtorres.android.screenshot/io.github.rexmtorres.android.screenshot.MainActivity}: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
at android.app.ActivityThread.deliverResults(ActivityThread.java:5304)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5343)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
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:2425)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at android.media.projection.IMediaProjection$Stub$Proxy.start(IMediaProjection.java:235)
at android.media.projection.MediaProjection.<init>(MediaProjection.java:59)
at android.media.projection.MediaProjectionManager.getMediaProjection(MediaProjectionManager.java:119)
at eu.bolt.screenshotty.internal.projection.MediaProjectionDelegateV21.getMediaProjection(MediaProjectionDelegateV21.kt:162)
at eu.bolt.screenshotty.internal.projection.MediaProjectionDelegateV21.onActivityResult(MediaProjectionDelegateV21.kt:74)
at eu.bolt.screenshotty.internal.ScreenshotManagerImpl.onActivityResult(ScreenshotManagerImpl.kt:41)
at io.github.rexmtorres.android.screenshot.MainActivity.onActivityResult(MainActivity.kt:41)
at android.app.Activity.dispatchActivityResult(Activity.java:8382)
at android.app.ActivityThread.deliverResults(ActivityThread.java:5297)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:5343)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:54)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2214)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7842)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:482)
at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:137)
at android.os.Binder.execTransactInternal(Binder.java:1179)
at android.os.Binder.execTransact(Binder.java:1143)
The text was updated successfully, but these errors were encountered:
I followed the set up according to your README. Works great if
ScreenshotActionOrder.pixelCopyFirst()
is used. However, I need to support devices older than SDK 24. So, I tested settingScreenshotActionOrder.mediaProjectionFirst()
and it caused my app to crash.Below is the crash log:
The text was updated successfully, but these errors were encountered: