民间,
我有一个要开发的应用程序,当用户卸载应用程序时我需要通知。我在广播接收器中有ACTION_PACKGE_REMOVED动作,但它什么也没做。
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
try
{
if(intent.getAction().equals(Intent.ACTION_PACKAGE_CHANGED))
{
System.out.println("Your Package Is removed By Your Child");
System.out.println("Your Package Is removed By Your Child");
System.out.println("Your Package Is removed By Your Child");
System.out.println("Your Package Is removed By Your Child");
System.out.println("Your Package Is removed By Your Child");
System.out.println("Your Package Is removed By Your Child");
System.out.println("Your Package Is removed By Your Child");
SendSms(context);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
由于
答案 0 :(得分:1)
我认为期望您的应用程序在卸载时收到通知是不合逻辑的,因为“取消安装”意味着从磁盘中删除您的应用程序,这首先是在应用程序运行时终止它。
点击此处:http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED