Skip to content

Instantly share code, notes, and snippets.

@Apsaliya
Created June 1, 2020 15:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Apsaliya/dcaa9cd02fca94b0dd5c3246ab70f59f to your computer and use it in GitHub Desktop.
Save Apsaliya/dcaa9cd02fca94b0dd5c3246ab70f59f to your computer and use it in GitHub Desktop.
Create backup file in external storage
fun onLocalBackupRequested(activity: Activity) {
val mimeTypes = arrayOf("application/zip")
val fn = getBackupFileName(prefix)
val intent = Intent(Intent.ACTION_CREATE_DOCUMENT)
.addCategory(Intent.CATEGORY_OPENABLE)
.setType("application/zip")
.putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes)
.putExtra(
Intent.EXTRA_TITLE, fn
)
activity.startActivityForResult(intent, 695)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment