Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
208 views
in Technique[技术] by (71.8m points)

android - Listen Broadcast Before application uninstall

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...