You also need to add <data android:scheme="package" />.

2009/12/2 feng tian <[email protected]>

> Hi, All:
> I want to receive the broadcast intent "PACKAGE_ADDED", but it seems I cant
> get it. Here are my codes, can someone check for me? Thanks very much.
>
> //TestReceiver.java, this is the class for receiving the intent. I just
> display
> package com.android.receiver;
> import android.content.BroadcastReceiver;
> import android.content.Context;
> import android.content.Intent;
> import android.widget.Toast;
>
> public class TestReceiver extends BroadcastReceiver {
>  public void onReceive(Context arg0, Intent arg1) {
>      Toast.makeText(arg0, "You have Received Broadcast",
> Toast.LENGTH_LONG).show();
>  }
> }
>
> //ReceiveActivity.java, this is the class for activity
> package com.android.receiver;
> import android.app.Activity;
> import android.os.Bundle;
> public class ReceiverActivity extends Activity {
>     public void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.main);
>     }
> }
>
> I defined the filter in the manifest .xml file:
>            <action android:name="android.intent.action.TIME_SET"/>
>            <action android:name="android.intent.action.PACKAGE_ADDED"/>
>
> I can detect the "TIME_SET" broadcast successfully. But I can't detect the
> PACKAGE_ADDED broadcast when I installed a package. :(
>
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Reply via email to