Skip to content
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

Fix restore and save backup for newer android versions #1246

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

amrhossamdev
Copy link
Member

Fixes #1212

Details

Starting with Android 10, users reported issues with backup and restore functionality, especially on Android 13, where they were unable to create or restore backups. This was due to changes in how external storage permissions are handled. More details can be found in the Android documentation.

To address this, I integrated the updated APIs that support saving and restoring local backups, ensuring compatibility from Android 5 (Lollipop) through the latest versions of Android.

How old backup/restore works

  • Previously, backups were only saved in a folder named OBABackups under the Android Documents directory. Users were unable to select a specific location to save backups. Additionally, the restore functionality was disabled until the app could verify whether the backup folder existed. This approach had limitations, such as when a user wanted to transfer a backup to a different phone and restore it without creating a new backup.
  • Users encountered unexpected errors when attempting to update an existing backup, making it possible to back up only once.
  • The functionality was completely broken on Android 13 and above.
  • The application used read and write external storage permissions, which may be a concern for users regarding privacy and security.
  • Backup was disabled if you don't have SD card

New Changes

  • Users can now take backup to any folder of their choice by default we will navigate the user to Documents directory
  • Users can restore backups from any location at any time.
  • Functionality has been tested and works perfectly on Android 7 (Nougat), Android 10, Android 11, Android 13, and Android 14.
  • Removed read and write external storage permissions to address privacy and security concerns.
  • Completely rely on the Android UI file picker to ensure compatibility without requiring additional permissions.
  • Save in local storage or external storage

Main Changes

  • Removed requesting storage permissions
  • Changed logic of the backup functionality

Video

backup.restore.mp4

TODO

  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with gradlew connectedObaGoogleDebugAndroidTest to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them for the initial submission of the pull request. When addressing comments on a pull request, please push a new commit per comment when possible (reviewers will squash and merge using GitHub merge tool)

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! just a couple string updates and this will be ready for merge.

Copy link
Member

@aaronbrethorst aaronbrethorst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@aaronbrethorst aaronbrethorst merged commit eb64e5a into main Sep 10, 2024
2 checks passed
@aaronbrethorst aaronbrethorst deleted the fix-restore-and-save-backup branch September 10, 2024 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Backup Storage Functionality Broken on Android 13 and Above - Storage Permissions
2 participants