📜 ⬆️ ⬇️

Features of development for Android on Titanium

image

The other day I released my first Android program written on Titanium Appcelerator and I want to share some of the nuances associated with the development specifically for Android.

The overall process is quite well described in the official documentation, so I will omit it.

Special, non-default options in tiapp.xml:


1. If your program shows network activity when it starts up - under the emulator it will crash right after the splash screen is displayed. It is treated by adding the following line to the general block:
<property name="ti.android.fastdev" type="bool">false</property> 

')
2. Manifest:
 <android xmlns:android="http://schemas.android.com/apk/res/android"> <manifest android:versionCode="4" android:versionName="1.2" android:installLocation="preferExternal" package="com.company.appname"> .... </manifest> </android> 


I am completely incomprehensible to the logic of the introduction of the system of two versions, but the fact remains that for the Play Store you need to specify two versions - one ie the versionCode binary version (clients do not see it, should be an integer, ideally incremental), the second is the official version of your versionName application (what clients will see).

In addition, immediately need to additionally specify the package which is equal to the project id.

And there is an installLocation option. For the emulator it is necessary to set only internalOnly - otherwise, when trying to install on the emulator, it will produce an error. For release on the PlayStore, I recommend to put preferExternal, so as not to litter the internal memory of user devices.

Code:


1. Width of objects on the screen - it is best not to try to attach to a fixed width and forget about the width attribute altogether. Instead, use left & right.

2. Colors should be specified only as #rrggbb. Options like #fff don't work! And if there is a chance to add an extra character accidentally, it will not work either (on iOS with the same code there are no such problems).

3. When using the standard facebook module, please note that
 fb.addEventListener('login', function(e) { // Some code... }); 

when you download the application on Android is not automatically called! (On iOS, it will be called automatically if the application has been authorized before).

Miscellanea:


1. Android SDK - everything is simple, we collect under 4.2 or 4.3 and everyone is happy. Under 2.2 in my case, everything works fine.

2. Add-on modules for Titanium - if the main functionality is not enough, there is quite a decent base of expanding modules. All of them are available on the titanium marketplace. You can also write your own.

3. Android supports “rubber” images called 9-patch. You can read more about them here:
developer.android.com/tools/help/draw9patch.html
radleymarx.com/blog/simple-guide-to-9-patch

A little PR;)


Please love and favor (the program is completely free):
play.google.com/store/apps/details?id=com.sukharenko.bfriends
The essence is simple - log in to facebook / vk / 4sq / instagram, press the Bump button, and “knock” the phones on each other (I use the Bump module - bu.mp ). After authorization and transfer of ID-schnikov, the application automatically adds a new contact to friends on vk / 4sq / instagram, and allows you to open the facebook app on the received profile. Alas, for FB only this way - API restrictions :(
The initial idea was this - you meet new people, but often when you try to find a person on a social network you get too many results (try to find for example Vasya Ivanov on the same vk), which is usually very inconvenient. With the help of my application exact contacts will be transferred and added automatically.

PS The program still needs some work, in particular in the area of ​​the interface - I'm already working on it. Constructive criticism is welcome!

Source: https://habr.com/ru/post/188676/


All Articles