IT. Expert System.

Android Reference

BackupAgentHelper


android.app.backup

Class BackupAgentHelper



  • public class BackupAgentHelper
    extends BackupAgent
    A convenient BackupAgent wrapper class that automatically manages heterogeneous data sets within the backup data, each identified by a unique key prefix. When processing a backup or restore operation, the BackupAgentHelper dispatches to one or more installed BackupHelper objects, each of which is responsible for a defined subset of the data being processed.

    An application will typically extend this class in its own backup agent. Then, within the agent's onCreate() method, it will call addHelper() one or more times to install the handlers for each kind of data it wishes to manage within its backups.

    The Android framework currently provides two predefined BackupHelper classes:

    An application can also implement its own helper classes to work within the BackupAgentHelper framework. See the BackupHelper interface documentation for details.

    Developer Guides

    For more information about using BackupAgentHelper, read the Data Backup developer guide.

    See Also:
    BackupHelper, FileBackupHelper, SharedPreferencesBackupHelper
    • Constructor Detail

      • BackupAgentHelper

        public BackupAgentHelper()
    • Method Detail

      • onBackup

        public void onBackup(ParcelFileDescriptor oldState,
                    BackupDataOutput data,
                    ParcelFileDescriptor newState)
                      throws IOException
        Run the backup process on each of the configured handlers.
        Specified by:
        onBackup in class BackupAgent
        Parameters:
        oldState - An open, read-only ParcelFileDescriptor pointing to the last backup state provided by the application. May be null, in which case no prior state is being provided and the application should perform a full backup.
        data - A structured wrapper around an open, read/write file descriptor pointing to the backup data destination. Typically the application will use backup helper classes to write to this file.
        newState - An open, read/write ParcelFileDescriptor pointing to an empty file. The application should record the final backup state here after writing the requested data to the data output stream.
        Throws:
        IOException
      • onRestore

        public void onRestore(BackupDataInput data,
                     int appVersionCode,
                     ParcelFileDescriptor newState)
                       throws IOException
        Run the restore process on each of the configured handlers.
        Specified by:
        onRestore in class BackupAgent
        Parameters:
        data - A structured wrapper around an open, read-only file descriptor pointing to a full snapshot of the application's data. The application should consume every entity represented in this data stream.
        appVersionCode - The value of the android:versionCode manifest attribute, from the application that backed up this particular data set. This makes it possible for an application's agent to distinguish among any possible older data versions when asked to perform the restore operation.
        newState - An open, read/write ParcelFileDescriptor pointing to an empty file. The application should record the final backup state here after restoring its data from the data stream. When a full-backup dataset is being restored, this will be null.
        Throws:
        IOException
      • addHelper

        public void addHelper(String keyPrefix,
                     BackupHelper helper)
        Add a helper for a given data subset to the agent's configuration. Each helper must have a prefix string that is unique within this backup agent's set of helpers.
        Parameters:
        keyPrefix - A string used to disambiguate the various helpers within this agent
        helper - A backup/restore helper object to be invoked during backup and restore operations.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 577 / 158800338. Delta: 0.10642 с