I am trying to generate a file name to save an AR Model using ARCore and Kotlin.
Since Android 10 the Environment methods getExternalStoragePublicDirectory()
and getExternalStorageDirectory()
were deprecated for privacy concerns.
What can be a replacement for the following code?
private fun generateFileName() : String {
val date = SimpleDateFormat("yyyyMMddHHmmss", java.util.Locale.getDefault()).format(Date())
return Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + "CardAR/" + date + "_screenshot.jpg"
}