Skip to content

Installation

Minimum Requirements

  • Titanium SDK: 6.2.0+
  • iOS: 9.0+
  • Android: not supported atm

N.B.: Auto update and test devices features will work with Titanium SDK 7.3.0+

Install the module

Using gitTio

gittio install com.nearit.sdk.titanium

Manual installation

  • Get the module com.nearit.sdk.titanium-iphone-<version_number>.zip file here
  • unzip it and place it in the Titanium directory (tipically MacOS:~/Library/Application Support/Titanium, Linux: ~/.titanium/modules, Windows:%ProgramData%\Titanium)

Axway marketplace

You can find the SDK on the marketplace too.


iOS

NearIT API Key

In tiapp.xml add this entries (under <ios><plist><dict> tags)

...
<ios>
...
  <plist>
    <dict>
      ...
      <key>NearIT API Key</key>
      <string>Your.API.Key</string>
      ...
    </dict>
  </plist>
...
</ios>
...

You can find your API key on NearIT web interface, under the "SDK Integration" section.

N.B: We suggests you to ignore the API key from your version control system.

Auto update

To make the SDK periodically check for new content, you have to follow these steps.

First thing to do is to enable the feature background fetch in the tiapp.xml file.

...
<ios>
  ...
  <plist>
    <dict>
      ...
      <key>UIBackgroundModes</key>
      <array>
        <string>fetch</string>
      </array>
      ...
      <dict>
  </plist>
  ...
</ios>

Then in your app set the minimun background fetch interval (2 hours is the recommended value):

Ti.App.iOS.setMinimumBackgroundFetchInterval(7200); // 2 hours

Enable test devices

Go to NearIT web interface, navigate to "Settings > Test devices" and follow instructions to enable this feature. The snippet provided by the web interface must be placed in your tiapp.xml:

...
<ios>
...
  <plist>
    <dict>
      ...
      <key>CFBundleURLTypes</key>
      <array>
        <dict>
          <key>CFBundleTypeRole</key>
          <string>Editor</string>
          <key>CFBundleURLSchemes</key>
          <array>
            <string>Your.URL.Scheme</string>
          </array>
        </dict>
      </array>
      ...
    <dict>
  </plist>
...
</ios>

In the same section, you can send invite links to mail addresses. If users have the app installed, they can click the link on their smart-phone to be prompted with a request to enroll their device among the testers.


Usage

To interact with NearIT SDK from your AppCelerator Titanium code, import the module:

var NearIT = require('com.nearit.sdk.titanium');