- 20 Jun 2024
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
Whatfix Mobile Offline Support
- Updated On 20 Jun 2024
- 1 Minute To Read
-
Print
-
DarkLight
-
PDF
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 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, 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");