Reputation: 33
1 . can we get any event when user tap/touch native application(i.e. messaging,contacts).
2 . i know that any application launch by intent in android, there is any way to know which application launch with launch of application.
Thanks
Upvotes: 0
Views: 1599
Reputation: 33248
I am agree with @K_Rapid's answer..
Check code of AppLocker
I hope you will got solution from that code...
Upvotes: 0
Reputation: 51
No, We can not get any event directly or by any receiver.
what I have figured it that it can not be done directly......
But there are two work around for this :
Start a service that will check top-activity always by this way can know what activity got launched and do whatever you do under this condition.
Catch the logcat, read the line, and you can easily get what event what even took place, and by using your required filters you can even do whatever you like :)
Upvotes: 2
Reputation: 1007276
can we get any event when user tap/touch native application(i.e. messaging,contacts).
Not generally. Most of these icons are tied to their applications.
there is any way to know which application launch with launch of application.
This makes no sense to me, sorry.
Upvotes: 1
Reputation: 13701
For (1): what do you mean by 'tap/touch'? Do you mean when the built-in applications are launched, or when they're interacted with?
If you mean launching, you can listen to any intents being fired by the system by registering a broadcast receiver. If you set your IntentFilter to receive intents with CATEGORY_LAUNCHER, you should be able to see when the launcher starts applications.
See:
http://developer.android.com/reference/android/content/Intent.html#CATEGORY_LAUNCHER
http://developer.android.com/reference/android/content/BroadcastReceiver.html
If you mean interacting, I don't think you can do that.
For (2): I don't believe that intents remember where they were constructed, so I don't think this is possible. I could be wrong, however.
Upvotes: -1