Android Parental Control App – Empower Parents, Protect Kids

As a parent or guardian, you want to ensure that kids are using their smartphones and tablets safely and responsibly. However, with so many apps and websites available, it can be hard to keep track of what these children are doing online. That’s where a Parental Control app comes in handy. In this project, we will show you how to create a simple Parental Control app for Android, which will allow you to monitor kids’ app usage and ensure that they are not spending too much time on certain apps. Parents can also pause that app if they want for 8 hours.

About Android Parental Control Project

The objective of this project is to teach you how to create a basic Parental Control app for Android, which will allow parents to track their kids’ app usage and see which apps they are spending the most time on. By the end of this project, you should have a working app that can display app usage statistics, capability to pause that app, as well as a list of all the installed apps on the device.

Prerequisites for Parental Control Using Android

Before we begin, you should have some basic knowledge of Android development using Java and Android Studio. You should also have a basic understanding of Android UI components, such as TextViews, Buttons, and RecyclerViews. In addition, you will need an Android device or emulator to test your app on.

Download Android Parental Control Project

Please download the source code of Android Parental Control Project from the following link: Android Parental Control Project Code

Steps to Create Parental Control App Using Android

The following are the steps for developing Parental Control:

Step 1: Create an Android project using Java as the preferred language and add the necessary permissions to the AndroidManifest.xml file to access the device’s app usage and installed app data.

<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS"
   tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.INTERNET" />

android parental control app

Step 2: Creating Dashboard activity layout: This layout will show today’s most used app to the parents.

activity_dashboard.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:tools="http://schemas.android.com/tools"
   android:id="@+id/container"
   android:background="@drawable/background"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   >

   <com.google.android.material.bottomnavigation.BottomNavigationView
       android:id="@+id/nav_view"
       android:layout_width="0dp"
       android:layout_height="wrap_content"
       android:layout_marginStart="0dp"
       android:layout_marginEnd="0dp"
       android:background="@drawable/background2"
       app:layout_constraintBottom_toBottomOf="parent"
       app:layout_constraintLeft_toLeftOf="parent"
       app:layout_constraintRight_toRightOf="parent"
       app:menu="@menu/bottom_nav_menu" />

   <fragment
       android:id="@+id/nav_host_fragment"
       android:name="androidx.navigation.fragment.NavHostFragment"
       android:layout_width="match_parent"
       android:layout_height="0dp"
       app:defaultNavHost="true"
       app:layout_constraintEnd_toEndOf="parent"
       app:layout_constraintHorizontal_bias="0.0"
       app:layout_constraintLeft_toLeftOf="parent"
       app:layout_constraintRight_toRightOf="parent"
       app:layout_constraintStart_toStartOf="parent"
       app:layout_constraintTop_toTopOf="parent"
       app:navGraph="@navigation/mobile_navigation" />

</androidx.constraintlayout.widget.ConstraintLayout>

parental control project

Step 3: Creating an App Usage page layout to show all the used app statistics. It will show the usage of each app in seconds, minutes and hours. Parents can see daily, weekly, monthly and yearly usage of the apps in seconds, minutes and hours.

fragment_app_usage.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools">

   <FrameLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:background="@drawable/background"
       tools:context="com.techvidvan.parentalcontrol.ui.appusage.AppUsageFragment">

       <androidx.recyclerview.widget.RecyclerView
           android:id="@+id/rv_app_usage_stats"
           android:layout_width="match_parent"
           android:layout_height="match_parent" />
   </FrameLayout>
</layout>

parental control app project

Step 4: Creating an Installed App page layout to show all the apps installed in the phone. It will also show the apps that are hidden on the phone to the parents.

fragment_installed_app.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools">
   <FrameLayout
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:background="@drawable/background"
       tools:context="com.techvidvan.parentalcontrol.ui.installedapp.InstalledAppFragment">

       <androidx.recyclerview.widget.RecyclerView
           android:id="@+id/rv_install_app"
           android:layout_width="match_parent"
           android:layout_height="match_parent" />

       <ProgressBar
           android:id="@+id/progressBar"
           style="?android:attr/progressBarStyle"
           android:layout_width="match_parent"
           android:layout_height="wrap_content" />
   </FrameLayout>
</layout>

android parental control

Step 5: Creating layout of the app usage list for the recycler view. It will be used as a list to show the app usage in App Usage page layout.

rv_app_usage_stats_view.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:android="http://schemas.android.com/apk/res/android">

   <data>
       <variable
           name="AppUsageStatsProperty"
           type="com.techvidvan.parentalcontrol.model.db.entity.AppUsageEntity" />
   </data>

   <androidx.constraintlayout.widget.ConstraintLayout
       android:id="@+id/constraints"
       android:layout_width="match_parent"
       android:layout_height="wrap_content">

       <androidx.cardview.widget.CardView
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           app:cardCornerRadius="25dp"
           app:cardElevation="2dp"
           android:layout_margin="8dp"
           app:cardPreventCornerOverlap="false"
           app:cardUseCompatPadding="true"
           app:layout_constraintEnd_toEndOf="parent"
           app:layout_constraintStart_toStartOf="parent"
           app:layout_constraintTop_toTopOf="parent">

           <androidx.constraintlayout.widget.ConstraintLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:background="@drawable/gradiantimage">

               <ImageView
                   android:id="@+id/imageView"
                   android:layout_width="110dp"
                   android:layout_height="110dp"
                   android:layout_marginStart="8dp"
                   android:contentDescription="@string/app_icon_content_description"
                   android:src="@{AppUsageStatsProperty.app_icon}"
                   app:layout_constraintBottom_toBottomOf="parent"
                   app:layout_constraintStart_toStartOf="parent"
                   app:layout_constraintTop_toTopOf="parent" />

               <TextView
                   android:id="@+id/txt_app_name"
                   android:layout_width="0dp"
                   android:layout_height="wrap_content"
                   android:text="@{AppUsageStatsProperty.app_name}"
                   android:textSize="20sp"
                   android:textStyle="bold"
                   android:textColor="#260159"
                   android:layout_marginStart="8dp"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toTopOf="@+id/imageView"
                   tools:text="App Name" />

               <TextView
                   android:id="@+id/txt_package_name"
                   android:layout_width="0dp"
                   android:layout_marginStart="8dp"
                   android:layout_height="wrap_content"
                   android:text="@{AppUsageStatsProperty.package_name}"
                   android:textColor="#572525"
                   android:textStyle="bold"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toBottomOf="@+id/txt_app_name"
                   tools:text="Package Name" />

               <TextView
                   android:id="@+id/txt_total_time_forground_sec"
                   android:layout_width="0dp"
                   android:layout_height="wrap_content"
                   android:layout_marginEnd="8dp"
                   android:text="@{String.valueOf(AppUsageStatsProperty.totalAppInForegroundSec)}"
                   android:textColor="#2E2E2E"
                   android:textStyle="bold"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/lb_sec"
                   app:layout_constraintTop_toBottomOf="@+id/txt_package_name"
                   tools:text="100000" />

               <TextView
                   android:id="@+id/txt_total_time_forground_min"
                   android:layout_width="0dp"
                   android:layout_height="wrap_content"
                   android:layout_marginEnd="8dp"
                   android:text="@{String.valueOf(AppUsageStatsProperty.totalAppInForegroundMin)}"
                   android:textColor="#2E2E2E"
                   android:textStyle="bold"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/lb_min"
                   app:layout_constraintTop_toBottomOf="@+id/txt_total_time_forground_sec"
                   tools:text="100" />

               <TextView
                   android:id="@+id/txt_total_time_forground_hr"
                   android:layout_width="0dp"
                   android:layout_height="wrap_content"
                   android:layout_marginEnd="8dp"
                   android:layout_marginBottom="8dp"
                   android:text="@{String.valueOf(AppUsageStatsProperty.totalAppInForegroundHr)}"
                   android:textColor="#2E2E2E"
                   android:textStyle="bold"
                   app:layout_constraintBottom_toBottomOf="parent"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/lb_min"
                   app:layout_constraintTop_toBottomOf="@+id/txt_total_time_forground_min"
                   tools:text="10" />

               <TextView
                   android:id="@+id/lb_sec"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_marginStart="8dp"
                   android:text="Time Spent in Seconds : "
                   android:textColor="#000000"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toBottomOf="@+id/txt_package_name" />

               <TextView
                   android:id="@+id/lb_min"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_marginStart="8dp"
                   android:text="Time Spent in Minutes :  "
                   android:textColor="#000000"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toBottomOf="@+id/lb_sec" />

               <TextView
                   android:id="@+id/lb_hr"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:layout_marginStart="8dp"
                   android:text="Time Spent in Hours :    "
                   android:textColor="#000000"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toBottomOf="@+id/lb_min" />
           </androidx.constraintlayout.widget.ConstraintLayout>
       </androidx.cardview.widget.CardView>
   </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

android parental control project

Step 6: Create layout of the installed app list for the recycler view. It will be used as a list to show the installed app in the Installed App page layout.

rv_app_installed_view.xml

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:tools="http://schemas.android.com/tools"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   xmlns:android="http://schemas.android.com/apk/res/android">

   <data>
       <variable
           name="InstalledAppProperty"
           type="com.techvidvan.parentalcontrol.model.db.entity.InstalledAppEntity" />
   </data>

   <androidx.constraintlayout.widget.ConstraintLayout
       android:id="@+id/constraints"
       android:layout_margin="8dp"

       android:layout_width="match_parent"
       android:layout_height="wrap_content">

       <androidx.cardview.widget.CardView
           android:layout_width="0dp"
           android:layout_height="wrap_content"
           app:cardCornerRadius="25dp"
           app:cardElevation="2dp"
           app:cardPreventCornerOverlap="false"
           app:cardUseCompatPadding="true"
           app:layout_constraintEnd_toEndOf="parent"
           app:layout_constraintStart_toStartOf="parent"
           app:layout_constraintTop_toTopOf="parent">

           <androidx.constraintlayout.widget.ConstraintLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:background="@drawable/gradiantimage">

               <ImageView
                   android:id="@+id/imageView"
                   android:layout_width="70dp"
                   android:layout_height="70dp"
                   android:layout_marginStart="8dp"
                   android:layout_marginTop="8dp"
                   android:layout_marginBottom="8dp"
                   android:contentDescription="@string/app_icon_content_description"
                   android:src="@{InstalledAppProperty.appIcon}"
                   app:layout_constraintBottom_toBottomOf="parent"
                   app:layout_constraintStart_toStartOf="parent"
                   app:layout_constraintTop_toTopOf="parent" />

               <TextView
                   android:id="@+id/txt_app_name"
                   android:layout_width="0dp"
                   android:layout_height="wrap_content"
                   android:layout_marginTop="8dp"
                   android:layout_marginStart="8dp"
                   android:text="@{InstalledAppProperty.appName}"
                   android:textColor="#260059"
                   android:textSize="18sp"
                   android:textStyle="bold"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toTopOf="parent"
                   tools:text="Repainter Integration Service" />

               <TextView
                   android:id="@+id/txt_package_name"
                   android:layout_width="0dp"
                   android:layout_height="wrap_content"
                   android:text="@{InstalledAppProperty.packageName}"
                   android:textColor="#000000"
                   android:textSize="14sp"
                   android:layout_marginTop="3dp"
                   android:layout_marginStart="8dp"
                   app:layout_constraintEnd_toEndOf="parent"
                   app:layout_constraintStart_toEndOf="@+id/imageView"
                   app:layout_constraintTop_toBottomOf="@+id/txt_app_name"
                   tools:text="com.techvidvan.parentalcontrol" />

           </androidx.constraintlayout.widget.ConstraintLayout>
       </androidx.cardview.widget.CardView>
   </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

android parental control app project

Now app is ready to be used

Android Parental Control App Output:

android parental control output

parental control app output

parental control app project output

Summary:

Congratulations, you have successfully created a simple Parental Control app for Android! You can now track your kids’ app usage and see which apps they are spending the most time on to control their usage by pausing that app. However, this is not the end – you can add more features according to your needs, such as setting time limits on certain apps, blocking certain websites, or even monitoring your kids’ GPS location. We hope that you found this project helpful and that it will inspire you to create more useful and innovative apps for Android.