How to display a warning message when an app is removed from setup on a mobile device
IF I am trying to remove from the mobile settings ( Settings-> Application manager) then I want to display a warning message " . If yes then I want to back up the database and not delete it as usual, how to delete the form. IT IS POSSIBLE OR NOT ? are you sure want to save database your uninstallING app ?
or
Can I determine when building the apk to back up the database of the current application in the manifest file. Is it possible. I'm trying to set android: allowBackup = "true" in my manifest file but can't figure out how it works or not or any other available option, please send me a message.
Edited:
Another option is whether I should give a message when uninstalling the application or edit the dialog below and give an option with a checkbox, with one of them being a database backup.
source to share
Short answer: No, this is not possible.
Database backup can be done when the application starts. Settings -> Application manager is the domain of the android system, you cannot program the application to behave any type of xyz in this area.
Unless you want your app to launch a custom environment with rooted devices.
Edit as per the edited question:
Allow the application to participate in the backup and recovery infrastructure. If this attribute is set to false, the application will never be backed up or restored, even with a full system backup, which would otherwise cause all application data to be saved using adb. The default value for this attribute is true .
this means that if you set it to true it won't change any behavior.
The other part is not clear, I suggest, if it is different from the original question, ask a new question, specifying only that.
source to share
It's not possible at all
You may receive uninstallation warning from the broadcast receiver, but you received the broadcast only to uninstall other applications, never for your application.
Reason: . If you write a broadcast to receive a removal notification for your app, and when ever a user uninstalls your application, the broadcast was removed / removed / unregistered before being notified. Therefore its not possible to receive notification to uninstall your own app.
source to share
You can try to create the following algorithm:
- Create infinity flow with definition of launcher apps with logarithmic reader.
- Determine Application Launch - Application - Settings or Delete: Search for lines with strings "android.settings.APPLICATION_DETAILS_SETTINGS", "android.intent.action.UNINSTALL_PACKAGE" or "android.intent.action.DELETE".
- Make your action "alert" (save database to SDCard / server or similar).
- Wait for any other application to start and delete the saved database from sdcard / server. If in point 4 this user deletes another (not our) application.
I use 1-3 points in my applications and it works great but works on any uninstallation of any application.
source to share