Skip to content

Embedding application data

Michał Gasztold edited this page Jul 5, 2017 · 4 revisions

There is an option to embed Indoor Location application data so no internet connection is needed at first launch of the app when mSdk.setNamespace(myNamespaceString, new UbuduResultsListener(){ ... }) is called. To embed the data files, first, developer has to launch freshly installed app with internet connection turned on on the device and call the following method in the success() callback of UbuduResultListener interface:

mSdk.exportApplicationDataToExternalStorage();

After calling this method all the data files fetched from the Ubudu Manager Platform are exported to the external storage of the device (sd card). The data is saved into ubudu_indoor_location directory.

NOTE: To use this feature in your build you need to add the following permission in the manifest:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Otherwise the SDK will not be able to write to external storage to which the indoor location application data files are exported.

The whole folder with the map data files should be moved to your Android Studio project's assets directory:

When the files have been fetched and placed in the app's assets directory, the manifest permission and the mSdk.exportApplicationDataToExternalStorage() method call can be removed from the code. To make Indoor Location SDK use the embedded files the following version of setNamespace method has to be used:

mSdk.setNamespace("1843291458ae318c504ab93bbd2cdd68a2002cde", "ubudu_indoor_location", new UbuduResultListener() {
        @Override
        public void success() {
            // Application data loaded and ready
        }

        @Override
        public void error(String message) {
            // error with message
        }
});

The 2nd parameter of the method above is the String name of the folder that you placed in your app's assets folder.

Clone this wiki locally