About AIR Applications and Android Permissions

After I saw some tweets about issues related to accessing the Wi-Fi network from an AIR application running on Android I thought it is worth writing a post about this topic.

If you installed an Android application on your phone you know that during this process you are presented with a screen stating what permissions the application you are about to install will use: network communication, contact data, location, storage, and so on.

I think this is a good thing especially when dealing with applications from “not so trusted” sources. You have a last chance to decide if you are willing to install that app or not. Thus it is only natural Android apps build with Adobe AIR to follow the same rules. One more thing on security/permissions: I think it is a best practice, as a developer, to request the minimum permissions required for your application.

The way you setup these permissions is quite simple: you add an <android> node to your application descriptor file having the root the <application> node (the application descriptor file is the XML file you already use for setting the different configuration options for your AIR application – application name, enabling the update framework, initial size and position, and so on). Here is an example:

<android>
    <manifestAdditions>
        <manifest>
            <attribute name="android:installLocation" value="auto"/>
            <data>
            <![CDATA[
                <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
                <uses-permission android:name="android.permission.INTERNET"/>
                <uses-permission android:name="android.permission.WAKE_LOCK"/>
                <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
                <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
                <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
            ]]>
            </data>
        </manifest>
    </manifestAdditions>
</android>

In this example I added an additional setting in the form of <attribute name=”android:installLocation” value=”atuot”/> in order to allow the user to install the application either on the internal memory or on the SD memory card. The same way you can add additional permissions supported by the Android OS.

Now, next time when you have problems accessing resources from your AIR app on Android, you should know what is the first thing to look for.

Application Updater Library for AIR Native Installer Apps

My fellow evangelist, Piotr Walczyszyn, was very busy this summer tinkering with a number of projects that involve Adobe AIR. The latest one is library that enables you to update native AIR applications. You probably know that AIR 2 introduced a cool feature that lets you call processes from your AIR application (Native Processes API) as long as you package your application as a native installer (EXE, DMG, RPM etc). Once you do this, the built-in feature for update doesn’t work anymore.

If you want to have update capabilities with AIR 2 native installers you can use Piotr’s library or you can build your own mechanism. The choice is pretty simple, isn’t it?

Here is a video in which Piotr demos the library:

You can get the library from here or read Piotr’s post.

Adobe AIR Launchpad helps you creating AIR apps/projects

We’ve just launched Adobe AIR Launchpad: an AIR application that can speed up your AIR development.

How does AIR Launchpad help you? Here is a list of some of the features:

Here are some screenshots:

You can get this application from here.

50 resources to get up to speed with the Flash Platform

For the past six months we’ve been rolling out a lot of goodies, some of them in the form of final releases, others as betas. It’s no wonder you have to spend some time in order to get up to speed with the latest features of AIR 2, Flash Player 10.1 for Android, AIR 2.5, Flex 4, or Flash Builder 4. Thus, I thought it’d be a great idea to put together a list of resources to help you learn about these goodies.

So here I go, in no particular order.

Peer 2 Peer

Flash Player 10.1 and Adobe AIR 2 brings new capabilities to the table when it comes to Peer 2 Peer. The best resource to learn about this is my fellow evangelist Tom Krcha (some say his dreams are multicasted, but only a few are lucky enough to receive them :D):

Flex and server side technologies

AIR 2

AIR/Flash Player 10.1 and Android

Flex 4

Other Flash Builder 4 related resources

Enjoy!

Shibuya / Melrose is available on Adobe Lab

What is Melrose (formerly known as Shibuya)? It is a service provided by Adobe that helps you monetize your AIR applications. Pretty cool, isn’t it? Still, what exactly does it do for you? In a nutshell it helps you push your AIR application to millions of people and it handles all the details related to charging money for the application and setting up trial periods. From a code perspective, you add a library and couple of lines of code to your application to enable all these features.

For now, there are two storefronts available for you: Adobe AIR Marketplace and Intel AppUp center. You can use Melrose in 47 countries for now (it is still in private beta): Argentina, Australia, Austria, Belgium, Brazil, Bulgaria, Canada, Colombia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, India, Ireland, Israel, Italy, Japan, Lithuania, Luxembourg, Malta, Mexico, Netherlands, New Zealand, Norway, People’s Republic of China, Poland, Portugal, Romania, Russia, Serbia, Singapore, Slovenia, South Africa, South Korea, Spain, Sweden, Switzerland, Taiwan, Turkey, Ukraine, United Kingdom and United States.

If you choose to charge money for your application, then you get 70% of the revenue (there is a minimum price of $2.99 for any app you want to sell). You get the money on a monthly basis, provided you sold for more than $100 in the past 30 days. There are no charges if you choose to give away your application for free.

And finally, you have access to a dashboard where you can see information like number of trials, number of purchases, and revenue.

You can sign up for Melrose here, on Adobe Labs. Sign up and let us know what do you think!

Enterprise Cafe

I thought it would be cool to talk about this app because chances are that you haven’t heard about Enterprise Cafe. So what is Enterprise Cafe? It is an AIR application (:D) that aggregates a big number of resources on the following topics: LiveCycle, Acrobat, Connect, ColdFusion, Flash Platform.

Once you log in using your Adobe ID account and choose, for example, the Flash Platform, you’ll see a screen like this:

Enterprise Cafe helps you to stay in touch with the community (you can access Adobe forums from this app), receive news (you’ll find the success stories posted here very interesting), check out the latest blog posts and videos using the incorporated RSS reader and Adobe TV section, or check for Adobe events.

If you want to convince your team or boss about the value of the Flash Platform, then you should definitely take a look at this app. You’ll find the information you need to convince them.

Install Enterprise Cafe

You can download the application from here.

Flash for mobile contests

This summer you have many contests to pick from if you want to create Flash content for mobile (Android 2.2) and win something while doing it. You can win fame/money/software/mobile devices — not neccesary in that order and not all at once– but you get the point :D.

For more details, check out these contests:

Good luck!

AIR apps for viewing Android pictures on desktops

This week I had time to play with another idea for Android/Desktop applications: a picture viewer. My friend Alex Chiculita from the AIR team gave me this idea. A couple of weeks ago he played with a multi-screen application that let you load a picture from a device and send the picture to all the other devices connected to the same Wi-Fi network (the app runs on Android, Windows, MacOS, and Linux).

While playing with his application I realized that I could transform it into something more helpful (at least for me). Here is the challenge: we all use our smartphones for a lot of things, including taking pictures. Having a decent digital camera (this is what a smartphone became lately on top of a mobile phone) with you all the time means you can take interesting pictures. And usually you want to show these pictures to your friends or family. However, here is the problem: while taking pictures is extremely easy, sharing them involves cables,  Bluetooth, or seeing the picture on the phone’s screen.

My solution to this problem is AndroidPictures (the above pictures show AndroidPictures in action on my mobile). This Android application lets you browse through the pictures taken with the phone and scale/rotate/pan them. On the desktop, you use the companion AIR application for AndroidPictures, which displays the pictures sent by the Android application. All you have to do to see the pictures with your family is:

Watch the video below to see how it works.

The making of

I used Adobe AIR and Flex 4.1 for creating the Android and desktop applications. In order to connect the Android application to the desktop apps I used Peer-to-Peer direct routing (the same approach used in my previous app). As I already explained, if your local subnet (for example your home Wi-Fi) supports broadcasting then you can create a NetConnection without using Stratus or a Flash Media Server (you connect the NetConnection to “rtmfp:”). This is one of the new features available in Flash Player 10.1 and Adobe AIR 2.

Once you have the clients connected, you can send messages from any one to all of them. And the cool thing about using this approach as opposed to Socket servers is that you don’t have to manually manage all the clients. Your program sends a message and the clients decide how to handle the message. You simply don’t care how many clients are connected. You can read more on my fellow evangelist Tom’s blog.

Because I wanted to use this approach for other apps, I created a simple library (you can get the library’s source code from here; unzip the archive and import the PeerToPeer.fxpl project in Flash Builder). You’ll find three ActionScript classes, and the magic happens inside of MultiCastingService class. The public interface of this service is:

The service throws these events:

The simplest way to use this service would be:

    var service:MultiCastingService = new MultiCastingService();
    service.addEventListener(ServiceEvent.RESULT, onResult);
    service.addEventListener(ServiceEvent.CONNECTED, onStatusChange);
    service.addEventListener(ServiceEvent.PEER_CONNECT, onStatusChange);

    service.connect();

    private function onResult(e:ServiceEvent):void {
        if (e.what == "picture") {
            //do something with the bytes: e.body
        }
    }

    private function onStatusChange(e:ServiceEvent):void {
        if (e.type == ServiceEvent.PEER_CONNECT) {
            if (service.neighborCount > 0) {
                //others are connected; send a String message
                service.post("this is my message");
            }
        }
    }

For the Android app I had to tweak the Spark List in order to make it works with both touch and click events. For the picture interaction I used a library created by Tim Kukulski, a member of the Adobe XD team. This library makes it easy to interact with pictures by letting you use gestures like zoom, pan, or rotate.

The desktop application waits and responds to two kinds of messages: picture bytes and pictures transformations (rotation, zooming, or panning). Every time a picture is selected in the Android app, I grab its bytes and send them through the “wire”. When I transform a picture in the Android app, I grab the Matrix and send it to all the connected clients. The client applies the Matrix on the picture. And the rest is history :)

All in all it was pretty easy to put together these apps and I had a lot of fun while doing this. If I have the time, I will try to see if I can play the movies recorded with my Android by extending the current code.

Getting the apps and source-code

You can download the source code from here, install the desktop application from here, and the Android application from here. If you want to run the Android application, you need to install Adobe AIR on your Android (more info here).

If you have ideas for more applications that take advantage of having AIR running on Android phones and desktops please let me know. If you create something interesting, I’d love to hear about. I already have another cool idea, this time more complex and even more fun!

Have fun with the Flash Platform on multiple screens!

Creating multi-screen apps for Android and desktop using AIR

Today, I finished a project I’ve been working since last week: a desktop MP3 Music Player that can be controlled by any number of Android phones. I built these apps using Adobe AIR and the Flex framework. Below you can watch a video with these apps in action, running on Motorola Droid, Nexus One, and my laptop (you can watch here the video in a higher resolution).

The communication between the remote controls (AIR apps running on Android phones) and  desktop player is done using the peer to peer features of AIR 2 and Flash Player 10.1. Basically if all the parties are connected to the same subnet and if the network allows broadcasting, then you can create a group and send messages to all the members without the need of Stratus or some other service/server.

Actually, while working on this project I created a small class that enables you to quickly create clients who connect to a local network. Of course, this is only one way of connecting two or more clients. You can use sockets if you want, or one-to-one communication (peer2peer). But I think in both these cases you have to work more, because you have to manually manage all the parties involved. If you want to find out more about peer2peer features of the Flash Platform take a look at this MAX session and read my fellow evangelist Tom Krcha’s blog.

The Android app was more fun to build because I used the touch input mode along with click input. I enjoyed a lot tweaking James Ward’s code for scrolling a Flex List. Believe it or not, again I used Illustrator and Flash Catalyst a lot to create the skins or parts of them.

Until I have the time to put together an article explaining  how these apps were created, please enjoy the video and play with the apps: desktop file and APK file. And from here you can download an archive with the source code. If you need the Adobe AIR runtime or AIR SDK for Android, please sign in for the pre-release group here.

What do you think?

Test your AIR apps on an Android phone

I realized that for us (Europeans) it is a little bit harder to get our hands on a Nexus One or Droid phone. So, if you have created an AIR app for Android and you don’t have a device to test it on we can meet at one of the next events I’m doing and I will let you do the testing. Maybe we can shoot a video too :)

For now, my schedule looks like this:

If you live in Bucharest, just send me an email and we will figure out a date depending on when I’m not travelling.

Looking forward to seeing what you build :)

Next Page →

Switch to our mobile site