Hello World on appcelerator - javascript

I'm new to appcelerator. I just want to know how hyperloop works.
How can I put this in appcelrator?
Or need to be javascript?
println("Hello world")

Titanium had always been a platform for developing cross-platform native applications using the javascript language. Great cross-platform experience is achieved thanks to the Titanium SDK which covers a lot of native mobile elements. So you would for instance create a Textbox and the SDK will make this a native control on iOS and Android.
Hyperloop was created to allow developers call native classes, or combine native libraries in more ease (native libraries could be combined before Hyperloop days by creating a Native Titanium Module). But the great thing about Hyperloop is that you are accessing device level API but using javascript.
So, the above println command which is a C command won't work. Since it is javascript, if you would like to print output to console you could just use: console.log("Hello World");. Or, you could use the Titanium SDK Ti.API.info("Hello World").
For more information check out the following links:
https://www.appcelerator.com/mobile-app-development-products/hyperloop/
https://docs.appcelerator.com/platform/latest/#!/guide/iOS_Hyperloop_Programming_Guide
https://docs.appcelerator.com/platform/latest/#!/guide/Android_Hyperloop_Programming_Guide

Related

Can Titanium code runs in browsers?

I understand that not all the code and functionality are available. However, I am currently in the planing of a new project and there are no document to be found on this aspect.
I want to know once I code in Titanium, is it possible to make a web version for mobile without the application with limited feature and the same code base? (something like touch.facebook.com vs Facebook app)
Thank you very much
Of course, Titanium could do that since it also supports MobileWeb. Titanium features:
Develop native applications for iOS, Android, BlackBerry, Windows, and
mobile web through a single code base.
With their Titanium Studio, you can easily build and package your app for MobileWeb.
But there are a lot of things to consider on developing titanium apps. Here are the few things I've learned along the way:
Don't use ImageView. Use View with backgroundImage. If it's an icon, you can make a font for your app. See how to create an icon font using IcoMoon.
Memory management
Never use borderRadius, borderWidth, borderColor in components within components, as for example a ScrollableView.
Minimize calling Ti.Platform.[property_name]. Example: instead of always calling Ti.Platform.osname to your controllers, you could have put it on you commonjs var osname = Ti.Platform.osname, then exports.getPlatformName = function() { return osname; };
Here are some few references:
http://developer.appcelerator.com/question/152656/tips-and-tricks-for-memory-management
http://developer.appcelerator.com/question/116867/this-is-a-solution-to-your-memory-woes#answer-203729
http://www.tidev.io/category/howtos/
Titanium SDK supports iOS, Android, BlackBerry, Tizen and HTML5 platforms. You can read more about that in their documentation. You can limit features in HTML5 app in a code with simple if() and reuse most of your codebase.
You can create a web version of the application if you include Mobile Web in the target platforms, when you create the project.
To deploy it on the browser, run the application as Mobile Web.
You may refer the following links for more details.
Getting Started with Mobile Web
Mobile Web Platform Overview
Mobile Web Limitations

Writing apps for Apple platforms with Javascript

Does Apple allow iOS and Mac apps to use Javascript? Can someone give me examples of how to use it and the advantages and disadvantages?
If you're looking for a less techy solution, you could also use AppFurnace ( http://www.appfurnace.com ) to create JavaScript & HTML5 apps, packaged as native apps for iPhone and Android. We use PhoneGap (mentioned above), with an added drag-and-drop interface, enabling you to make your own apps.
You can use phonegap as a javascript, html and css wrapper in your ios app if you want to create a native app using html and javascript.
There's NimbleKit which allows you to make native apps using HTML and Javascript. Otherwise you can use a UIWebview which you can execute Javascript in. Look at the UIWebView documentation for more info.
There are tools to code your app in javascript and compile it into native code.
But if you want your app to load javascript code at runtime and run it, then see this for more details.

Will learning Titanium Appcelerator improve my understanding of NodeJS?

I am learning how to build mobile JavaScript Application in Titanium Appcelerator. I am reading some of the documentation and they are now using the V8 Engine as their JS interpreter for Android. And some of the approaches are a clone of Node. Can I get a clearer understanding of Node by learning how to build App using Titanium Appcelerator?
No. Titanium is an API around the native iOs, Android, etc libraries for building mobile apps. Most casual users will never delve into the internals of whatever js engine Titanium uses under the covers.
You will learn more about node.js by building node.js apps. If you want to learn about v8, you can always download the source. Same for node.js.
Learning Titanium will not help you 'learn' node.js or V8, but the advanced JavaScript programming patterns in both (callbacks, passing functions as first class objects,etc. ) will be similar.

Is there a platform that bundles HTML5, CSS3 and JavaScript into a native mobile app?

Is there a platform I can use that takes all the technologies mentioned in the title and packages a native application for the most popular mobile Operating Systems (Android, iOS, RIM, WP7 etc)?
Thank you.
Yep, its called PhoneGap. PhoneGap Home
The first option requires you to build a file in an IDE. The second option they have is to upload a zip file in a certain format and they do the IDE work: PhoneGap Build
I have used both. They are quite fun to use! Read the APIs, the application is a little different in build structure than a typical web application.
Yes, you can use a software like Appcelerator Titanium to build applications for multiple platforms.
You can learn more at http://www.appcelerator.com
If you're not going to use any of the native libraries each of the platform provides, you're better off providing a mobile web site and instructing your users to bookmark it (you can bookmark pages to the homescreen in most of those platforms). Much less intrusive, much more simpler and maintainable.
Depending on what you want to do, yes - PhoneGap and Titanium Appcelerator are particularly suitable for this.
Someone I follow on Twitter did a nice write of comparing Appcelerator VS. PhoneGap VS. Adobe Air:
http://savagelook.com/blog/portfolio/appcelerator-vs-phonegap-vs-adobe-air
I've only used PhoneGap and dabbled briefly with Appcelerator. I found that PhoneGap used to be better, but that may no longer be the case it seems.
You could try and check out http://jquerymobile.com/

Javascript app in Android

I am new to Android programming, and looking for some general knowledge. I am considering writing logic of my application in javascript so that the same code could be executed in a webapp and in a desktop application. Would it be possible to also have it working on Android? I know that:
SL4A is marked as alpha-quality, and user would need to install it to make such an app work. Still it provides access to Android API. SL4A scripts also cannot go to Android Market, as far as I know.
A simple webapp doesn't have access to most Android API.
Would it be possible to write a simple Java app that would embed an HTML widget with javascript code and provide some wrapper to access necessary API?
I am not looking for a fully portable thing--I intend to adapt UI to each environment manually. I just would like to have the internal logic common to all ports.
PhoneGap allows you to write an HTML-based app that not only works with Android, but also iPhone, Windows Phone 7, WebOS and more. The API is standardized, so you can use the same page on all the platforms.
There's support for the most common native features on most platforms. (Here's a chart of the features supported on each platform) In addition, if you find that there's a feature you cannot replicate using only their API, you can write a plugin in the native platform language (so, for Android that'd be Java), and then call that plugin from your HTML/Javascript-page.
If you want to use javascript and access the native api then you should try Appcelerator.com. Those people are providing this.
There is Rhino, which is a Javascript engine written in Java. It works in Android, and it is used by Appcelerator's Titanium mentioned in another answer here.
User interface and Android-specific API can then be written and wrapped in Java, then called by the logic code written in Javascript and run by Rhino.
Consider GWT, a Java to javaScript compiler. You can write your logic and a lot of other code in plain old Java(There are a few things(e.g. reflection) that you can't do like reflection but you wouldn't be able to do it in javaScipt either) Applications like Google inbox are using GWT to reuse a lot of their code in javaScript. They don't just reuse logic either. You can reuse dependency injection, your architecture, AJAX calls and more. Also, GWT is faster than javaScript in both the browser and the JVM. The biggest problem you might have with GWT is that it's more complicated javaScript. Regular Java is already more complicated. Making it work on both the JVM and browser can only make things more complicated. Also, GWT was designed from the ground up for extremely complciated web apps.

Categories

Resources