1

I'm developing a Learning Application. In it, I have an Activity where the user can select some applications from a list of all the applications installed on his device.

Now, I'd like to launch my Activity whenever the user launches any of the selected applications from the app list. Basically I'd like to override the selected Activity by my activity. Once the user complete's some task, the user should be returned to the previously clicked Application.

How do I "Capture" this 'Launching other applications' part? BroadcastReceivers? Any example would be highly helpful. I'd be very grateful if anyone points me in the right direction with reference links.

This is very similar to a Lock Apps Application. But in a very badly twisted kind of way. I know I have to use a background service to monitor the user activity.

Ashok Goli
  • 5,043
  • 8
  • 38
  • 68

1 Answers1

1

You don't intercept arbitrary application launches, if that's what you're after. Doing this silently goes against the Android (or any reasonable) security model.

What you can do is offer an alternative Home screen.

However, if you just have a list view of available applications, nothing stops you from defining custom behaviours within that list activity.

Pontus Gagge
  • 17,166
  • 1
  • 38
  • 51
  • Hi Pontus, Thanks for the quick reply. If it is against the Android Security Model, then how do Security Applications manage to do it? I mean the ones that offer to lock selected apps with a pattern or lockscreen. They manage to fire their own app/activity when we open any locked app. – Ashok Goli Mar 22 '11 at 14:21
  • What security applications can do is either replace the home screen (unpopular), or regularly check what applications are running (not foolproof). They require rather high privileges. This isn't a new question: see e.g. http://stackoverflow.com/questions/3290936/android-detect-when-other-apps-are-launched – Pontus Gagge Mar 22 '11 at 19:56
  • Hey Pontus, Thank you. That was exactly what I was looking for :) Although, the answer was vague, that was the heart of my problem. – Ashok Goli Mar 23 '11 at 05:48