How to apply restrictions like set a timelimit for another apps, block certain URLs from my devlopment app in mobile devices?

344 Views Asked by At

I am trying to build a parental control application which can apply restrictions to another apps in android devices. The restrictions can be like :-

  1. The app can restrict the opening of any game app selected by parents during the study time of the kid like between 7-8 pm etc.
  2. The app can restrict opening blocked urls. These urls will be selected by the parent.

I know that there is no such flutter plugin available for this purpose and that's why I am looking to develop a plugin for it. As per my understanding, we need to call native android api for android devices and screentime api for iOS devices. I am struggling to implement for android devices. The device policy manager file (open sourced by Google) has methods like setApplicationRestrictions but the caller of this api should be either device owner or profile owner. For making device owner, all the accounts in the device should be removed and no user will want this to happen. Profile owner creates work profile and is different from parental control.

I am lost into most of the resources I found online. I just want my app (android) to apply restrictions to another apps. I need help how to proceed regarding this implementation. Is there anyways to achieve this?.

I looked into the native android api but I am unable to use it due to device owner or profile owner restrictions.

1

There are 1 best solutions below

0
Ginder Singh On

Your findings are almost correct.

There two types of control Android OS provide.

Limited control with Android device Admin App.

Android sdk provides public interface called "DevicePolicyManager" to apply a policy to the device. But this would require making your app "Device Admin App"

  • Ask user permission by launching this event : ACTION_ADD_DEVICE_ADMIN
  • Register receiver to get updated status: DeviceAdminReceiver
  • Once enabled get instance of : DevicePolicyManager

This will get you access to set wipe data, disable camera etc. Some third party apps use these apis + misuse of draw overlay and accessibility permissions to "Block" Apps. Most of it is hacky at best.

Full control with DPC app

This is changed to now to "Android management API" You creates device setup app which acts as device owner and has full control over fleet of devices and also uses DevicePolicyManager interface, This only useful for enterprise applications.

Api you mentioned above to set restrictions or hide other apps is part of full control. You have to be device owner(A device owned by organization). So no there is no current api available to match your needs to control other apps without building a dpc application which requires register with google, get approved, code review and whole lot.