Android: Save file permanently (even after clear data / uninstall)

前端 未结 2 631
谎友^
谎友^ 2020-11-30 11:46

I would like to know if there is a way to store a small amount of data permanently.
By permanently I mean I want the data to persist even if user clears app data / unins

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 12:32

    Environment.getDataDirectory() is at least one directory where you can save files. It's on the internal storage (/data).

    One case I use it is to define whether a service is running; I create a .lock file in there and always check whether it exists or not.

提交回复
热议问题