Android: The Perfect And Easy Way to Make Screen Recorder

How to Make Screen Recorder in Android Studio

In this article, I will tell you about making the feature for recording the screen in the Android App. Actually, I’m developing the internet speed test app for a software company in which I’m doing a full-time job for three months. The app has a feature like when the user starts the internet speed test the screen recorder feature should start recording the screen in the background. So I have successfully implemented this screen recording feature in the app.

Now I am excited to share this feature with you guys. Are you excited to learn this feature and enhance your android development skill?

Let's start.

First, you have to implement a library in your app. Now go to the module level Gradle file and write these lines like this.

allprojects {
repositories {
maven { url '' }

Then go to the app level Gradle file and write these lines like below.

dependencies {
implementation 'com.github.HBiSoft:HBRecorder:0.1.15'

After implementing this library you have to click on sync now.

For further library details, you can click the below link.

Now we need to make a simple UI design to start and stop the screen recording. Here is the layout source code it is a very simple layout. Even you are a beginner in Android App development you can understand it.

First, You need to modify your manifest file by adding some permissions like below.

Now the time has come to implementing screen recording logic. First, check the coding part below then I will explain it.


I have created ScreenRecordingActivity then I have implemented the HBRecorderListener interface. So after implemented this interface you should override three methods.

  1. HBRecorderOnStart()
  2. HBRecorderOnComplete()
  3. HBRecorderOnError()


As the name of this method depict that it will be called when Recording will start.


As the name of this method depict that it will be called when Recording will be completed.


As the name of this method depict that it will be called when some exception will occur.


In this method, I have initialized the start button, stop button, hbRecorder object, created click listeners for the start and stop buttons, and set the video encoder to “H264”.

startRecordingScreen Method

In this method, I have used the screen projection API. This API comes with the Android SDK. I have implemented the logic of starting the screen capturing. Before start capturing the screen it will ask for screen recording permission.


When the user accepts the start screen capturing permission the compiler will come in this method. And in this method, We need to call the start screen recording method.


In this method, I have set the output path for screen recorded video file. In this method I have implemented two different logics one for Android 10 and second for less then android 10.

I’m a good husband, father and Senior Developer.

Get the Medium app