Top
Whatfix Mobile Offline Support
  • 20 Jun 2024
  • 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

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

Swift

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

Objective-C

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

React Native

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

Ionic

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

Cordova (Android)

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

Cordova (iOS)

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

Xamarin Android

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

Xamarin iOS

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

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

Android

JavaJava
Leap.embedProject("PROJECT_ID_1");

Swift

SwiftSwift
Leap.shared.embedProject("PROJECT_ID_1");

Objective-C

Objective-CObjective-C
[[Leap shared] embedProject:@"PROJECT_ID_1"];

React Native

JavaScriptJavaScript
LeapReactNative.embedProject('PROJECT_ID_1');

Ionic

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

Cordova (Android)

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

Cordova (iOS)

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

Xamarin Android

JavaScriptJavaScript
Leap.EmbedProject("PROJECT_ID_1");

Xamarin iOS

JavaScriptJavaScript
Leap.Shared.EmbedProject("PROJECT_ID_1");

Was this article helpful?

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.