Introduction to Android Programming
Total Page:16
File Type:pdf, Size:1020Kb
Android Programming Mahmoud Hammad Introduction • Android provides a rich framework that allows you to develop innovative Apps • Android Apps are developed in Java programming language and run on Android-powered devices • There are many IDEs that support building Android Apps • Tow main resources to learns Android programming • Android developer documentation: https://developer.android.com/index.html • Open source repositories: learn from others’ code • AOSP (Android Open Source ProJect) • F-Droid • … Outline • Android Development Environment • Android Platform • Android App Fundamentals • Building Android App • Open Source Apps Android Development Environment • Java Development Kit (JDK) • Check if you have it ($ java –version). If not, download it from Oracle • Android Software Development Kit (SDK) • Set of tools and the Android framework to develop and build an App • Integrated Development Environment (IDE) • Eclipse with Android Development Tool (ADT) • Android Studio: All-in-One IDE, powered by IntelliJ IDE • Emulator to run and test your App • Android Virtual Device (AVD): created by AVD Manager which is part of the SDK • Genymotion: Very fast emulator runs on Oracle VirtualBox Time to download Android Studio version 2.2 • https://developer.android.com/studio/index.html • Requires 1.6 GB Disk space and 2GB of RAM Android Platform Architecture • Android System is a multi-user Linux-based operating system • App runs in an instance of a VM called: • ART for Android 5.0 (API level 21) and after • Dalvik Android App Fundamentals • App components: ➢Activity ➢Service ➢Broadcast Receiver ➢Content Provider • Each App runs in a process with a unique Linux user ID, for that • Apps can not communicate with each other • Apps can not access system resources (Camera, Location Sensor, etc) • To solve the aforementioned issues, Android developed: • Inter-Component communication mechanism (ICC) o Intent: A messaging obJect to request an action from another component either explicitly or implicitly • Permission system: System permission and custom permission • Android SDK compiles the Apps into Android Packages (APK files) Let’s build an App! Activity Broadcast Receiver Activity You have successfully [U] Make a Toast to Username: ___U___ logged in. welcome the user. {A2} Password : ___ P___ [U] {MAIN} Valid Login Invalid [U, P] Activity Service [U, P, Username and DeviceID] Logs username, password do not password, and device {A1} match. {A3} ID to the system log. Explicit Intent Implicit Intent Component [Intent Extra Data] {Action} Intent Filter Open-Source App • Many open-source Apps developed using Eclipse-ADT • To import an Eclipse-ADT proJect to Android Studio, follow the migration steps described here • Let’s migrate an App: • Download an open-source App from F-Droid • Migrate the App to Android Studio IDE • Explore the App • Build the App • Run it! Any Question?.