EnoughPhoneIsEnough

On average, the typical person opens up their phone 150 times per day, and this number can easily increase to 300, this means once every 5 minutes.

Google Play Link
ProductHunt Link

Cannot force yourself to use your phone less?
Maybe if money is involved in this equation you are going to be more motivated. Every time you open up the phone you are going to voluntarily pay 0.003$, not much, but in time it gathers.
Also, 50% of the money you are paying will go towards solving an environmental problem, it's a win-win.

How does it work

In order to track the amount of phone pickups, a foreground service is continuously running and listening to broadcasts of type Intent.ACTION_SCREEN_ON. I have used a foreground service because it's intended to do a task that the user must be aware of (by always displaying a notification like the one bellow). Also, this kind of service has significantly lower chances to being shut down by the system.

Although, sometimes my service was stopping and in order to tackle this, I have set up a PeriodicWorkRequest that opens the foreground service if it is not running. The new API is quite straightforward to use.

val work = PeriodicWorkRequest.Builder(StartScreenOnWorker::class.java, 16, TimeUnit.MINUTES).build()
WorkManager.getInstance().enqueueUniquePeriodicWork("EnoughIsEnough", ExistingPeriodicWorkPolicy.KEEP , work);

The timestamp (in seconds) of each new pickup is persisted in a local SQLite database that is queried later to populate the graphs with the needed data.

var pRepository = PickUpsRepository.getInstance(context)
pRepository.insertPickUp(pickup = Pickup(timeStamp))

Validation

As I wanted first to validate my idea, there is no code written that actually processes payments, but at the first start of the application, I do query the user to see his / her intentions.

TECHNOLOGIES USED

Mobile:


GITHUB

Project link