-3

I am working in app that needs to call an api, Webservice before uninstall app so please let me know if any solution to call before uninstall or any process that called before uninstall app.

Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
  • This ain't possible, but there are some work arounds like [this](http://stackoverflow.com/a/18816716/4782930) – Strider Feb 26 '16 at 08:27

2 Answers2

-1

You could try adding a BroadcastReceiver listening for android.intent.action.PACKAGE_REMOVED events.

malrok44
  • 592
  • 6
  • 17
  • 3
    Doesn't work: read [ACTION.PACKAGE.REMOVED](http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REMOVED). it says: **The package that is being removed does not receive this Intent.** – Strider Feb 26 '16 at 08:29
  • My bad, I did not understand you wanted the uninstalled app to be notified. And I do not think this can be done... – malrok44 Feb 26 '16 at 08:37
  • No problem ;), your intentions were good. And u are right, this cannot be done, atleast... not without complex work arounds. – Strider Feb 26 '16 at 08:39
  • Hello guys, but i need solution with same app to getting notified before uninstall – James Gurera Feb 26 '16 at 08:53
  • 1
    @JamesGurera yeah we know, but you **can't** (yet?), [this post](http://stackoverflow.com/questions/18692571/how-can-an-app-detect-that-its-going-to-be-uninstalled/18816716#18816716) is as close as you can get! – Strider Feb 26 '16 at 09:00
-1

You Register your BroadCastReceiver with this filter:

 <receiver android:name=".MyBroadCastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
            </intent-filter>
        </receiver>
Pedif
  • 144
  • 8
  • Doesn't work: read [ACTION.PACKAGE.REPLACED](http://developer.android.com/reference/android/content/Intent.html#ACTION_PACKAGE_REPLACED) it says: **A new version of an application package has been installed, replacing an existing version that was previously installed.** nothing about detecting uninstallation. This can be used for detecting updates. – Strider Feb 26 '16 at 08:59
  • This is what the [MY_PACKAGE_REPLACED](http://developer.android.com/reference/android/content/Intent.html#ACTION_MY_PACKAGE_REPLACED) does! The OP want's to know how to catch his application being **uninstalled**. Not **replaced**. – Siddharth Lele Feb 26 '16 at 08:59