MediaProjection service type not recognized in android Q

后端 未结 2 1141
青春惊慌失措
青春惊慌失措 2021-02-14 16:15

With the new privacy changes in effect with Android Q, it is now mandatory for any app using MediaProjection api to specify android:foregroundServiceType attribute

2条回答
  •  遇见更好的自我
    2021-02-14 16:41

    Changing the following attributes

    android:foregroundServiceType="mediaProjection"
    
    tools:targetApi="q"
    

    in AndroidManifest.xml worked for me.

    < service
    
    android:name="SERVICE_NAME"
    
    android:foregroundServiceType="mediaProjection"
    
    tools:targetApi="q"
    
    android:enabled="true"
    
    android:exported="false" />
    

提交回复
热议问题