So finally! The guys at Apache Flex has made available an installer for the latest release of the 4.10 Apache Flex SDK version for Linux/Ubuntu. It take some time, but finally an installer for our beloved platform. So let's install it:
First you must have Adobe Air 2.6 installed, here is a great tutorial. Next download the deb file containing the installer here.
Next double click and ... what an error ?
If you have Adobe Air installed you need to check the version to do this just run this command:
dpkg -l adobeair
and you should get something like this:
So, i if my math is still good i suppose that version 1:2.6.0.1917 is greater than 1:2.6.0.0, so i just ignore this and use this command to install the package:
Doing remoting with Flex and BlazeDS is great, you set up your remoting-config.xml with your destinations and them consume this destination with your Flex client, that's good if you have your destinations hardcoded in your xml file, but there are times when you want to create your remoting destinations dynamically, taking this post as a base i will show you how to do this with BlazeDS in a simple example.
First we create a class called DestinationHelper this will contain all the classes you want to create at run time, read the comments so you know exactly what are you doing for a deeper explanation please read this post.
I take the great explanations of Nick Kwiatkowski and change a little so this can match the example, please all the credits go to him.
The first thing we do is call the createDestination() function on the remoting-service and cast this to a RemotingDestination. This will pass back a reference to the new destination that was created for us with the name we passed in. Next, we set the source property. Since we are working within Java, this could be the dot-path-name of the Java class we are working with, or * to allow our dynamic destination to talk to ANY Java Class.
The next thing we do is set up the Adapter. The adapter is what actually processes the requests from our connected Flex client and sends it over to Java to be worked on. In our case, I am having a Java Adapter do the processing, so I went with the “java-object” adapter. There are a variety of adapters available, and depending on your situation, you may want to choose from a list of adapters, or use the getDefaultAdapter() method to find out what is the default for the service you are working on. Creating an instance of the adapter involves calling the createAdapter() method on the destination. What is returned to you is a reference to the adapter that isn’t initialized yet. When diving through the source code — this is what screwed me up the most, as I was under the impression that the createAdapter() was all I had to call to get things working. If that is all you do, you will get NullPointerException errors when you try to pass data to the destination.
In order to initialize the adapter, you need to pass in a property with the type of a ConfigMap. The ConfigMap holds the configuration properties that the adapter is expecting. There are lots of properties that could be set (and if you want to get a general idea of what they are, take a look at the XML config). In theory, you should be able to pass in an empty ConfigMap to the initialize method and it will take all the defaults (which work in my case), but there is a bug in the JavaAdapter (Yes in the Java adapter too) that requires to you set the use-mappings and method-access-level properties to something or you can’t send any data to the destination. These two properties are within a ConfigMap named “access” (again, take a look at the XML in the remoting-config.xml to see how this translates). Finally, in order to initialize the adapter, we pass in the ConfigMap we just setup to the initialize() method and we are set.
Our final steps include binding our newly created adapter instance to the destination by using the setAdapter() method, and setting the channel that the destination will bind to. If I wasn’t making the assumption that the channel “my-amf” already exists, I could call the getChannels() method on the Message Broker to verify that it is one of the ones available. If the channel wasn’t available, I could create using a similar method as above. And finally, we need to start the instance. Call the start() method to start it. If everything is set up right, you should be able to send data to your new destination!
After a January break, i going to write more about Air for Android specifically targeting to Realtime data synchronization, in this post i'm going to show you how you can synchronize Adobe Air with Adobe Air for Android in true realtime using Red5 RTMP.
Requirements:
Adobe Flash Builder Burrito Preview.
Flex 4.5 "Hero" (Comes with Flash Builder Burrito)
Red5 Server.
Eclipse 3.4+ with Red5 Plugin installed. If you don't know how to install here is a little tutorial.
Some basic AS3 knowledge is recommended.
Hardware:
Toshiba dualcore laptop 6gb ram running windows 7.
Google Nexus S smartphone with Air for Android installed.
So let's code.
Server Side:
If you successfully install Red5 plugin into eclipse, this part will be straightforward. Create a new Dynamic Web Application and call it MoveServer, set the Target Runtime to Red5, in Configuration click the Modify button and make sure that Red5 Application Generation is Selected.
Now click finish and the Red5 Plugin will generate two Projects a Java Dynamic Web Application and a Flex application, delete the flex application. Now one more change, go to the red5-web.properties located in under WebContent/Web-INF and add the ip of your machine in your virtualHosts. You might wondering why do this since there is a localhost well when you try to connect from your phone it will try to connect to localhost and since there is no localhost in the phone it will not work.
Thats all for the server side. Now let's continue with the client side: The application that i will build is pretty simple an image in the screen that uses the phone accelerometer to move around the screen and for the desktop version instead of the accelerometer y use mouse events to move the image this to applications will be synchronize in real time.
Client Side:
In Flash Builder Burrito create a new Flex Mobile Project call this BallMovementMobile and Select Hero has your Flex SDK.
Next target to Google Android, select Blank as the application template and finally uncheck Automatically Reorient, you don't need any server settings so hit finish.
Now search for any image and use it, i use a soccer ball. Put the image in a assets folder under the src folder
Now add and image component to your mxml file:
BallMovementMobile.mxml
Now let check if our phone has accelerator and add the event listeners so we can use the accelerometer events, add an creation complete event in your main application tag and add the following:
BallMovementMobile.mxml
The next step is add a net connection and a shared object to out application:
BallMovementMobile.mxml
Some words about the code above:
I put the accelerometer.setRequestUpdateInterval to 50 so i can get a faster update from the accelerometer, here you can play with the values to preserve your battery life.
In the SharedObject getRemote method i named it "victor" you can put any value you want.
The Sync event is where all the magic happens, here all the clients are notified that something has change and they must synchronize with that changes.
Now let's add the code for sync and accelerometer update events:
BallMovementMobile.mxml
Some words about the code:
In the accelerometerUpdate handler i calculate the upper bound and the lower bound for the width and height, then get the x and y values given by the accelerometer, check if the value is not greater than the upper bound or lower than the lower bound and update the image x and y has necessary.
When i update the shared object i call it "ballCoordinates" again you can use any word here.
In the sync event i get the shared object data and update the image x and y.
Finally i add and native deactivate event so the application will not run in the background, again this is for cpu saving. (You can read more Air for Android tips here)
The final step for the mobile application, change the application descriptor properties as follows:
Now create an Air application (not mobile) use the same image and add the following code:
There are a little code differences but it's almost the same application.
Now run both applications and move your phone and the two screens will be synchronized in realtime.
That's all here is the source code for the mobile the desktop and the server application. Here is a quick demo of the application:
Recommendation: When you use the source code please make sure you change the parameters according to your system.
If you have any question or found a mistake or bug please let me know. Thanks
Today we are going to install the Blackberry Playbook Simulator, so you can create and test applications for this awesome device before running on the real device. This device is awesome, the specifications are very impressive, check all in the blackberry - playbook web page http://us.blackberry.com/playbook-tablet/, and like blackberry always say this device is Enterprise Ready :D.
The good news with the last update of the Blackberry Playbook site is the linux release of both products: the simulator and the sdk (i have been waiting for this!!!). So let's install the Blackberry Playbook Simulator in Ubuntu 10.10.
Requirements:
Blackberry Playbook Simulator.
VMware Player 3.1.3. If you have problems installing VMware Player in Ubuntu 10.10 check this.
The machine that i use for this installation has Ubuntu 10.10 - 64bits installed.
The first we need is to install the Simulator, open the terminal change the directory where you download your installer and run the following command:
This command will give execute permissions to our installer. Now execute the installer:
./BlackBerryPlayBookSimulator-Installer-Linux.bin
Now you get the installer interface:
Click next and read the License Agreement, click in the I accept radio button and then click next, the next screen is very important:
Select in which folder do you want to install the Simulator, well the only thing you will get is the image for the simulator, click next and review the Pre-Installation Summary.
Click install, once the installer finish click the Done button, now go to folder where you just install the Simulator, in this folder find the BlackBerryPlayBookSimulator.iso, now we start our VMware Player.
Now create a new virtual machine click the Create a New Virtual Machine button this will show the new Virtual Machine Wizard, click Next and this will bring the following screen:
Select the Installer from iso and then click Browse and select the BlackBerryPlayBookSimulator.iso image, this will display an alert we fix this later. Now click Next and the following screen appear:
Take care about the Operating System and Version options both must be Other and Other then hit Next.
In this screen you have to specify the name and the location of the virtual machine then click next.
Here specify the disk size and the type of virtual disk, make sure you select the single file virtual disk and click next.
In this screen click the Customize Hardware button.
Here there are some settings you must check in your virtual machine:
At least 1 Gb of Ram is recommended.
In the Display category check the Accelerate 3D graphics.
Then click Save and Finish the installation, during the installation a new screen appeared, just say yes:
Now wait a moment.... and the Blackberry PlayBook simulator will be running in your VMware Player :D.
In my next post i will show you how to install the Blackberry PlayBook SDK and create your first application for this simulator of course in Linux and specifically in Ubuntu. If you have any question about this tutorial let me know.
Hi to all, today i want to show you a litle demo that i build, this demo shows the collaborations features available with BlazeDS, but i use diferents clients applications: Flex Web , AIR desktop and Android phone. For this demo i use
BlazeDS
Tomcat
Adobe AIR 2.0 for the Desktop client.
Adobe AIR 2.5 for the Android client.
Android Emulator.
PackagerUbuntu for package my Air applications for native Desktop and Android Emulator
I talked about PackagerUbuntu here, and today i want to show you the other feature of PackageUbuntu, this feature allow us to generate an Android apk file from an Air 2.5 application.
So watch the demo:
If you use this application let me know and if you have ideas of how to improve it, i really want to know.
Update: UbuntuPackager v0.2 is out take a look here When we develop AIR applications, we see that is very easy to deploy the same application in windows, mac and linux, the only thing we have to do is run the air application. But when air 2 was introduced there were some new features these includes the ability to launch or interact to native process.
You can build native installers with the comand line is not hard but some time you can mess up your installer with wrong arguments and other things. Inspired in Serge Jespers Package Assistant Pro, i develop a litle air 2 application that generates a native .deb installer for debian based systems and an .apk for android phones with air 2.5 installed.
So watch the demo:
Some considerations:
This software is still in alpha, but for the most of the cases works.
It actually work with pkcs12 certificates.
It works with android too, but i use the -debug flag to it can work in emulators and devices (Sorry but in Peru there is no phone with android 2.2)