Top
Whatfix Mobile Offline Support
  • 28 Oct 2022
  • 1 Minute To Read
  • Dark
    Light
  • PDF

Whatfix Mobile Offline Support

  • Dark
    Light
  • PDF

Article Summary

Offline mobile applications enable users to access the mobile apps without internet. Some examples of offline apps are Amazon Kindle, Google Drive.
While the mentioned apps work offline, the content that is accessible inside them has to be downloaded when online. Your app is most likely to work in a similar way.

Offline support using the default publish feature

If you are publishing your Projects directly using the in-built targeting features, Whatfix Mobile provides offline support by default.

your title goes here

Your users need to go online at least once so that the in-app experience you want to deliver is downloaded on their device for them.

Offline support using Project ID

Since the projects published with Project IDs are triggered from your codebase, we recommend that you explicitly sync the projects whenever a connection is present (ideally during the start of the app). This ensures the availability of the entire experience on your end users' device while they're offline.

To sync the offline projects at the start of the app, add the following code snippet at the start of the app,

Android

List<String> offlineSyncList = new ArrayList<>();
offlineSyncList.add("PROJECT_ID_1");
offlineSyncList.add("PROJECT_ID_2");
Leap.offlineSync(offlineSyncList);

Swift

var offlineSyncList:[String] = []
offlineSyncList.append("PROJECT_ID_1")
offlineSyncList.append("PROJECT_ID_2")
Leap.shared.offlineSync(offlineSyncList)

Objective-C

NSMutableArray<NSString *> *offlineSyncList = [[NSMutableArray alloc] init];
[offlineSyncList addObject:@"PROJECT_ID_1"];
[offlineSyncList addObject:@"PROJECT_ID_2"];
[[Leap shared] offlineSync:offlineSyncList];

React Native

let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
LeapReactNative.offlineSync(projectIDs);

Ionic

let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
LeapPlugins.offlineSync({projectIDs:projectIds});

Cordova (Android)

let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
cordova.plugin.LeapAndroid.offlineSync(projectIDs);

Cordova (iOS)

let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
cordova.plugin.LeapiOS.offlineSync(projectIDs);

Xamarin Android

string[] projectIds = {"PROJECT_ID_1","PROJECT_ID_2"};
Leap.OfflineSync(projectIds);

Xamarin iOS

string[] projectIds = {"PROJECT_ID_1", "PROJECT_ID_2" };
Leap.Shared.OfflineSync(projectIds);

Once the projects are synced, you can start the project using the following code snippet,

Android

Leap.embedProject("PROJECT_ID_1");

Swift

Leap.shared.embedProject("PROJECT_ID_1");

Objective-C

[[Leap shared] embedProject:@"PROJECT_ID_1"];

React Native

LeapReactNative.embedProject('PROJECT_ID_1');

Ionic

LeapPlugin.embedProject({projectId:"<GENERATED_PROJECT_ID>"});

Cordova (Android)

cordova.plugin.LeapAndroid.embedProject('PROJECT_ID_1');

Cordova (iOS)

cordova.plugin.LeapiOS.embedProject('PROJECT_ID_1');

Xamarin Android

Leap.EmbedProject("PROJECT_ID_1");

Xamarin iOS

Leap.Shared.EmbedProject("PROJECT_ID_1");

Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.