Working offline – embed data files

Working offline – embed data files

Some files are needed to use the NAO SDK Services in your app:

  • app.json: for general service configuration and geofencing alerts definition. Only one file is required per API Key, no matter the number of NAO Cloud sites covered by this API Key.
  • app.jsonx : This is the encrypted version of app.json file, since V4.11.3 you need to use this file instead of app.json.
  • PDB file(s) (<id_site>.jscx): for services relying on user location. One PDB file per NAO Cloud site covered by the API Key is required for the location to work properly.

You can call synchronizeData() on the service handle (see API documentation) to fetch the latest configuration files from NAO Cloud.

Alternatively, if you don’t want to use the data on NAO Cloud, or do not want to rely on internet connectivity, you can embed those files inside the application. Drag and drop the files in your Xcode project navigator, check the box “Copy items if needed” and verify the presence of the file added in Build Phases -> Copy Bundle Resources.
You can download those files from NAO Cloud, from your site’s dashboard (under Developer > Resources tab).

Since NAO SDK 4.5.0, PDB’s and app.json assets can be embedded on target devices inside a bundle :

  • Create a folder <<FOLDER>> inside your project
  • Copy your app.json or app.jsonx and all PDBs (*.jscx) inside it
  • Rename <<FOLDER>> into <<FOLDER>>.bundle
  • In Xcode, right click on your project (left panel), and click on “Add files to <ProjectName> …
  • Highlight <<FOLDER>>.bundle, make sure every relevant target is checked in “Add to targets” section, then click Add
  • In your target’s Build Phases, the step “Copy bundle Resources” should contain your <<FOLDER>>.bundle.
  • From there, NAO SDK will recursively search for app.json and *.jscx in all embedded bundles. Remember that only one app.json should be embedded.

Keep in mind that the embedded files can still be updated through the synchronizeData() method.

If you are not using the sync feature of the NAO SDK, keep in mind that ALL the files must be available to the NAO SDK BEFORE you start it. The embedded files should ALL be updated in the app after any published change on NAO Cloud (PDB of one of the covered sites, geofences/geonotifications, API Key configuration, iBeacon configuration, …). Doing differently could result in errors, such as an impossibility to get a blue dot or decreased performances.

The recommended call flow is to first call synchronizeData(), then the Services start() method. The NAO SDK will internally detect that a synchronization is ongoing, and update everything automatically. In the event that the synchronization would not go through, but a previous was already downloaded/embedded, the NAO SDK would still be able to run.

    • Related Articles

    • Privacy manifest files

      Privacy manifest files The privacy manifest files from ios 17 feature is add to give app developers full transparency into how the third-party SDKs they work with collect and use data. Therefore, since May 1, 2024, all applications must provide this ...
    • 4. Fetching Data

      Data, including resources and relationships, can be fetched by sending a GET request to an endpoint. The server responds to a successful request to fetch an individual resource or resource collection with a 200 OK response. A 404 Not found will be ...
    • Getting meta-data on tags, zones and alerts

      Tags The meta-data of tags can be retrieved via the REST API. Only users with one of the following roles can access the tracking REST API: Site creator Site admin Tracking manager The API authentication token is used for authentication, it can be ...
    • NAO SDK License

      NAO SOFTWARE DEVELOPMENT KIT LICENSE AGREEMENT Note: By downloading, installing, or using the NAO SDK (“SDK”), you conclude and agree to the terms of this license agreement (the “Agreement”) in a legally binding manner with Pole Star SA. 11 rue ...
    • Release 24.09 (NAOSDK 4.11.17)

      Versions Component Version NAO® Cloud 24.09 NAO® Viewer 24.09 NAO® SDK iOS 4.11.17 NAO® SDK Android 4.11.17 NAO® Logger iOS 4.11.17 NAO® Logger Android 4.11.17 New Features NAO® Cloud Location history: added new controls on the NAO Cloud history ...