Showing posts with label Adobe AIR for Android tutorials. Show all posts
Showing posts with label Adobe AIR for Android tutorials. Show all posts

Monday, October 17, 2011

Silicon Valley Code Camp Materials

The 2011 Silicon Valley Code Camp rocked!  Peter and the other organizers have really put on a first class event and it is great to watch it grow year over year.  The high point of this event is that it is all free and covers so much disparate technology.  I plan to be there next year.

For those who attended my sessions, here are the files I promised.

1. Customer Experience Management (CEM) for Architects - this is a look at an emerging architectural discipline surrounding multi-channel user experience.  The key relationships between running a successful enterprise and having a good user experience over disparate channels are discussed.

CEM-SVCC_Oct2011.ppt.zip - PPT format (18 MB)

2. Hands on Mobile Development using Flash Builder for iOS, Android and BlackBerry Tablet OS - during this course you will learn how to set up your development environment, architect and build a mobile application, use arrays, switch-case statements, while loops, data binding, remote data handling, Accelerometer access, Camera and Microphone access, GPS Receiver and all basic gestures.  Anyone can take this course with a little XML syntax knowledge and basic programming experience.

BL3453-ALL.zip - ZIP archive of source code, icons, preparation guide and courseware

Enjoy!

Thursday, September 29, 2011

Google Android Development with Flash Builder - Preparation Guide

This is the third in a series of articles explaining how to set up your development environment to prepare for attending my Adobe MAX preconference hands-on code camp.  The previous articles covered setting up Flash Builder and devices for iOS Application Development and BlackBerry Tablet OS development with Adobe Flash Builder.

In this post, you will learn how to set up Flash Builder and your Google Android device (running Android 2.2 or later) to get ready for development.

1.  The first step is to install Adobe AIR on your device if you have not already done so.  Simply visit the Android Market on your device, search for Adobe AIR, and complete the free install.  Here's a link: https://market.android.com/details?id=com.adobe.air&hl=en

2.  Next, you need to enable USB debugging on your device.  From the Home screen, tap Settings, and then select Applications > Development. Enable the USB debugging option.  If there is an option to stay awake while charging, enable that too.  NOTE:  This cannot be set while your phone is tethered to your computer.  Unplug the mini-usb cable before setting this.





3. If you're running Windows, you'll need to set up a USB device driver for your device.  For more information on this, see Connect Google Android Devices.   Depending on which version of Windows you're running and what Android device you have, the device driver set up can take some time.

This AdobeTV video by Platform Evangelist Bhakti Pingale walks through the setup steps for a Samsung Galaxy Tab: http://tv.adobe.com/watch/adc-presents/mobile-device-debugging-using-usb/.

4.  Plug your phone into your computer and open Adobe Flash Builder 4.5 or later.

5. Choose New > Flex Mobile Project and give your application a name.  Ensure that the defaults are selected as shown below.


6. Click Next and ensure that under Mobile Settings the Google Android checkbox is checked.  If you are only developing for this one platform, deselect the others.   Click the Permissions tab and ensure you have the appropriate permissions selected for each item you want to use.  For example, if your  app needs to use the Internet and access the camera on a Google Android device, you must select the permissions as shown below.


7. If you are building for both Tablet and smart phones, your application will have to be scaled for different screen densities and sizes.  I usually select the Scale Up From 160 dpi checkbox.  Click Finish.

8. Build your application.  If you want to see how easy this is, open the file created under the Views package, switch to Design view, and add a button.  Double-click the button to change the name to something unique (like "Hello Technoracle").  If you are looking for some easy tutorials for mobile application development, please download the course from http://www.22ndcenturyofficial.com/MAX2011/BL3453-ALL.zip

9. Once your application is complete, you may wish to release it to the Google Market.  To do this, you first need to make a proper certificate.  This process is described in this blog post on generating a P12 certificate for the Google Market using the Adobe AIR SDK.

10. When your application is complete, choose File > Export.  In the dialog box that appears, select Flash Builder > Release Build and click Next.

11. Ensure that the correct project is selected in the next screen along with the proper path location at which you wish to place your APK file.  APK files are the install packages for Google Android.  Also ensure that the Signed Packages For Each Platform setting is checked and click Next.

12. A screen will appear asking you for the location of the certificate and password that you created in step 9 above.  Fill these in and click on the deployment header and ensure that Install And Launch Application on Any Connect Devices is checked.  Make sure your Android device is connected and click Finish.


That is it!  Your application will compile into an *.APK file and install itself on your Google Android device.  If your application was built with a simple button it will appear and run as shown below.



Your application can be placed in the Google Market by creating an account and following the instructions at https://market.android.com

Tuesday, August 02, 2011

Video - discussing the importance of geo and mobile

This is an interview I did last year about the importance of geo-tagged data and mobile devices. It is interesting to look at these later to see how the predictions stack up against reality. In this case, it was particularly accurate. Enjoy!



Thursday, June 16, 2011

Tutorial: Accessing Microphone on Android in Adobe AIR


This video is the latest in a long series of tutorials on how to use the new Flash Builder for Flex Mobile Development.  This particular exercise targets Android however the same code can be run on iOS (cross compiled using 4.5.1) and BlackBerry Tablet OS.  Here is the video:



The project will be released shortly to the Android marketplace along with the full source code and some great new graphics thanks to my brother Paul Trani!  If you want the project source code for Flash Builder 4.5.1 + in the meantime, please email me direct dnickull at adobe dot com.

This will be part of the AIR Mobile Code Camp at Adobe MAX 2011 in October!  Sign up now!

Friday, April 15, 2011

New Open Source Mobile Application

This mobile application demonstrates how to retrieve XML data from a server, return the results, and work with the data objects and display them.  There will be a video posted on this blog post very shortly with the instructions for building it along with best practices.  In the meantime, you may download the source code directly from http://www.web2open.org/adc/XMLService.fxp (On a PC, right click and select "Save link as..."; on a MAC, control-click and select "Save link as...").

Now for some words of caution.  First, loading XML into a mobile application is generally a bad idea.  It is far better to use AMF with a 3-tier architecture (hello LiveCycle Data Services!!).  Nevertheless, small XML files can be worked with in this manner!  Enjoy.

Tuesday, March 22, 2011

WebVisions Hands on Mobile Android Code Camp!

If you are in Portland, OR on May 25-27, you must come to the Oregon Convention Center for the WebVisions Event. WebVisions is a nationally recognized conference that explores the future of Web design, technology and business strategy.

I have been invited to give a hands on development course that will lead people through the process of building a mobile application that deploys to the Android and BBos platforms.

Title: Hands-on AIR 4 Android Development

Desc: This hands-on Boot Camp is for developers to build an applications targeting the Google Android O/S.  Adobe Sr. Technical Evangelist Duane Nickull will prepare attendees ahead of time to complete this course using their own laptops.  Attendees will learn the basics of AIR 4 Android/BlackBerry O/S such as:    

- basic application architecture
- creating a new application project and how to use the emulator    
- invoking services and binding result formats including some best practices    
- switching between multiple views    
- invoking system actions via intents    
- touch screen gesture control         
- packaging the output as *.APKs to publish to the marketplace

Due to the short time of this session, all attendees will be given source code samples and resources to take away for self paced learning.

Wednesday, March 09, 2011

Thursday, January 06, 2011

Building an Android Mobile RSS Reader in 30 Minutes - Part 2 (Video)

This is part 2 of the tutorial to build a Slashdot RSS Android Application. The entire source code is available as well as the application.  In part two you will learn the architectural perils of mobile development plus how to mitigate them to save CPU and bandwidth as well as some best practices to satisfy your end users.


The source code for the project is available here: SlashdotRSS.fxp
The Slashdot.apk (Android installer package) is here: SlashdotRSS.apk


The topic chosen was how to read an RSS feed from Slashdot.org and display the list on a mobile device, then retrieve specific RSS items when the user makes a selection.


Building an Android Mobile RSS Reader in 30 Minutes - Part 2 from Technoracle on Vimeo.

Wednesday, January 05, 2011

Slashdot RSS Android app on marketplace

Over the break I got to devote some time to coding and finished the Slashdot RSS application.  The application is now on the Android market and a full description can be found here (or just download and install it to your device).

This is a free, open source application that monitors the RSS feed from slashdot.org. Anyone may take the source code and do with it what they wish. Video tutorial available at http://technoracle.blogspot.com/2010/12/mobile-slashdot-rss-reader-tutorial.html


The source code for the project is available here: SlashdotRSS.fxp
The Slashdot.apk (Android installer package) is here: SlashdotRSS.apk

A complete video tutorial and written course will be published shortly.

   

Thursday, December 23, 2010

A Couple of Hacks for Mobile Flex Development

The new Flex Hero 4.5 SDK has great features and the architecture for mobile applications is very cool.  Working with it over the last few months has also taught me a couple of coding hacks to share.  First let's look at how it works.

A Flex Mobile application is composed of a minimum of three files.  The first is the main entry point into the application, which has two main content areas.  The top content area (shown below in green) may contain three content areas.  These are Navigation content, Title content, and Action content. Note that these are optional and some applications might use different navigation schemes such as creating a Vector of Spark Navigators.


The gray area below the title is the main content area of an application.  This is controlled by the navigator(s).



When you set up a new Mobile application, the minimum three files are the main entry point, the first default Home or First View, and the Application Descriptor. The descriptor file has the same basic purpose as in previous versions of AIR except it has been extended to declare Android manifests and other items.  The graphic below depicts a larger project and shows some of the main components of a mobile application.


When you launch a mobile Flex application, the first view may be declared within the entry point to the application.  In the example above, MobileFileBrowser.mxml has a single declaration that points to MobileFlexBrowserHome.mxml.   This is declared in line 5 of Code Sample 1 below.

Code Sample 1

Line 6 shows a great trick.  Mobile applications may take a while to initialize and providing user feedback during that time is sometimes useful.  The splashScreenImage shows up when the application launches to let the user know the app is initializing.

Now let's take a deeper look at how the navigation works.  Below is a screenshot of the Mobile Slashdot RSS reader I am working on.  The first half of the tutorial to build it and the source code are available at http://technoracle.blogspot.com/2010/12/mobile-slashdot-rss-reader-tutorial.html. Note that the current code base has some need for optimization.


The Home view in this case contains a list and has a service call linked to it to reach out and grab an RSS feed from slashdot.org.  The service call (getData()) is initiated on an event called "viewActivate", which is fired when as the view becomes active.  When a user gets this view, they may select an item from the list and the view navigator will then pass the data object to a new view and instantiate the new view.  In this example, the RSS item is passed and details are shown in the new view.  If the user wishes to navigate backwards, they simply use the back button.  The code for this is written as pushView(View, Data) and popView().  

Here is an important tip! Consider what happens in a mobile scenario when the user examines several different RSS items and navigates backwards to the main list.  When the new view is active, the old view does not persist by default so a new service call must be performed every time the list view is shown.  If you link your service call up to the viewActive event as shown below on line 5 of Code Sample 2, your application will make the service call each time the view becomes active.

Code Sample 2


Needless to state, in many situations, this is architecturally really bad as it will eat up both bandwidth and battery/CPU life.  Luckily, this problem can be rectified with a single declaration.  The better way is to not call the service based on a viewActivate event and instead allow the user to trigger it with a button or use the applicationInitialize event.  Once you do this, you can simply add the declaration that the destructionPolicy is none as shown below in line 7 of the code snippet. If you download the current source code from part one of this tutorial, note that this has not yet been done and is being slated for part 2.


Code Sample 3


Now let's consider another way you can allow users to navigate through your application.  The Slashdot RSS reader application has an information view.  To access the information view, the call is made directly from the action content area.



When the user clicks the information icon, a call is made through the navigator.activeView object as shown in code samples 4 (below) and 2 above.

Code Sample 4


Note that on line 29 of code sample 4, the call is made to the public function on line 19 of code sample 2.  This function only requests that the navigator push the information view, in this case with no accompanying data.  Since the information view will also have the info icon in the parent container, it too must contain the showInfo() function or an error will be thrown.   If you wrote the function exactly the same as in the other views, it could lead to a recursive problem.  If the user keeps hitting the information icon, new info views get created and activated.  If the user hits the icon 25 times, they would have to hit the back button 25 times to return.

There are two ways to keep the view from being pushed more than once.  On line 10 of the code sample below is the function that gets called when a user clicks on the information icon.  Line 12 sets up a regular expression that will detect if the current view is the "InfoView".

Code Sample 5

Note that there is a "\d*" within the regular expression.  If you add a line of code to trace the name of the currently active view,  the console will show that the runtime appends some numbers to the end of the name as shown below.


Essentially the regular expression can detect if the activeView is already the InfoView and prevent it from creating another instance of itself.

The problem with this approach is that over time it becomes unmanageable.  A far better way to prevent this is to simply make the showInfo() function in the information view do nothing as shown on lines 8-11 of Code Sample 6 below.  Note that if you do not have the showInfo function in the info view, an error will be thrown when the user hits the icon.

Code Sample 6

This is a far better way to handle the problem.

Well, that is all for now.    A video tutorial will be out shortly to summarize some of these lessons and the source code for the RSS Reader will also be released.

Happy Holidays everyone!

Wednesday, December 15, 2010

Mobile Slashdot RSS Reader Tutorial - Free Source Code

NOTE:  This is Part 1 of a two part series.  Part two is now posted here: http://technoracle.blogspot.com/2011/01/this-is-part-2-of-tutorial-to-build.html

This post will sum up a new AIR for Android tutorial I have been working on.  The video will explain everything (will be posted shortly).    The project is an RSS reader for Android mobile devices.  I chose Slashdot (News for Nerds. Stuff that Matters!) and used their RSS feed from this URL.  The end result was a functioning mobile application that installed and worked on both the Google Nexus One phone and the Samsung Galaxy Tab.  There are some lessons to be learned though as you will see from the video.


Building an Android Mobile RSS Reader in 30 Minutes from Technoracle on Vimeo.

The source code for the project is available here: SlashdotRSS.fxp
The Slashdot.apk (Android installer package) is here: SlashdotRSS.apk

Here are some screenshots.  I plan to upload a complete tutorial soon!

   

Here are some of the source code views:

Thursday, December 02, 2010

Video Article - Comparing AIR for Android Development Processes

Yesterday I made a post about my experiences with the new Flash Builder 4.5 and 4.1 IDEs while developing mobile applications. Today, we follow this up with a video to illustrate some of the key points you'll need to get started.



Flash Builder 4.5 download

FileBrowser.fxp (Flash Builder 4.01/AIR 2.5 SDK project - 76 kb)
FileBrowser.apk (Android Package - 1.02 MB)
Installed application size = 1.02 MB (without graphics, icons, splash images etc)

MobileFileBrowser.fxp (Flash Builder 4.5 project - 840 kb)
MobileFileBrowser.apk (Android Package -1.78 MB)
Installed application size = 768 kb (with graphics, icons, splash images etc)

Have fun!