Android 应用程序卸载的广播接收器,无需始终运行的活动

Android 应用程序卸载的广播接收器,无需始终运行的活动,android,Android,我正在尝试使用广播接收器检测应用程序卸载 我管理我的应用程序,创建一个没有活动的接收器 应用卸载。当我第一次运行并转到 应用程序->管理应用程序->卸载它第一次只能工作一次 但之后它没有收到任何响应 我的听筒给你看了 公共类接收程序扩展广播接收器{ @Override public void onReceive(Context ctx, Intent intent) { // TODO Auto-generated method stub if(intent.getAction().

我正在尝试使用广播接收器检测应用程序卸载

我管理我的应用程序,创建一个没有活动的接收器

应用卸载。当我第一次运行并转到

应用程序->管理应用程序->卸载它第一次只能工作一次

但之后它没有收到任何响应

我的听筒给你看了

公共类接收程序扩展广播接收器{

@Override
public void onReceive(Context ctx, Intent intent) {

    // TODO Auto-generated method stub
 if(intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED))

 {
    Intent i=new Intent(ctx.getApplicationContext(),AppUninstall.class);

    ctx.startService(i);
}
}
}

我在清单文件中为接收者添加了如下操作

}


请任何人帮助我提前感谢

可能这是不可能的,因为卸载应用程序后,没有代码接收您的广播。。。
android:versionCode="1"

android:versionName="1.0" >

<uses-sdk android:minSdkVersion="8" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

   <application

    android:icon="@drawable/ic_launcher"

    android:label="@string/app_name" >

    <receiver android:name="r.c.a.AppReceiver" android:enabled="true">

        <intent-filter>

            <action android:name="android.intent.action.PACKAGE_REMOVED" />

            <data android:scheme="package" />

            <action android:name="android.intent.action.BOOT_COMPLETED" />

        </intent-filter>

    </receiver>

    <service  android:name="r.c.a.AppUninstall" android:enabled="true"></service>

</application>
private final IBinder mBinder = new LocalBinder();

    String pack;

    NotificationManager nfm;

    Notification nf;
@Override
public IBinder onBind(Intent arg0) {

    // TODO Auto-generated method stub

    return mBinder;
}
@Override
public void onCreate() {


        }
@Override                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
public void onDestroy() {

}
public int onStartCommand(Intent intent, int flags, int startId) {

// TODO Launch a background thread to do processing.

    super.onStartCommand(intent, flags, startId);


    pack=intent.getPackage();

    nfm=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);

            int NOTIFICATION_ID = 1;

           Intent intent1 = new Intent();

          PendingIntent pi = PendingIntent.getActivity(AppUninstall.this, 1, intent1, 0);

          nf=new Notification(R.drawable.ic_launcher,"App                            Uninstalled",System.currentTimeMillis());

      nf.setLatestEventInfo(getApplicationContext(), pack, null, pi);



          startForeground( NOTIFICATION_ID,nf);

       return Service.START_STICKY;


    }

 public class LocalBinder extends Binder {

       AppUninstall getService() {

            return AppUninstall.this;
        }

}