Class MAMDefaultBackupAgent

  • All Implemented Interfaces:
    com.microsoft.intune.mam.client.app.HookedContextWrapper , com.microsoft.intune.mam.client.app.backup.HookedBackupAgent

    
    public class MAMDefaultBackupAgent
    extends MAMBackupAgent
                        

    This class serves as a default backup agent for apps targeting API 23+ who want to have automatic, policy compliant, full back ups with or without an XML configuration file. To use this backup agent, in the <application> tag place the following attribute: android:backupAgent="com.microsoft.intune.mam.client.app.backup.MAMDefaultBackupAgent".

    If you want to define your own backup agent for full backups and the traditional key/value backups, please extend MAMBackupAgent. MAMBackupAgentHelper also provides a simpler means of backing up your app's data.

    If you want your app to backup according to a configuration file, please provide a resource under the com.microsoft.intune.mam.FullBackupContent metadata tag in your manifest like so:

    <meta-data android:name="com.microsoft.intune.mam.FullBackupContent" android:resource="@xml/my_scheme" /> and in the <application> tag place the following attribute: android:fullBackupContent="@xml/my_scheme"

    Where my_scheme is an XML resource in your app.

    If you want to have a complete full backup without any exclusions, provide a tag like so:

    <meta-data android:name="com.microsoft.intune.mam.FullBackupContent" android:value="true" /> and in the <application> tag place the following attribute: android:fullBackupContent="true"

    If you don't want automatic, policy compliant full backups at all but instead want back ups to occur according to your backup agent you shouldn't use this default backup agent in the android:backupAgent and you should provide a tag like so:

    <meta-data android:name="com.microsoft.intune.mam.FullBackupContent" android:value="false" /> and in the <application> tag place the following attribute: android:fullBackupContent="false"

    Please note that if you don't provide the attribute android:fullBackupContent or <meta-data android:name="com.microsoft.intune.mam.FullBackupContent"/> with any of the previously mentioned configurations in your manifest, your app will have automatic, policy compliant, full backups of all the files in your app.

    Please see Android's auto backup guide for more details about the XML configuration file and about automatic backups in Android.

    • Constructor Detail

      • MAMDefaultBackupAgent

        MAMDefaultBackupAgent()
    • Method Detail

      • onMAMBackup

         void onMAMBackup(ParcelFileDescriptor oldState, BackupDataOutput data, ParcelFileDescriptor newState)

        Handle onBackup invocation.

        Parameters:
        oldState - An open, read-only ParcelFileDescriptor pointing to the last backup state provided by the application.
        data - A structured wrapper around an open, read/write file descriptor pointing to the backup data destination.
        newState - An open, read/write ParcelFileDescriptor pointing to an empty file.
      • onMAMRestore

         void onMAMRestore(MAMBackupDataInput data, int appVersionCode, ParcelFileDescriptor newState)

        Handle onRestore invocation.

        Parameters:
        data - A structured wrapper around an open, read-only file descriptor pointing to a full snapshot of the application's data.
        appVersionCode - The value of the android:versionCode manifest attribute, from the application that backed up this particular data set.
        newState - An open, read/write ParcelFileDescriptor pointing to an empty file.