Implementing Smart Offline Handoff to your app on Appdome fast

Mobile TOTALData Encryption is used to protect data stored within a mobile app. Smart Offline Handling is an extension to Appdome TOTALData Encryption, which allows developers of apps that require authentication to enable non-authenticated access to some of the files that the app generates.

This Knowledge Base article describes Appdome’s Smart Offline Handoff feature and explains how to add it to any mobile app as part of a comprehensive mobile Data Loss Prevention (DLP) solution.

We hope you find this knowledge base useful and enjoy using Appdome!

About Smart offline handoff  on Appdome

Appdome is a mobile integration platform as a service (iPaaS) that allows users to add a wide variety of features, SDKs, and APIs to Android and iOS apps. Using a simple ‘click to add’ user interface, Appdome allows anyone to easily implement Smart Offline Handoff in any mobile app – instantly, no code or coding required.

Using Appdome, there are no development or coding prerequisites. For example, there is no Appdome SDK, libraries, or plug-ins to implement. Likewise, there is no requirement to implement encryption libraries or intercept all writing of files to the sandbox for developing Secure TOTALData Encryption Container and Smart Offline Handoff iOS apps. Using Appdome, mobile apps will have Smart Offline data Handoff capabilities as if they were natively coded into the app – all without writing or changing a single line of code.

Some developers want to enable access to the app’s data only after authentication with a remote server and limit the offline access to the data to a certain time-frame or additional authentication, in addition to the encryption of the app’s data for other processes. When Appdome TOTALDataTM Encryption is enabled, all stored data generated by the app (including media files) is encrypted at run-time using industry-standard AES 256  cryptographic protocols. When Appdome Smart Offline Handoff is enabled, Appdome will decrypt the app’s data only after authentication with a remote server. Additionally, the developer can specify a folder for offline file access, along with the required conditions that must be met for offline access to that folder (for example the required conditions may include a time expiration, or require additional authentication, such as Pincode / biometric authentication). 

Prerequisites for using Appdome’s Smart Offline Handoff 

Adding Appdome Smart Offline Handoff to your app also requires Appdome DEV-Events ™, to be enabled in your code. The DEV-Events will inform Appdome on when and how to enable offline access to the app’s files.

Appdome DEV-Events Structure

Each Appdome DEV-Event is a set of key/value dictionary. Both key and value are strings: Java Strings, for Android App and NSString for iOS Apps.

EventIDEvent Fields
OfflineFolderAccessed
  • timestamp – the UNIX epoch timestamp of the event
  • action – which action took place:
    • expired – offline key has expired
    • noSecret – user tried to access a file in the offline folder without providing offline secret
    • accessNoLocalAuth – the user was granted access with saved secret without local authentication
    • pincode – the user was granted access with local authentication by Pincode

iOS

How to enable Appdome’s offline access to the app’s files: 

    NSString* onlineToken = @“myonlinetoken";

    NSString* offlineToken = @“myofflinetoken";

    NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];

    [userInfo setObject: onlineToken forKey: @"onlineSecret"];

    [userInfo setObject: offlineToken forKey: @"offlineSecret"];

How to Follow and Receive Appdome DEV-Events: 

    [[NSNotificationCenter defaultCenter] postNotificationName:@"AppdomeOfflineSetProfile" object:nil userInfo: userInfo]; 
[[NSNotificationCenter defaultCenter] addObserverForName: @"OfflineFolderAccessed" object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *note) {
        NSString *action = [[note userInfo] objectForKey:@"action"]; // expired, noSecret, accessNoLocalAuth or accessPincode
        NSString *timestamp = [[note userInfo] objectForKey:@"timestamp"]; // UNIX timestamp when event happened
    }];

Android

How to enable Appdome’s offline access to the app’s files: 

    Intent intent = new Intent("AppdomeOfflineSetProfileEvent");

    Bundle bundle = new Bundle();

    bundle.putString("onlineSecret", "myonlinetoken");

    bundle.putString("offlineSecret", "myofflinetoken");

    intent.putExtras(bundle);

    sendBroadcast(intent);

How to Follow and Receive Appdome DEV-Events: 


private final static String OFFLINE_FOLDER = "OfflineFolderAccessed";
private BroadcastReceiver reciever;
private Context context;

public void init(Context context) {
    this.context = context;
    reciever = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
           onEvent(intent);
        }
    };
    context.registerReceiver(reciever, new IntentFilter(OFFLINE_FOLDER));
}

public void stop() {
    context.unregisterReceiver(reciever);
}

private void onEvent(Intent intent) {
    String action = intent.getAction();
    switch (action) {
       case OFFLINE_FOLDER:
           if(!intent.hasExtra("action") ) {
               Log.e(TAG, "illegal event recieved.");
               return;
           }
          String offlineFolderAction = intent.getStringExtra("action"); // expired, noSecret, accessNoLocalAuth or accessPincode
    default:
          Log.e(TAG, "unknown event recieved " + action);
   }
}

How to Add Smart Offline Handoff to Any Mobile App on Appdome

Follow these step-by-step instructions to add Smart Offline Handoff to Any Mobile App.

Upload a Mobile App to Your Account

Please follow these steps to add a mobile app to your Appdome account.
If you don’t have an Appdome account, click here to create an account.

From the “Build” tab, select the Security menu

  1. Click on TOTALData Encryption to expend the bundle.
  2. Click on the toggle to enable Data at Rest Encryption
  3. Click on Encryption Management to expend the sub-bundle.
  4. Click on the toggle to enable Smart Offline Handoff
  5. Specify a Designated Folder into which data will be saved for offline access. on android, this folder will be created on both
    /data/data/<app-bundle-id>/files and on /sdcard/Android/data/<app-bundle-id>/files.
    on ios  the folder will be created under
    /var/mobile/containers/data/applications/bundle-id
  6. optional – specify the Session Timeout, an expiration time-frame for offline access (in days – 0 means no expiration time), or toggle the Require Local Authentication switch to require the device Authentication for offline access
  7. add additional features you want to integrate to your app, when done – click Build my app.

The technology behind Build My App has two major elements – (1) a microservice architecture filled with 1000s of code sets needed for mobile integrations, and (2) an adaptive code generation engine that can recognize the development environment, frameworks and methods in each app and match the app to the relevant code-sets needed to add Smart Offline Handoff feature to the mobile app in seconds.
Congratulations! You now have a mobile app fully integrated with Smart Offline Handoff.

After Adding Smart Offline Handoff to a Mobile App on Appdome

After you have added Smart Offline Handoff to any Mobile App on Appdome, there are a few additional steps needed to complete your mobile integration project.

Read this Knowledge Base article to learn what to do after you successfully Build an app. It explains both optional steps and required steps.

That is it – Enjoy Appdome with Smart Offline Handoff in your app!

How Do I Learn More?

Check out Appdome’s Mobile App Security Suite or request a demo at any time.

If you have any questions, please send them our way at support@appdome.com or via the chat window on the Appdome platform.

Thank you!

Thanks for visiting Appdome! Our mission is to make mobile integration easy. We hope we’re living up to the mission with your project. If you don’t already have an account, you can sign up for free.

Liron Dror

Have a question?

Ask an expert

PaulMaking your security project a success!