• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

.google/23-Mar-2024-2014

Application/23-Mar-2024-1,668776

gradle/wrapper/23-Mar-2024-66

screenshots/23-Mar-2024-

CONTRIBUTING.mdD23-Mar-20241.5 KiB3627

LICENSED23-Mar-202411.1 KiB204170

README.mdD23-Mar-20242.9 KiB7552

build.gradleD23-Mar-202411 120

gradlewD23-Mar-20245 KiB165122

gradlew.batD23-Mar-20242.3 KiB9166

settings.gradleD23-Mar-202422 21

README.md

1
2Android ScreenCapture Sample
3===================================
4
5This sample demonstrates how to use Media Projection API to capture device screen in real time and
6show it on a SurfaceView.
7
8Introduction
9------------
10
11Media Projection API lets you capture the current screen through Surface.
12
13To start media projection, you need to get an instance of [MediaProjection][1]. For this, you have
14to call startActivityForResult with an Intent from
15[MediaProjectionManager.createScreenCaptureIntent()][2]. This shows a confirmation dialog to the
16user. When user confirms it, you will get a result code and data in onActivityResult, so pass those
17to [getMediaProjection][3].
18
19Once you get a MediaProjection, use [createVirtualDisplay][4] and bind it to a Surface.
20
21[1]: https://developer.android.com/reference/android/media/projection/MediaProjection.html
22[2]: https://developer.android.com/reference/android/media/projection/MediaProjectionManager.html#createScreenCaptureIntent()
23[3]: https://developer.android.com/reference/android/media/projection/MediaProjectionManager.html#getMediaProjection(int, android.content.Intent)
24[4]: https://developer.android.com/reference/android/media/projection/MediaProjection.html#createVirtualDisplay(java.lang.String, int, int, int, int, android.view.Surface, android.hardware.display.VirtualDisplay.Callback, android.os.Handler)
25
26Pre-requisites
27--------------
28
29- Android SDK 27
30- Android Build Tools v27.0.2
31- Android Support Repository
32
33Screenshots
34-------------
35
36<img src="screenshots/main.png" height="400" alt="Screenshot"/>
37
38Getting Started
39---------------
40
41This sample uses the Gradle build system. To build this project, use the
42"gradlew build" command or use "Import Project" in Android Studio.
43
44Support
45-------
46
47- Google+ Community: https://plus.google.com/communities/105153134372062985968
48- Stack Overflow: http://stackoverflow.com/questions/tagged/android
49
50If you've found an error in this sample, please file an issue:
51https://github.com/googlesamples/android-ScreenCapture
52
53Patches are encouraged, and may be submitted by forking this project and
54submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
55
56License
57-------
58
59Copyright 2017 The Android Open Source Project, Inc.
60
61Licensed to the Apache Software Foundation (ASF) under one or more contributor
62license agreements.  See the NOTICE file distributed with this work for
63additional information regarding copyright ownership.  The ASF licenses this
64file to you under the Apache License, Version 2.0 (the "License"); you may not
65use this file except in compliance with the License.  You may obtain a copy of
66the License at
67
68http://www.apache.org/licenses/LICENSE-2.0
69
70Unless required by applicable law or agreed to in writing, software
71distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
72WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
73License for the specific language governing permissions and limitations under
74the License.
75