Greetings to all supporters and fans of cross-platform mobile application development using the Titanium framework. On April 16, 2012, Appcelerator announced the upgrade of the Titanium Mobile SDK to version 2.0.1, coupled with the update of Titanium Studio, all to the same version 2.0.1. Slightly more details under the cut.
According to the developers from Appcelerator, in addition to fixing more than
700 bugs identified in previous versions, Titanium Mobile SDK 2.0.1 is based on the strengths of the previous version 1.8, and also includes a number of interesting innovations:
- integration with Appcelerator Cloud Services (previously known as CocoaFish);
- changed application markup system;
- a higher degree of cross-platform in the development of applications for Android and iPhone;
- mobile Web (formerly HTML5 platform) release candidate;
- more flexible functionality in geolocation;
- Xcode 4.3 and iOS 5.1 support;
More I would like to dwell on such goodies as integration with the Appcelerator Cloud Service (ACS).
It's no secret that comfortable use of mobile devices involves 2 things:
- Extensive mobile client capabilities, including both general and device-specific functionality.
- Opportunities associated with cloud technologies, allowing the end user to access content without being tied to a device, as well as allowing interaction with devices of other users and access to their local content. Now this is possible with ACS.
Appcelerator Cloud Services provides the developer with a wide range of automatically scaling network capabilities. Tasks such as push notifications, user authorization, user photo management, photo collections, user status acquisition and updating, which usually require server programming or integration with multiple SDKs, are now done through a single
plug-in interface.
')
According to the developers of Titanium, they took care of the stable operation of databases, file storages, search engines and application stacks, so that we can focus on what really matters: our applications and the users of these applications.
Today out of the box are available:
- Push notifications;
- User management (creation, authorization, user information request, etc.);
- Various manipulations with photos of users (uploading to the server, storage, etc.);
- Places (rich location storage);
- Social integration;
- File storage (Beta);
- Check-ins (check-ins);
- User status updates;
- Chat rooms;
- Friends (Beta);
- Ratings and Reviews;
- Discussion forums;
- Event Organization (Beta);
- Messages (Beta);
- Data storage in key-value format;
Currently, features marked as beta are not available from the Titanium.Cloud module, but they can be accessed using the REST API.
In addition, ACS is available to all mobile application developers, regardless of the technology with which these applications are developed. Those. it doesn't matter how we create our application, whether it be Titanium, Objective-C, Java, Sencha Touch or PhoneGap. Any technology that allows making an HTTP request can easily use ACS as a backend server.
In order to use ACS in our application, we need to perform the following four steps:
1) App registration with Appcelerator Cloud Services
If we create a new project in Titanium Studio and at the same time activate the corresponding checkbox - the application in Appcelerator Cloud Services is registered automatically. You can see it on the "
My Apps " page in our account on the
Appcelerator Developer Center . If the checkbox has not been activated, then you can manually register the application later on everything on the same page "
my applications ".
When registering the application, unique OAuth Consumer Key, OAuth Secret and App Key will be generated, which we will need to use in further developing the application.
2) Connecting Appcelerator Cloud Services module
ACS support is built into Titanium. However, in order to use it, we must use the require () directive in any file convenient for us to connect the ACS module to our project:
var Cloud = require('ti.cloud'); Cloud.debug = true;
You also need to not forget about tiapp.xml and make sure that the following directive is there:
<modules> <module platform="commonjs">ti.cloud</module> </modules>
3) Authentication
To ensure the safety of connections and in order to exclude options where someone impersonates us and sends requests to ACS, our application must prove that it has the right to communicate with ACS. Secure access is provided through two-step
OAuth authentication. This is the process by which the Consumer Key and OAuth Secret are used to “sign” each request of our application. When the ACS server receives the request, OAuth Secret is used along with the data presented in the request to calculate the control signature. If the sent and calculated signatures match, the request will be processed.
In order for our application to successfully “introduce itself” to the server, you need to add the following lines to the tiapp.xml file:
<property name="acs-api-key" type="string">get_from_app_admin_page</property> <property name="acs-oauth-key" type="string">get_from_app_admin_page</property> <property name="acs-oauth-secret" type="string">get_from_app_admin_page</property>
4) Directly use the API in the application code
A few examples:
4.1) Creating a user:
Cloud.Users.create({ username: username.value, password: password.value, password_confirmation: confirmPassword.value, first_name: firstName.value, last_name: lastName.value }, function (e) { if (e.success) {
4.2) Photo publishing:
4.3) Connecting FaceBook Login to our application:
On the one hand - some advantages! So far, the only minus found is that the free version of ACS is available only until June 1, 2012. This is also
reported in one of the posts of Appcelerator developers.
The persistent impression is created that the guys from Appcelerator in the field of application development organizations are aggressively chasing the guys from Apple. Judge for yourself: each developer must register if he wants to use Titanium, his own development environment is provided, thanks to which each developed application is fixed and statistics are kept on it, there is a store of modules, etc.
On this, in fact, everything. Thanks for attention.
Sources: