Im using database to store messages, and if i uninstall my app and again reinstall the same app, the db remains same, but i want to clear my database, how to solve this?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
I think it's not ordinary situation, cause when you uninstall app - all db are removed automaticaly. But if it doesn't happen - try to clear data in Menu - Manage App - your app - Clear data before uninstalling.
All data including databases,preference,local data files stored in internal storage are deleted on an uninstall.They will only stay intact on application update.
below code can help you to delete your database from your application
make one method in class where you handle your database handling means. where you crate other methods like add,update etc..
To listen the uninstall event you have to implement a broadcast received, like:
And then in your UninstallIntentActivity you have to use the next line to delete your database:
You can see more about this topic here Listen Broadcast Before application uninstall
I hope this works for you.
In my case I just forgot to add below line in onUpgrade method of DatabaseHelper class