0

I just wondered if (app is closed) there is a way to get notified when:

  1. The screen turns on/off,
  2. Another app starts/was closed.

I already found some hacky ways that might work, but they dont seem to be quite confidential. Some of them seem to only work on some phones. I am looking for "clean" way that works on all phones.

Why I would like to know that:

  1. To track the time I am spending during the day on my phone,
  2. To be able close the system alert window if a user opens another app.

Cheers :)

JEY
  • 6,973
  • 1
  • 36
  • 51
user3254639
  • 86
  • 1
  • 8

1 Answers1

0

I just wondered if (app is closed) there is a way to get notified when:

We'll see.

(1.1) The screen turns on/off

Yes there is. Try using a BroadcastReceiver.

(1.2) Another app starts/was closed.

(2.1) To track the time I am spending during the day on my phone,

(2.2) To be able close the system alert window if a user opens another app.

There's no way to do this UNLESS you're a root user. Each application has it's own working side.

Machado
  • 14,105
  • 13
  • 56
  • 97
  • Thanks :)
    I am doing it that way now
    http://stackoverflow.com/questions/16161062/broadcastreceiver-for-screen-on-off-not-working
    – user3254639 Jul 31 '14 at 17:19