Sunday, September 16, 2012

[android-developers] Broadcast Receiver to listen when any app launch?

I want to be notified when any app launch like Calculator, Email etc,
so I tried below code

#Attempt 1

<receiver android:name=".ApplicationLaunchReceiver"> 
    <intent-filter> 
        <action android:name="android.intent.action.MAIN" /> 
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter> 
</receiver>

but this code didn't work. then I tried one more code,

#Attempt 2
   
<receiver android:name=".CatchBroadcastReceiver" >
    <intent-filter >
        <action android:name="android.intent.action.PACKAGE_ADDED"/>
<data android:scheme="package" android:path="com.test"/>
    </intent-filter> 
</receiver>

but this code also didn't work.  Please let me know what I am doing wrong.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate