-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export functionality using file dialog #158
Comments
@jogi123 Actually it's the normal behavior; after Android 11 update, preloaded My Files app doesn't show files and folders within 'android/data'. (due to access permissions) I agree with you - If we can save the export file in a specific location it would be great though... |
When i wrote the export function, i wasn't able to provide such feature, but i agree that it could be useful and more user friendly. I'll see what i can do ;) |
@Dilshan-H Sorry, my bad. Thanks for the advice! |
I also use a Samsung phone and cannot access the data folder with the default file manager. However, when you export the backup, a share dialog should pop up. The options will vary based on the device and the apps you use, but it may even have an option to save the file wherever you want. Mine, of course, doesn't. So the easiest solution for me personally is to send the file to my computer using KDE Connect and back to my phone so it ends up in my Downloads folder, which is accessible using conventional means. Is it ideal? Nope. |
Yep, i agree. I always tend let the OS work instead of writing features in the app from scratch (and that's what Goole suggest normally, since Android is becoming really restrictive regarding privacy, see the need to ask for a permission to send notifications 😵💫 ). This means that to avoid asking additional permissions and follow the scoped storage principle, the backup is saved in that folder and shared afterwards. Same story for the app language (selectable from settings in Android 13+), the notification sound, the battery optimization disabling process and the file selection. Another very important fact to consider is that, if i add a new feature, i have to translate it in a A LOT of languages, or wait for the translators. That's why i added an "experimental settings" section in v4.x.x: it contains advanced, experimental and untranslated settings! |
Here is a draft I came up with by looking at other projects. val launcher = (context as MainActivity).registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
val intent = result.data
val uri = intent?.data
uri?.let { uri ->
fileFullPath = uri.path ?: ""
context.contentResolver.openOutputStream(uri)?.use { outputStream ->
outputStream.write(dbFile.readBytes())
(context as MainActivity).runOnUiThread {
context.showSnackbar(context.getString(R.string.birday_export_success))
}
} ?: run {
(context as MainActivity).runOnUiThread {
context.showSnackbar(context.getString(R.string.birday_export_failure))
}
}
}
}
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.setType("application/octet-stream")
.putExtra(Intent.EXTRA_TITLE, fileName)
launcher.launch(intent) I can’t implement it myself because I’m not a Kotlin developer and I don’t have a good grasp of Android features such as Lifecycles (I tried to put the code above in |
Hi and sorry for the super late reply. I'll take a look as soon as I have some free time, thanks! |
Don’t worry, take your time! |
Hi,
I really like the simplicity and the look and feel of the app.
But I miss the feature to export the events using a file dialog so that you can save the backup file wherever you want. On my device (Samsung A71, Android 12) I'm unable to locate the backup file in Android/data/com.minar.birday/files since the folder com.minar.birday doesn't exist in Android/data.
Thank you very much for your dedication to this awesome project!
The text was updated successfully, but these errors were encountered: