【问题标题】:how to remove notification fired after application data is cleared from mobile如何删除从移动设备清除应用程序数据后触发的通知
【发布时间】:2016-10-02 04:17:08
【问题描述】:

我是 android 新手,我想知道如何在卸载应用程序后禁用接收通知,是否有任何事件或某些东西可以检测到该应用程序已卸载??? 我已经尝试过了,但对我不起作用

 if(intent.getAction().equals("android.intent.action.PACKAGE_REMOVED")) {

    Intent i = new Intent(context,BootReceiver.class);
    Identifier = i.getStringExtra("Recognition_flag");
    serverUrl = Constants.urlAll + "uninstall.php";
    LongOperation serverRequest = new LongOperation();
    // serverRequest.execute(serverUrl, user, pass,
    // deviceIMEI);
    serverRequest.execute(serverUrl, user);
    GCMRegistrar.setRegisteredOnServer(context, true);
    Log.e(" BroadcastReceiver ", "onReceive called " + " PACKAGE_REMOVED ");
    Toast.makeText(context, " onReceive !!!! PACKAGE_REMOVED", Toast.LENGTH_LONG).show();
 }
 // when package installed
 else if (intent.getAction().equals("android.intent.action.PACKAGE_ADDED")) {
     Log.e(" BroadcastReceiver ", "onReceive called " + "PACKAGE_ADDED");
     Toast.makeText(context, " onReceive !!!!." + "PACKAGE_ADDED", Toast.LENGTH_LONG).show();
}

【问题讨论】:

  • 您想跟踪应用何时卸载?遗憾的是,这并没有发生...... android.intent.action.PACKAGE_REMOVED 已被移动设备中存在的所有其他应用程序接收,期待您的
  • @therealprashant 谢谢。你能告诉我whatsapp和其他消息应用程序如何停止向未安装应用程序的用户发送通知吗?
  • 不知道 Whatsapp ..那是一个完全不同的堆栈...但是关于其他人..他们使用 GCM ...在发送通知之前..GCM 会检查用户是否有其设备令牌是否针对该特定应用程序...如果不是,则 GCM 不会发送通知...stackoverflow.com/questions/22994409/…

标签: java android push-notification broadcastreceiver android-broadcast


【解决方案1】:

您无法以任何简单的方式检测 Android 上的应用卸载。广播 android.intent.action.PACKAGE_REMOVED 会发送到移动设备中存在的所有应用程序一旦应用程序被删除,您的应用程序就会被发送。

当然,我的公司有一些方法可以在应用程序被卸载时进行跟踪,但那是非常棘手和深入的事情。

【讨论】:

  • 感谢您的宝贵意见。 @therealprashant
猜你喜欢
  • 2014-11-11
  • 2012-01-30
  • 1970-01-01
  • 2021-09-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-10
相关资源
最近更新 更多