Skip to end of metadata
Go to start of metadata
Actions

Requirements

The examples in this page use the Prototype library, which is included by default inside the a portal. However, the same concepts may be applied using other implementations.

Invocation

This command executes asynchronously.

Description

This Mobile SDK commands retrieves information regarding the installed Android and iOS.
The Studio compares the detected SDKs to a set of pre-required versions we have online, and returns a JSON response that contains detailed information about the installed items, the missing ones, and the items that needs to be updated.
The Mobile SDK command handler can also trigger a download and install process for Android, as well as an Android SDK update.

SDK Info Command

The following sample triggers a request for an SDK info. The 'sdk' variable can accept android and ios strings.

When triggered, the Studio will perform the required checks and will later on send a notification to the portal by calling a JavaScript function eventsDispatcher.notify() and passing an event JSON into it.

The portal should handle this by defining an eventsDispatcher object that has a notify function that accepts an argument.
For example (taken from the studio3-sdk repository):

The example above calls portal.sdks.update(e); whenever the Studio fires a mobileSDK event. The update function than handles the event by reading the JSON content from it and re-render the UI.

The event that the Studio sends contains these fields:

key

content

response

The event type. In this case, the studio is 'responding' an SDK-info request.

data

The JSON data that the Studio collected. This data holds the actual SDK info (see)

data.sdkName

An 'sdkName' field inside the sdk-data. This field allows the JS part to determine the SDK type that this response is referring to.

data.sdkInfo

The data JSON that the Studio collected for the SDK-Info request. That data may be later sent to be rendered on the UI

Reading the SDK-Info

The SDK-info JSON object holds the following information:

key

content

restrictions

installedPlatform

An array of the installed SDK platform versions (Android/iOS

None

requiredPlatform

An array of required SDK platform versions

None

sdkURL

A URL for the SDK (An installer URL for Android, or an iOS installation page

None

errorInfo

An optional key that holds additional error information that should be displayed

None

shouldUpdatePlatform

A boolean value that indicates that an update/install is needed (based on version comparison of the items above)

Android Only

installedPlatformTools

Android installed 'Platform Tools' version

Android Only

requiredPlatformTools

Android required 'Platform tools' version

Android Only

shouldUpdatePlatformTools

A boolean value that indicates that an update/install is needed for the Android 'Platform Tools'

Android Only

installedSDKTools

Android installed 'SDK Tools' version

Android Only

requiredSDKTools

Android required 'Platform Tools' version

Android Only

shouldUpdateSDKTools

A boolean value that indicates that an update/install is needed for the Android 'SDK Tools'

Android Only

installedAddOns

An array of installed Android 'Add-Ons'

Android Only

requiredAddOns

An array of required Android 'Add-Ons'

Android Only

shouldUpdateAddOns

A boolean value that indicates that an update/install is needed for the Android 'Add-Ons'

Android Only

installedAPILevels

An array of API-levels for the installed Android platforms

Android Only, TiStud 2.0.2+

requiredAPILevels

An array of Android API-levels required by all of the installed Titanium SDK versions

Android Only, TiStud 2.0.2+

shouldUpdateAPILevels

A boolean value that indicates that an update/install is needed for the Android platforms (API-levels)

Android Only, TiStud 2.0.2+

hasJavaHome

A boolean value that indicates that the system environment contains a JAVA_HOME setting

Android Only

hasJDK

A boolean value that indicates that the system has a valid JDK installed

Android Only

jdkURL

A JDK installer URL

Android Only

Example (from the studio3_sdk repository):

Trigger an Install/Update

To trigger an SDK installation or Update, all that needs to be done is to call the installOrUpdateSDK action, and passing the SDK type as an argument.
For Example:

For the Android installer, you may choose to force the installer UI even when the installed SDK matches the requirements. You do so by passing 'true' as a second command argument.

(The example in the sections above shows the integration of this code when observing the link click event)

Trigger a SDK refresh

To trigger a 'manual' refresh for a specific SDK, all that needs to be done is to call the refreshSDK action, and passing the SDK type as an argument.
For Example:

MobileWeb Browser Check

The getSDKInfo call, when called with a 'MobileWeb' argument, will perform a Browser check and will return a data set that contains information about the required and the detected browsers.
The call will compare the browsers that are set in the Studio's preferences to the browsers and versions required by the MobileWeb. When a mismatch is detected, the Studio will run a detection process that will update the preferences. After that detection, another check is made before returning a JSON response to the caller.

key

content

restrictions

installedBrowsers

An array of the installed browsers versions

None

requiredBrowsers

An array of required browsers versions (read from the sdk_info.json)

None

shouldUpdateBrowsers

A boolean value that indicates that an update/install is needed (based on version comparison of the items above)

None

Note

This action is synchronous, and the returned value will include all the available SDK versions that were detected after refreshing the specified SDK loader.

Usage example: When installing an iOS SDK, a user might want to hit the refresh link to check if the SDK was detected by the Studio after the installation.