Skip to content

Commit

Permalink
Fix #172
Browse files Browse the repository at this point in the history
  • Loading branch information
HBiSoft committed Aug 12, 2024
1 parent daad574 commit a65be5b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
Binary file modified app/release/HBRecorderDemo.apk
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
Expand Down
4 changes: 3 additions & 1 deletion hbrecorder/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MICROPHONE" />


<application
tools:targetApi="q">

<service android:name="com.hbisoft.hbrecorder.ScreenRecordService"
android:foregroundServiceType="mediaProjection"
android:foregroundServiceType="mediaProjection|microphone"
tools:targetApi="q" />

<receiver android:name="com.hbisoft.hbrecorder.NotificationReceiver"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,9 @@ private void initVirtualDisplay() {
}

private void startFgs(int notificationId, Notification notificaton) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE){
startForeground(notificationId, notificaton, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION | ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(notificationId, notificaton, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
} else {
startForeground(notificationId, notificaton);
Expand Down

0 comments on commit a65be5b

Please sign in to comment.