Please activate JavaScript!
Please install Adobe Flash Player, click here for download

SAE Magazin 2/2011

Android SDK is required. After Java and Eclipse have been installed you will need to configure the development environ- ment. 1. Use the Eclipse plug-in for Android. Click on “Help” > “Install New Software” and then on “Add” on the top right of the dialogue box which appears. Here, enter https:// dl-ssl.google.com/android/eclipse as a source and install the plug-ins available. 2. If you haven't already done so, now install the Android SDK. 3. Next, enter the location of the Android SDK. In Eclipse click on “Window” > “Preferences” and on “Android” in the left column. Enter the path where the SDK is installed. 4. Finally, install an emulator. In Eclipse click on “Window” > “Android SDK and AVD Manager”. Click on “New” in the top right and enter the parameters for the emulator. Generally the default settings are sufficient but you will however need to check which version of the API is entered as target, this should of course correspond to the version with which you are developing. Now you have everything needed to start an Android project using Eclipse, but before you really get going have a quick look at how an Android app actually works. Apps are fundamentally composed of various separate components which can be joined together to form an app. There are four types of components: An “Activity” is the most important com- ponent. Activities control the user interface and everything to do with graphics and user inputs. Only one activity can be active at anytime, each action calls a new activity. “Services” predominantly run in the back- ground. Services can be used to implement background calcu- lations or provide other apps with data. “Content providers” primarily communicate with other apps and enable these to access certain data. The content provider interface is used to precisely define which app may receive what data. “Broadcast receivers” are used to provide information when a particular event occurs on the phone, for example when a USB cable is connected or when the battery is nearly empty. ■ 1. Wir benötigen das Eclipse-Plug-in für Android. Hierfür klickt man auf „Help“ >„Install New Software“ und dann, im erschienenen Dialog oben rechts, auf „Add“. Hier müssen wir als Quelle https://dl-ssl.google.com/android/eclipse angeben und das verfügbar gewordene Plug-in installieren. 2. Wenn noch nicht geschehen, sollte jetzt das Android-SDK installiert werden. 3. Als nächstes geben wir die Location des Android-SDKs an. In Eclipse auf „Window“ > „Preferences“ und in der linken Spalte auf „Android“ klicken. Als SDK Location muss der Pfad zum installierten SDK angegeben werden. 4. Als letztes richten wir uns noch einen Emulator ein. Hierzu wieder in Eclipse auf „Window“ > „Android SDK und AVD Manager“ klicken. Rechts oben auf „New“ klicken und die Pa- rameter für den Emulator angeben. In der Regel kann man gut mit den Default-Einstellungen arbeiten, man muss nur darauf achten, welche Version der API man als Target angibt, diese sollte natürlich mit der Version überein- stimmen für die man entwickelt. Jetzt haben wir alles um ein Android Pro- jekt über Eclipse zu starten, aber bevor wir richtig loslegen, müssen wir uns noch ganz kurz anschauen, wie eine Android-App ei- gentlich arbeitet. Im Wesentlichen beste- hen solche Apps aus verschiedenen losen Komponenten die man gebündelt als App installieren kann. Wir haben vier Arten von Komponenten: Activity‘s … sind die wichtigsten Kom- ponenten. Über Activity‘s werden die Be- nutzeroberfläche und alles was mit Grafik und Nutzereingaben zu tun hat gesteuert. Es kann derzeit immer nur eine Activity aktiv sein, man ruft also für jede Aktion eine neue auf. Services … laufen dagegen überwiegend im Hintergrund ab. Services können zum einen genutzt werden um im Hintergrund Berechnungen durchzuführen, oder aber um anderen Apps bestimmte Daten zur Verfügung zu stellen. Content Provider … dienen primär der Kommunikation mit anderen Apps und ermöglichen diesen, auf bestimmte Daten zuzugreifen. Über die Content-Provider-Schnittstelle kann man genau definieren, welche App welche Daten bekommen darf. Broadcast Receiver … hiermit können wir Apps Informati- onen zukommen lassen, wenn ein bestimmtes Ereignis auf dem Telefon passiert, wie beispielsweise ein USB Kabel ange- schlossen wird oder der Akku fast leer ist. ■ Dominik Lewalter, programmer and Head Instructor Interactive Entertainment SAE / Qantm Cologne. production & Know How // GAME 117 Downloads and information The Java JDK can be downloaded directly from Oracle, the SE version is sufficient (http://www.oracle.com/technet- work/java/javase/downloads). Eclipse can be found at http://www.eclipse.org/downloads/, the current version of the classic version is sufficient. The Android SDK and detailed documentation are found at http://developer.android.com. Downloads und Informationen Das Java JDK kann direkt von Oracle runtergeladen werden, hier reicht die SE Version (http://www.oracle.com/technet- work/java/javase/downloads). Eclipse ist unter http://www.eclipse.org/downloads/ zu finden, hier genügt die Classic Variante in der aktuellsten Version. Das Android-SDK sowie eine ausführliche Dokumentation darüber findet man unter http://developer.android.com. Infobox Create a new project and choose the desired Android version