Wednesday, June 15, 2011

[android-developers] how to get event by broadcast receiver when application installed first time?

Hi,

I m just trying to get event through broadcast receiver when
application installed firsttime.

Here is my broadcastreceiver class.
public class LaunchReceiver extends BroadcastReceiver
{
public static final String TAG="LaunchReceiver";

@Override
public void onReceive(Context context, Intent intent)
{
Log.i(TAG,"..............OnReceive.................");

if(intent.getAction().equals("android.intent.action.PACKAGE_INSTALL"))
{
Log.i(TAG,"..............OnReceive.................");
}
}

}

Here is my manifest.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.back"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/
app_name">
<service android:name="BackgroundService" android:enabled="true"></
service>
<receiver android:name=".LaunchReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_INSTALL"></
action>
<action android:name="android.intent.action.CALL"></action>
<action android:name="android.intent.action.PACKAGE_ADDED"></action>
</intent-filter>
</receiver>

</application>
<uses-sdk android:minSdkVersion="4" />

</manifest>

I m not getting broadcast on any events.

can anybody tell me what is the problem with this code?


--
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

No comments:

Post a Comment