I made an app that i'm am working on updates for and in the old version I hard coded the file path like this
"/data/data/my.app.here/troll"
so now I am trying to do an update and I am trying to use something similar to
Context.getFilesDir()
but that returns
/data/user/0/my.app.here/files
the app info is stored on the troll file and when I push updates I don't want to use another path and have them start their information all over again. What's the best way to resolve this situation?
Can someone kindly tell me the best way to resolve this situation?
Call getParentFile()
on the File
returned by getFilesDir()
to get its parent directory. Your troll
file should be in there. That wasn't a great place to put a file, and so YMMV.
If your concern is the /data/user/0/
, that will be handled by Android and should map to /data/data/
when the primary user is the one running your app.