user2340490
user2340490

Reputation: 137

How to display alert message when app uninstall from setting in mobile

IF i am trying to uninstall from setting of mobile(Settings-> app manager) then I want to display alert message "are you sure want to save database your uninstallING app ?. if yes then i want to backup database and no for uninstall just like uninstall form setting as usual.IS THAT IS POSSIBLE OR NOT?

Or

Can i defined when build apk to backup database of current app in menifest file., is it possible. I try set android:allowBackup="true" in manifest file but could not understand how to work this or not or any other option available please forward me message..

Edited:

Other option, should i give message when uninstall app or edit below dialog box and give option with check box, with one of them database backup. enter image description here

Upvotes: 3

Views: 2661

Answers (4)

Sujith S Manjavana
Sujith S Manjavana

Reputation: 1576

You can. You can do this with device administrator api.

Upvotes: 0

SweetWisher ツ
SweetWisher ツ

Reputation: 7306

It is not at all possible

You can get the uninstall alert by using the broadcast receiver but You got broadcast only for other application's uninstall but never for your own application.

Reason : If you write broadcast to get uninstall notification for your app and when ever User uninstall your app that broadcast has been deleted/removed/unregistered before notifying you. So its not at all possible to get Notification of uninstall of your own app.

Upvotes: 1

Pararth
Pararth

Reputation: 8134

Short answer: No, that is not possible.

The backup of database can be taken when the app runs. Settings -> App Manager is Android System domain, you cannot program your app to behave in any xyz manner under that scope.

Unless you want your app to run over custom controlled environment with rooted devices.

Edit according to the edited question:

android:allowbackup:

Whether to allow the application to participate in the backup and restore infrastructure. If this attribute is set to false, no backup or restore of the application will ever be performed, even by a full-system backup that would otherwise cause all application data to be saved via adb. The default value of this attribute is true.
meaning if you set it to true, it doesn't change any behaviour.

The other part is not clear, i suggest, if its different from the original question, ask a new question specifying only that.

Upvotes: 3

Tapa Save
Tapa Save

Reputation: 4857

You can try create next algorithm:

  1. Create infinity thread with determine launch apps by logcat reader.
  2. Determine launch Apps - App - Settings or Delete: Search lines with strings "android.settings.APPLICATION_DETAILS_SETTINGS", "android.intent.action.UNINSTALL_PACKAGE" or "android.intent.action.DELETE".
  3. Do your 'alert'-action (save database to sdcard/server or similar).
  4. Wait for launch any another app and delete saved database from sdcard/server. If point 4 work that user delete another (not our) app.

I use 1-3 points in my apps and it works fine, but its work on any deleting any app.

Upvotes: 0

Related Questions