Comments (1)
Here is something I did, though I'm very new at programming, I'm sure a better idea can be implemented. Basically I kept the manual backup option that creates the upm.db to sdcard and added an Auto Backup on application exit to aupm.db to sdcard. Restoring is still from upm.db, so if someone wants to restore from the auto backup, all they need to do is rename the file accordingly.
In EnterMasterPassword.java:
@Override
public void onBackPressed()
{
File fileOnSDCard = new File(Environment.getExternalStorageDirectory(), Utilities.AUTOMATIC_DATABASE_FILE);
File databaseFile = Utilities.getDatabaseFile(this);
if (((UPMApplication) getApplication()).copyFile(databaseFile, fileOnSDCard, this)) {
String message = String.format(getString(R.string.backup_complete), fileOnSDCard.getAbsolutePath());
UIUtilities.showToast(this, message, false);
}
System.exit(0);
}
And in Utilities.java:
public static final String AUTOMATIC_DATABASE_FILE = "aupm.db";
public static File getDatabaseFile(Activity activity) {
String dbFileName = getDatabaseFileName(activity);
if (dbFileName == null || dbFileName.equals("")) {
return new File(activity.getFilesDir(), DEFAULT_DATABASE_FILE);
}
/* ADDED FOR AUTOBACKUP */
if (dbFileName == null || dbFileName.equals("")) {
return new File(activity.getFilesDir(), AUTOMATIC_DATABASE_FILE);
} /* END */
else {
return new File(activity.getFilesDir(), dbFileName);
}
}
from upm-android.
Related Issues (20)
- Can't seem to Sync.. HOT 1
- NullPointerException when returning to app HOT 1
- Backup path for database HOT 2
- How to get the UPM database from Linux to Android (Milestone 2) HOT 1
- Feature Request: Tablet Version HOT 4
- Feature Request: Long Press Delete Account on Context Menu HOT 2
- UPM is incorrectly using HTTP post to download the DB file HOT 1
- Should sync on start
- Invalid password message
- UPM closes after password input on Lollipop android 5.1
- forgets license file
- Google drive sync
- Sync with Dropbox doesn't work anymore (possibly due to depreciated api version) HOT 2
- enhancement: add folder structure
- NOT available on play store HOT 9
- Sync with Dropbox stopped working HOT 3
- UPM - Backup HOT 1
- Unable to sync via WebDav (even ver 1.20) HOT 1
- UPM "Problem performing file operation" HOT 1
- http access / sync with version 1.2 doesn't work any more
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from upm-android.