Publish Whatfix Content
Whatfix Mobile Offline Support
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
Android
JavaJavaJava
List<String> offlineSyncList = new ArrayList<>();
offlineSyncList.add("PROJECT_ID_1");
offlineSyncList.add("PROJECT_ID_2");
Leap.offlineSync(offlineSyncList);Swift
Swift
SwiftSwiftSwift
var offlineSyncList:[String] = []
offlineSyncList.append("PROJECT_ID_1")
offlineSyncList.append("PROJECT_ID_2")
Leap.shared.offlineSync(offlineSyncList)Objective-C
Objective-C
Objective-CObjective-CObjective-C
NSMutableArray<NSString *> *offlineSyncList = [[NSMutableArray alloc] init];
[offlineSyncList addObject:@"PROJECT_ID_1"];
[offlineSyncList addObject:@"PROJECT_ID_2"];
[[Leap shared] offlineSync:offlineSyncList];React Native
React Native
JavaScriptJavaScriptJavaScript
let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
LeapReactNative.offlineSync(projectIDs);Ionic
Ionic
JavaScriptJavaScriptJavaScript
let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
LeapPlugins.offlineSync({projectIDs:projectIds});Cordova (Android)
Cordova (Android)
JavaScriptJavaScriptJavaScript
let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
cordova.plugin.LeapAndroid.offlineSync(projectIDs);Cordova (iOS)
Cordova (iOS)
JavaScriptJavaScriptJavaScript
let projectIDs = ['PROJECT_ID_1', 'PROJECT_ID_2'];
cordova.plugin.LeapiOS.offlineSync(projectIDs);Xamarin Android
Xamarin Android
JavaScriptJavaScriptJavaScript
string[] projectIds = {"PROJECT_ID_1","PROJECT_ID_2"};
Leap.OfflineSync(projectIds);Xamarin iOS
Xamarin iOS
JavaScriptJavaScriptJavaScript
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
Android
JavaJavaJava
Leap.embedProject("PROJECT_ID_1");Swift
Swift
SwiftSwiftSwift
Leap.shared.embedProject("PROJECT_ID_1");Objective-C
Objective-C
Objective-CObjective-CObjective-C
[[Leap shared] embedProject:@"PROJECT_ID_1"];React Native
React Native
JavaScriptJavaScriptJavaScript
LeapReactNative.embedProject('PROJECT_ID_1');Ionic
Ionic
JavaScriptJavaScriptJavaScript
LeapPlugin.embedProject({projectId:"<GENERATED_PROJECT_ID>"});Cordova (Android)
Cordova (Android)
JavaScriptJavaScriptJavaScript
cordova.plugin.LeapAndroid.embedProject('PROJECT_ID_1');Cordova (iOS)
Cordova (iOS)
JavaScriptJavaScriptJavaScript
cordova.plugin.LeapiOS.embedProject('PROJECT_ID_1');Xamarin Android
Xamarin Android
JavaScriptJavaScriptJavaScript
Leap.EmbedProject("PROJECT_ID_1");Xamarin iOS
Xamarin iOS
JavaScriptJavaScriptJavaScript
Leap.Shared.EmbedProject("PROJECT_ID_1");