[android-developers] Re: App uninstall doesn't remove SQL database
On Windows...did you try clean,rebuilt the project and run again? just trymaybe help. On Sunday, 3 April 2016 11:55:29 UTC+1, Simon Ho wrote: > > I posted this on stackoverflow, but I thought maybe I'd have more luck > here... > > I have a strange problem where my SQL database doesn't remove itself when > I uninstall the app > > I'm not creating the database in any external storage directories, and the > database is confirmed to be in its default location: > /data/data/com.example.app/databases/ > > After I uninstall the app, I expect all the data in that location to be > wiped, but when I run the app again from android studio the new install can > still see all of the old data > > I have tried using adb to manually delete the .db file from the databases > directory, but when I run the app again the old data can still be seen > > I have also tried going into the app settings and clearing the data and > cache, but that doesn't seem to help > > The only places in my code where I'm doing anything "strange" with regards > to the database is I'm copying the database file to a new location on > button click: > > String pathToExternalStorage = Environment.getExternalStorageDirectory > ().toString(); > File exportDir = new File(pathToExternalStorage, "/SensorData"); > File subjectDataDir = new File(exportDir, "/subjects"); > > File data = Environment.getDataDirectory(); > String currentDBPath = "//data//com.example.app//databases//" + > DBHelper.DATABASE_NAME; > File currentDB = new File(data, currentDBPath); > File destDB = new File(exportDir, DBHelper.DATABASE_NAME); > > FileChannel src = new FileInputStream(currentDB).getChannel(); > FileChannel dst = new FileOutputStream(destDB).getChannel(); > dst.transferFrom(src, 0, src.size()); > src.close(); > dst.close(); > > > And then running mediascanner on the newly created file so I can get > instant MTP access to it > > I doubt that either of these processes could cause this to happen though? > > My immediate question is how do I manually remove the database from the > phone without root access? > > The bigger question is what could be causing the uninstall process to not > remove the database files? And how does a newly installed version of the > app (after an uninstall) still see the old database information? > > I'm not sure how to begin figuring this out... > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/3a8da82f-dad3-4ee6-a381-cd5ba312e3ba%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: App uninstall doesn't remove SQL database
This is getting stranger. This only seems to happen on Windows. This is the process I tried: 1. Delete/uninstall the app from the phone 2. Run app from android studio on Windows. Problem: database still exists and app sees all old data (even though I uninstalled the app) 3. Uninstall app 4. Run app from android studio on my macbook. No problem! The database is fresh, and no existing data is found 5. Uninstall app again 6. Test again on my Windows machine. Now, the database comes back and the app sees the old old database info (from step 2!). Uninstall at this point doesn't get rid of it So I really am at a loss now. Why would running on a Mac be OK? And why would, after running on a Mac and cleaning out the database, then bring the old Windows database again? Should this not all be OS independent? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/9bd2d742-39bf-4494-9309-22f4a28429af%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[android-developers] Re: App uninstall doesn't remove SQL database
This is getting stranger. This only seems to happen on Windows. This is the process I tried: 1. Delete/uninstall the app from the phone 2. Run app from android studio on Windows. Problem: database still exists and app sees all old data (even though I uninstalled the app) 3. Uninstall app 4. Run app from android studio on my macbook. No problem! The database is fresh, and no existing data is found 5. Uninstall app again 6. Test again on my Windows machine. Now, the database comes back and the app sees the old old database info (from step 2!). Uninstall at this point doesn't get rid of it So I really am at a loss now. Why would running on a Mac be OK? And why would, after running on a Mac and cleaning out the database, then bring the old Windows database again? Should this not all be OS independent? On Sunday, 3 April 2016 03:55:29 UTC-7, Simon Ho wrote: > > I posted this on stackoverflow, but I thought maybe I'd have more luck > here... > > I have a strange problem where my SQL database doesn't remove itself when > I uninstall the app > > I'm not creating the database in any external storage directories, and the > database is confirmed to be in its default location: > /data/data/com.example.app/databases/ > > After I uninstall the app, I expect all the data in that location to be > wiped, but when I run the app again from android studio the new install can > still see all of the old data > > I have tried using adb to manually delete the .db file from the databases > directory, but when I run the app again the old data can still be seen > > I have also tried going into the app settings and clearing the data and > cache, but that doesn't seem to help > > The only places in my code where I'm doing anything "strange" with regards > to the database is I'm copying the database file to a new location on > button click: > > String pathToExternalStorage = Environment.getExternalStorageDirectory > ().toString(); > File exportDir = new File(pathToExternalStorage, "/SensorData"); > File subjectDataDir = new File(exportDir, "/subjects"); > > File data = Environment.getDataDirectory(); > String currentDBPath = "//data//com.example.app//databases//" + > DBHelper.DATABASE_NAME; > File currentDB = new File(data, currentDBPath); > File destDB = new File(exportDir, DBHelper.DATABASE_NAME); > > FileChannel src = new FileInputStream(currentDB).getChannel(); > FileChannel dst = new FileOutputStream(destDB).getChannel(); > dst.transferFrom(src, 0, src.size()); > src.close(); > dst.close(); > > > And then running mediascanner on the newly created file so I can get > instant MTP access to it > > I doubt that either of these processes could cause this to happen though? > > My immediate question is how do I manually remove the database from the > phone without root access? > > The bigger question is what could be causing the uninstall process to not > remove the database files? And how does a newly installed version of the > app (after an uninstall) still see the old database information? > > I'm not sure how to begin figuring this out... > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/ef1c0034-9473-4179-b08a-3a431a27d14b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.