Here are the examples of the java api class android.app.backup.BackupManager taken from open source projects.
1. FirstStartActivity#requestBackup()
Project: frisbee
File: FirstStartActivity.java
File: FirstStartActivity.java
private void requestBackup() { BackupManager bm = new BackupManager(this); bm.dataChanged(); }
2. BackupUtils8#dataChanged()
Project: CSipSimple
File: BackupUtils8.java
File: BackupUtils8.java
/* (non-Javadoc) * @see com.csipsimple.utils.backup.BackupWrapper#onDataChanged() */ @Override public void dataChanged() { BackupManager bmgr = new BackupManager(context); bmgr.dataChanged(); }
3. MyUtil#requestBackup()
Project: Clip-Stack
File: MyUtil.java
File: MyUtil.java
public static void requestBackup(Context context) { Log.d(MyUtil.PACKAGE_NAME, "requestBackup"); BackupManager backupManager = new BackupManager(context); backupManager.dataChanged(); }
4. TestResultsProvider#onCreate()
Project: CtsVerifier
File: TestResultsProvider.java
File: TestResultsProvider.java
@Override public boolean onCreate() { mOpenHelper = new TestResultsOpenHelper(getContext()); mBackupManager = new BackupManager(getContext()); return false; }
5. BrowserProvider#onCreate()
Project: coursera-android
File: BrowserProvider.java
File: BrowserProvider.java
@Override public boolean onCreate() { final Context context = getContext(); boolean xlargeScreenSize = (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) == Configuration.SCREENLAYOUT_SIZE_XLARGE; boolean isPortrait = (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT); if (xlargeScreenSize && isPortrait) { mMaxSuggestionLongSize = MAX_SUGGEST_LONG_LARGE; mMaxSuggestionShortSize = MAX_SUGGEST_SHORT_LARGE; } else { mMaxSuggestionLongSize = MAX_SUGGEST_LONG_SMALL; mMaxSuggestionShortSize = MAX_SUGGEST_SHORT_SMALL; } mOpenHelper = new DatabaseHelper(context); mBackupManager = new BackupManager(context); // version 18 and 19 as in the other cases, we will erase the table. if (DATABASE_VERSION == 18 || DATABASE_VERSION == 19) { SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(context); boolean fix = p.getBoolean("fix_picasa", true); if (fix) { fixPicasaBookmark(); Editor ed = p.edit(); ed.putBoolean("fix_picasa", false); ed.apply(); } } mSettings = BrowserSettings.getInstance(); return true; }
6. ApplicationState#onCreate()
Project: bitcoin-android
File: ApplicationState.java
File: ApplicationState.java
@Override public void onCreate() { Log.d("Wallet", "Starting app"); ApplicationState.current = (ApplicationState) this; backupManager = new BackupManager(this); // read or create wallet synchronized (ApplicationState.walletFileLock) { keychainFile = new File(getFilesDir(), filePrefix + ".keychain"); walletFile = new File(getFilesDir(), filePrefix + ".wallet"); try { //throw new RuntimeException("asd"); wallet = Wallet.loadFromFile(walletFile); Log.d("Wallet", "Found wallet file to load"); } catch (Exception e) { e.printStackTrace(); wallet = new Wallet(params); Log.d("Wallet", "Created new wallet...now attempting to reset prior keys"); try { ObjectInputStream ois = new ObjectInputStream(new FileInputStream(keychainFile)); @SuppressWarnings("unchecked") ArrayList<ECKey> keys = (ArrayList<ECKey>) ois.readObject(); for (ECKey key : keys) { wallet.keychain.add(key); } walletShouldBeRebuilt = true; } catch (Exception e2) { Log.d("Wallet", "No prior keys found, a brand new wallet!"); wallet.keychain.add(new ECKey()); } saveWallet(); } catch (StackOverflowError e) { e.printStackTrace(); } } if (TEST_MODE) { peerDiscovery = new IrcDiscovery("#bitcoinTEST"); } else { peerDiscovery = new DnsDiscovery(params); } Log.d("Wallet", "Reading block store from disk"); try { File file = new File(getExternalFilesDir(null), filePrefix + ".blockchain"); if (!file.exists()) { Log.d("Wallet", "Copying initial blockchain from assets folder"); InputStream is = null; try { is = getAssets().open(filePrefix + ".blockchain"); IOUtils.copy(is, new FileOutputStream(file)); } catch (IOException e) { Log.d("Wallet", "Couldn't find initial blockchain in assets folder...starting from scratch"); } finally { if (is != null) { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } } } blockStore = new BoundedOverheadBlockStore(params, file); blockChain = new BlockChain(params, wallet, blockStore); } catch (BlockStoreException bse) { throw new Error("Couldn't store block."); } }