Android Question Creating an App to Lock Other Apps In The Morning

bennet0904

New Member
Hello.

I am currently working on an app that is supposed to help me get up in the morning. Normally, when I wake up, I reach for my phone and then proceed to browse on some social media app for way too long.

The app is supposed to work like this:
In the main app, you select a time (e.g. 4am). Then, you can close the app This part already works.
At the selected time, the app is supposed to "lock" all your apps, until you confirm that you already left your bed.

I found two possible options to achieve this:
  1. Start a periodic job (e.g. once an hour), that checks, if the current time is greater than the selected time. If this is the case, launch a foreground service that displays an overlay over all applications.
  2. The android system sends broadcasts on certain events, e.g. (de)-activating airplane mode. If there is a broadcast sent when any app is launched, it would be possible to create a BroadcastReceiver that puts an overlay over all apps.
I have questions for both options:
  1. Is there a possibility to configure the foreground service in a way that it only displays the overlay over actual apps? Because I only want to block applications, not the entire screen.
  2. I don't think that there is a broadcast sent on any app launch. If I am wrong, and I hope I am, please tell me.
Thank you in advance for the help
Bennet
 

MicroDrie

Well-Known Member
Licensed User
Longtime User
I think your assumptions are at odds with Google's increasingly strict rules, which basically mean that a user from a foreground application does something himself.
 
Upvote 0

bennet0904

New Member
I think your assumptions are at odds with Google's increasingly strict rules, which basically mean that a user from a foreground application does something himself.
Yes, I've noticed that Google's rules are very strict. I'm afraid that's why I have to scrap my second option. I think there is no such broadcast for privacy reasons.
Nevertheless, I believe that my first option could work, so Question 1 stlil stands.
 
Upvote 0
Top