Skip to content

Commit

Permalink
fix android 14
Browse files Browse the repository at this point in the history
  • Loading branch information
shamanec committed Mar 1, 2024
1 parent 254faaf commit 594747f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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 @@
android:versionName="1.0">

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INJECT_EVENTS"
tools:ignore="ProtectedPermissions" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ private void startProjection(int resultCode, Intent data) {
if (mMediaProjection == null) {
mMediaProjection = mpManager.getMediaProjection(resultCode, data);
if (mMediaProjection != null) {
// Register media projection stop callback
mMediaProjection.registerCallback(new MediaProjectionStopCallback(), mHandler);

// If MediaProjection object is successfully obtained we create a virtual display
WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
// Get the actual display
Expand All @@ -272,9 +275,6 @@ private void startProjection(int resultCode, Intent data) {
if (mOrientationChangeCallback.canDetectOrientation()) {
mOrientationChangeCallback.enable();
}

// Register media projection stop callback
mMediaProjection.registerCallback(new MediaProjectionStopCallback(), mHandler);
}
}
}
Expand Down

0 comments on commit 594747f

Please sign in to comment.