falkolab-version

Android version helper commonjs module for Titanium SDK

Usage no npm install needed!

<script type="module">
  import falkolabVersion from 'https://cdn.skypack.dev/falkolab-version';
</script>

README

Android version helper commonjs module for Titanium SDK

Available on gitTio

Installation

With npm for Node.js and io.js you can easily install it with

$ npm install --save falkolab-version

With gitTio for Titanium SDK you can easily install it with

$ gittio install falkolab-version

To download the module for manual install (e.g. through Appcelerator Studio).

Usage

You can use this module in both Classic or Alloy projects.

Alloy usage

alloy.js

var version = require('com.falkolab.version');
_.extend(Alloy.Globals, version);

In your TSS files:

// API_LEVEL >= 14 (ICE_CREAM_SANDWICH)
"#info[if=Alloy.Globals.isAndroidFrom14]" : {
    ...
}
// API_LEVEL <= 14 (ICE_CREAM_SANDWICH)
"#info[if=Alloy.Globals.isAndroidUpTo14]" : {
    ...
}
// API_LEVEL === 14 (ICE_CREAM_SANDWICH)
"#info[if=Alloy.Globals.ICE_CREAM_SANDWICH]" : {
    ...
}

In view *.xml

<View if="Alloy.Globals.isAndroidUpTo14" />
<View if="Alloy.Globals.ICE_CREAM_SANDWICH" />
...