Mobile SDKs

Locomote.sh provides low-profile SDKs for iOS and Android. The SDKs are easily configured, and completely automate the process of downloading content updates from the server. They then provide a variety of methods for accessing and working with data, some of which are based on standard APIs for accessing content on each platform.

Configuration

The SDKs require minimal setup to use. Once installed, a single line of code, called at app startup, tells the SDK what content repository to download content from. The SDK can connect to multiple repositories if needed.

Content URIs

The Locomote SDKs use content: URIs as a standard mechanism for accessing published content. Content URIs are a standard part of the Android ecosystem, and the Android SDK provides a content provider implementation which enables Locomote content to be loaded by URI.

On iOS, the Locomote SDK provides a content URL implementation which provides a lot of the same functionality as the content provider on Android.

The advantage of this approach is that it is very easy to reference published content in a consistent, cross-platform manner, using standard URL based methods for loading data on each platform. For example, published web content can be displayed on either platform by instantiating a native web view and configuring it to load the appropriate content: URI.

iOS

The iOS SDK is hosted on GitHub at https://github.com/innerfunction/Locomote-ios.

Initialization

Prepare an app to use content from a repository by adding a repository configuration and starting the Locomote container:

#import "Locomote.h"
...
[Locomote addRepository:@"<account>/<repo>"];
[Locomote start];

NSBundle

The Locomote container provides an NSBundle instance that can be used as a replacement for [NSbundle mainBundle]:

NSBundle *bundle = [Locomote bundle];

This bundle can be used to load images, HTML files and other assets that have been published through Locomote (including published content that has been packaged with the app using the download tool), and the bundle can also be used to load other assets which are packaged with the app but not published through Locomote (i.e. assets provided by the main bundle). If the bundle is used to load NIB and storyboard files then those layouts will be able to use image assets which have been published through Locomote.

UIImage

The SDK provides a UIImage class category providing a method for loading images which have been published through Locomote:

#import "Locomote.h"
...
UIImage *image = [UIImage locomoteImageWithPath:@"<account>/<repo>/image/path.png"];

API

[TODO]

Android

Content provider

Resources

API