Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashed after change targetSdkVersion to 29 #41

Open
dynamicfire opened this issue Jul 30, 2019 · 5 comments
Open

Crashed after change targetSdkVersion to 29 #41

dynamicfire opened this issue Jul 30, 2019 · 5 comments

Comments

@dynamicfire
Copy link

dynamicfire commented Jul 30, 2019

Logcat:
2019-07-30 15:04:57.215 909-3862/? E/InputDispatcher: Window handle Window{7faca60 u0 Sys2003:com.android.systemui/com.android.systemui.media.MediaProjectionPermissionActivity} has no registered input channel
2019-07-30 15:04:57.233 28983-28983/? D/AndroidRuntime: Shutting down VM
2019-07-30 15:04:57.241 28983-28983/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: net.yrom.screenrecorder.demo, PID: 28983
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {net.yrom.screenrecorder.demo/net.yrom.screenrecorder.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:4843)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4884)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51)
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:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7343)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:933)
Caused by: java.lang.SecurityException: Media projections require a foreground service of type ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
at android.os.Parcel.createException(Parcel.java:2071)
at android.os.Parcel.readException(Parcel.java:2039)
at android.os.Parcel.readException(Parcel.java:1987)
at android.media.projection.IMediaProjection$Stub$Proxy.start(IMediaProjection.java:231)
at android.media.projection.MediaProjection.(MediaProjection.java:58)
at android.media.projection.MediaProjectionManager.getMediaProjection(MediaProjectionManager.java:104)
at net.yrom.screenrecorder.MainActivity.onActivityResult(MainActivity.java:148)
at android.app.Activity.dispatchActivityResult(Activity.java:8110)
at android.app.ActivityThread.deliverResults(ActivityThread.java:4836)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:4884) 
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:51) 
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:2016) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:214) 
at android.app.ActivityThread.main(ActivityThread.java:7343) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:933) 
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:476)
at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:135)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)

@dynamicfire
Copy link
Author

dynamicfire commented Jul 30, 2019

@dynamicfire dynamicfire changed the title targetSdkVersion改为29后出现崩溃 Crashed after change targetSdkVersion to 29 Jul 30, 2019
@dynamicfire
Copy link
Author

dynamicfire commented Jul 30, 2019

另:在Android Q下录屏时没有弹出通知

@yrom
Copy link
Owner

yrom commented Aug 1, 2019

本来 mediaprojection 就应该在 service 中使用,这里只是demo,没用service

@dkshin
Copy link

dkshin commented Feb 24, 2020

same issue....

target sdk version : 29
my device : Android10

@TapasKumarBehera
Copy link

same issue....

target sdk version : 29
my device : Android10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants