All 3rd party modules that target Titanium Mobile 220.127.116.11 (and above) will need to have a new property in the module manifest,
apiversion, with a value of
If you create a new 3rd party module with Titanium Mobile 18.104.22.168, this property is automatically generated for your project. If you have an existing 3rd party module, you need to manually add this property to your manifest, and make sure you rebuild your module (see Build changes below for the NDK requirement):
To accomodate the new V8 runtime, all 3rd party modules now require the Android NDK and gperf for building V8 bindings. Download and extract the latest NDK from Google here:
To build your module, you need to set the
ANDROID_NDK environment variable:
Alternatively, you can set the
android.ndk property in
gperf command must also be installed and in your system path. The
gperf command is installed as part of the Xcode development tools on OS X, but you may need to install it if you are developing on Windows. See: Installing gperf for more information.
You also need to update your build.properties file (and .classpath file if you are using Eclipse) to reference Titanium Mobile 22.214.171.124 and API level 8 or newer:
TiContextis being replaced, and any implementation utilizing TiContext will take a performance / stability hit compared to using the desired API's directly.
- In most of the places where
TiContextis used as an argument, the
TiContextargument can be removed entirely or replaced with an
In the specific case of
fromUrl, the following form can also be used:
The specific alternative varies based on which API point is being modified, but generally there is a very simple alternative that can be used.
KrollFunction instead of
KrollFunctionhas been added, and
KrollCallbackhas been removed; The dual runtime change required a common interface to be defined to replace
- In most cases, a direct replacement of
Known compatibility points that need to be changed:
KrollInvocation as a method argment.
TiContext from your module constructor.
super(TiContext) will no longer work due to the previously mentioned
TiContext change. In most if not all cases, simply removing the argument will address the problem.
3. When replacing
KrollFunction, you need to to pass a
KrollObject argument to the
getView() on a
TiDrawableReference.fromUrl(proxy.getTiContext(), tiImage) to
TiDrawableReference.fromUrl(proxy.getActivity(), tiImage) due to the
TiContext change. Same applies to all the "from<source>" methods in
<KrollInvocation>.getActivity() no longer exists. getActivity can be called on each proxy to get the activity for that proxy or
TiApplication.getAppRootActivity() can be used for getting activity instances to work with. In general, system services, etc., can and should use the root activity if it exists.
TiApplication.getRootOrCurrentActivity() will serve this purpose in the vast majority of situations.
addOnLifeCycleEvent on a module is no longer necessary. Modules are now automatically registered to receive the lifecycle events (
<KrollEventManager>.addOnEventChangeListener() is no longer supported. The new mechanism for this is to override
KrollProxy.eventListenerAdded, and move the code from the
listenerAdded method into the overridden
eventListenerAdded method after the call to
resolveUrl has been moved to the proxy object.
getModuleByName and specify the module name in the module constructor. By default the module cannot be found by calling
getModuleByName. You must use the form of
super() in the module constructor that allows you to specify the module name.
<TiContext>.getAndroidContext() no longer exists. If the
ContextWrapper returned originally is being used to access system or app level resources, use
TiApplication.getInstance().getApplicationContext() instead. To get the
ContextWrapper for the top most
getContext() on a
TiProxy no longer exists because its purpose was to return a
TiContext instance. This call should no longer be needed in module implementation once
TiContext is no longer being passed in as an argument (the normal use case for this method).
13. Remove context from
getChangeDir is now called on the
15. Overriding the
fireEvent method requires a change to the method signature. The argument has changed from a
KrollDict class to an
<KrollInvocation>.getTiContext() no longer exists.
TiContext is no longer needed. Some examples show this being used to get the
TiApplication.getInstance() can be used instead.
17. Change usage of
KrollDict in method signatures to
HashMap. Dictionary values are now passed to methods as
HashMap objects. If you need to access any of the
KrollDict methods on the
HashMap object you can create a
KrollDict object from the
runOnUiThread is no longer supported. You must explicitly manage and call your methods on the UI thread where necessary. Specifically, you can use the
TiMessenger class to run code on the UI thread.