Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listen Broadcast Before application uninstall

Tags:

android

I have installed Avg Antivirus for testing purpose.
After Testing when I have tried to uninstall that Antivirus,Antivirus has prompted me that 'are you sure you want to remove this application?'.
That prompt screen is generated by antivirus application. After that screen I got System prompt with OK and CANCEL Button. so, That prompt was put by antivirus application.

Now my question is...

How can I put prompt screen for user in my application as same as explain above? I know about "android.intent.action.PACKAGE_REMOVED" but it received after application has been fully uninstall.

Any help is appreciated.

Thank You.

like image 364
Nirav Avatar asked Dec 26 '11 07:12

Nirav


1 Answers

I've added the following intent-filter and now I receive the dialog to chose activity. I think you should play with this filter to display your activity (especially with data part of the filter).

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".UninstallIntentActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <action android:name="android.intent.action.DELETE" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:scheme="package"  />
        </intent-filter>



    </activity>

</application>
like image 111
Yury Avatar answered Sep 16 '22 13:09

Yury