I've a root app that does read the database of another app. For this I need to find the path of the database, so I do following:
String foreignAppDatabaseFolderPath = "/data/data/" + foreignPackageName + "/databases";
String foreignAppDatabasePath = foreignAppDatabaseFolderPath + "/" + foreignDbName;
But know I realised, that the user could move an app to the sd card. I anyway change the above code to following:
String myAppDatabaseFolderPath = context.getDatabasePath("db")
.getParentFile()
.getAbsolutePath();
String foreignAppDatabaseFolderPath = myAppDatabaseFolderPath
.replace(myPackageName, foreignPackageName);
String foreignAppDatabasePath = foreignAppDatabaseFolderPath + "/" + foreignAppDatabaseName;
But how do I find out the path that I should check, if the app was moved to the sd card?
String foreignAppDatabaseSdCardFolderPath = ???;