© Khmer Angkor Academy - sophearithput168

អំពី Android

Android Development ជាអ្វី?

Android គឺជាប្រព័ន្ធប្រតិបត្តិការ (Operating System) សម្រាប់ឧបករណ៍ចល័ត ដែលបង្កើតឡើងដោយ Google។ Android Development គឺជាការបង្កើត applications (apps) សម្រាប់ឧបករណ៍ Android ដូចជា៖

  • 📱 ទូរស័ព្ទ (Smartphones)
  • 📲 ថេប្លេត (Tablets)
  • នាឡិកាឆ្លាតវៃ (Smartwatches)
  • 📺 ទូរទស្សន៍ (Smart TVs)
  • 🚗 រថយន្ត (Android Auto)

📜 ប្រវត្តិសាស្ត្រ Android

  • 🗓️ 2003: Android Inc. ត្រូវបានបង្កើតដោយ Andy Rubin, Rich Miner, Nick Sears និង Chris White
  • 🏢 2005: Google បានទិញយក Android Inc. ក្នុងតម្លៃ $50 million
  • 📱 2008: HTC Dream (T-Mobile G1) - ទូរស័ព្ទ Android ដំបូងគេ ជាមួយ Android 1.0
  • 🍰 2009-Present: Android versions ដាក់ឈ្មោះតាម desserts (Cupcake, Donut, KitKat...)
  • 🌍 2025: Android មានអ្នកប្រើប្រាស់ជាង 3 ពាន់លាននាក់ (70% market share)

💡 Did you know? Android versions: Cupcake (1.5), Donut (1.6), Eclair (2.0), Froyo (2.2), Gingerbread (2.3), Honeycomb (3.x), Ice Cream Sandwich (4.0), Jelly Bean (4.1), KitKat (4.4), Lollipop (5.0), Marshmallow (6.0), Nougat (7.0), Oreo (8.0), Pie (9), Android 10, 11, 12, 13, 14, 15!

🎯 ហេតុអ្វីត្រូវរៀន Android?

ប្រយោជន៍ ពិពណ៌នា
ទីផ្សារធំ Android មានអ្នកប្រើប្រាស់ជាង 3 ពាន់លាននាក់នៅទូទាំងពិភពលោក
ឱកាសការងារ ក្រុមហ៊ុនជាច្រើនត្រូវការ Android Developers
បង្កើតចំណូល អាចលក់ apps នៅ Google Play Store
Open Source Android គឺជា open source និងមានសហគមន៍ធំ
Creativity អាចបង្កើតគំនិតផ្ទាល់ខ្លួនជា apps

📚 អ្វីដែលនឹងរៀន

  1. Android Studio - IDE សម្រាប់បង្កើត Android apps
  2. Java Programming - ភាសាសរសេរកម្មវិធី Android
  3. XML Layouts - រចនា UI (User Interface)
  4. Activities & Intents - ការប្រើប្រាស់ screens និង navigation
  5. Views & ViewGroups - UI components
  6. Data Storage - រក្សាទុកទិន្នន័យ
  7. APIs & Libraries - ប្រើប្រាស់ services ផ្សេងៗ

🛠️ ឧបករណ៍ដែលត្រូវការ

ឧបករណ៍ តម្រូវការ
Android Studio IDE official របស់ Google (Free)
JDK Java Development Kit
Computer RAM: 8GB+, Storage: 20GB+ available
Android Device/Emulator សម្រាប់ test apps

🎓 តើអ្នកត្រូវការចំណេះដឹងអ្វី?

មុនពេលចាប់ផ្តើមរៀន Android Development អ្នកគួរតែមាន៖

  • ✅ យល់ដឹងផ្នែកមូលដ្ឋាននៃ Java Programming
  • ✅ យល់ដឹងអំពី XML (markup language)
  • ✅ ចំណេះដឹងមូលដ្ឋាននៃ OOP (Object-Oriented Programming)
  • ✅ ការប្រើប្រាស់ Computer និង File System

💡 ជំនួយ: បើអ្នកមិនទាន់ចេះ Java សូមរៀនមេរៀន Java របស់យើងសិន ហើយបន្ទាប់មកត្រលប់មកវគ្គនេះវិញ។

🚀 Android Architecture (ស្ថាបត្យកម្ម Android)

Android មាន 5-Layer Architecture ដែលរចនាឡើងជា stack មួយដើម្បីផ្តល់នូវ modularity, security និង performance ខ្ពស់៖

┌─────────────────────────────────────────────────────────────┐
│                   LAYER 5: APPLICATIONS                     │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │  Phone   │  │ Contacts │  │ Messages │  │Your Apps │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│            LAYER 4: APPLICATION FRAMEWORK                   │
│  ┌─────────────────┐  ┌─────────────────┐                 │
│  │ Activity Manager│  │ Content Provider│                 │
│  ├─────────────────┤  ├─────────────────┤                 │
│  │ View System     │  │ Package Manager │                 │
│  ├─────────────────┤  ├─────────────────┤                 │
│  │Location Manager │  │Notification Mgr │                 │
│  └─────────────────┘  └─────────────────┘                 │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│     LAYER 3: ANDROID RUNTIME + NATIVE LIBRARIES             │
│  ┌──────────────────┐         ┌─────────────────┐          │
│  │   ART (Runtime)  │         │ Native Libraries│          │
│  │  ┌────────────┐  │         │  ┌───────────┐  │          │
│  │  │Core Java   │  │         │  │  SQLite   │  │          │
│  │  │Libraries   │  │         │  ├───────────┤  │          │
│  │  ├────────────┤  │         │  │  OpenGL   │  │          │
│  │  │Garbage     │  │         │  ├───────────┤  │          │
│  │  │Collector   │  │         │  │  WebKit   │  │          │
│  │  └────────────┘  │         │  └───────────┘  │          │
│  └──────────────────┘         └─────────────────┘          │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│               LAYER 2: HARDWARE ABSTRACTION                 │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │ Camera   │  │ Audio    │  │ Sensors  │  │ Graphics │   │
│  │   HAL    │  │   HAL    │  │   HAL    │  │   HAL    │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
└─────────────────────────────────────────────────────────────┘
                            ↕
┌─────────────────────────────────────────────────────────────┐
│                 LAYER 1: LINUX KERNEL                       │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │ Security │  │  Memory  │  │  Power   │  │ Network  │   │
│  │          │  │Management│  │Management│  │  Stack   │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
│  ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐   │
│  │  Device  │  │ Process  │  │   IPC    │  │   File   │   │
│  │ Drivers  │  │Management│  │          │  │  System  │   │
│  └──────────┘  └──────────┘  └──────────┘  └──────────┘   │
└─────────────────────────────────────────────────────────────┘

🔍 Layer 1: Linux Kernel (ស្រទាប់មូលដ្ឋាន)

Linux Kernel គឺជា core នៃ Android OS ដែលផ្តល់នូវ low-level system services។ វាគឺជា modified version នៃ Linux kernel ដែល optimized សម្រាប់ mobile devices។

Component មុខងារ សារៈសំខាន់
Security SELinux, Process isolation, Permission model ការពារ app និង user data
Memory Management RAM allocation, Virtual memory, Paging ប្រើ RAM ប្រកបដោយប្រសិទ្ធភាព
Power Management Doze mode, App Standby, Wake locks សន្សំថាមពល battery
Device Drivers Camera, Display, Bluetooth, WiFi, GPS ភ្ជាប់ទៅ hardware
Process Management Multitasking, Thread scheduling, Priority ដំណើរការច្រើន apps ក្នុងពេលតែមួយ
IPC (Inter-Process Communication) Binder, Sockets, Shared memory Apps ទំនាក់ទំនងគ្នា

🔍 Layer 2: Hardware Abstraction Layer (HAL)

HAL ផ្តល់នូវ standard interface រវាង hardware drivers និង higher-level Java framework។ វាអនុញ្ញាតឱ្យ Android ដំណើរការលើ hardware ផ្សេងៗគ្នា។

🔍 Layer 3: Native Libraries & Android Runtime

Native Libraries (C/C++):

  • 📊 SQLite: Lightweight database engine - រក្សាទុក structured data
  • 🎮 OpenGL ES: 2D/3D graphics rendering - Games និង animations
  • 🌐 WebKit: Web browser engine - WebView component
  • 🎵 Media Framework: Audio/Video codec - Playback និង recording
  • 🖼️ Skia: 2D graphics library - Drawing និង painting
  • 🔐 SSL: Secure Sockets Layer - HTTPS communications
  • 📸 Camera HAL: Camera operations - Photo និង video capture

Android Runtime (ART):

  • Core Libraries: java.lang, java.util, java.io - Java APIs
  • ⚙️ Dalvik/ART VM: Virtual machine ដែលដំណើរការ Java bytecode
  • 🚀 AOT Compilation: Ahead-of-Time compilation - Faster startup
  • JIT Compiler: Just-in-Time compilation - Runtime optimization
  • 🗑️ Garbage Collection: Automatic memory cleanup - Prevent memory leaks
  • 📊 Profiling: Performance monitoring tools

🔍 Layer 4: Application Framework

Application Framework ផ្តល់នូវ high-level services ដល់ applications ជា Java classes៖

Manager គោលបំណង
Activity Manager គ្រប់គ្រង Activity lifecycle, back stack, task management
Content Providers ចែករំលែក data រវាង apps (Contacts, Calendar, Media)
Resource Manager គ្រប់គ្រង resources (Layouts, Strings, Images, Colors)
Notification Manager បង្ហាញ notifications នៅ status bar
Location Manager GPS និង location-based services
Package Manager Install/Uninstall apps, manage permissions
Window Manager គ្រប់គ្រង windows និង screen orientation
Telephony Manager Phone calls, SMS, network information

🔍 Layer 5: Applications

នេះគឺជាស្រទាប់ដែល users និង developers ធ្វើការជាមួយ៖

  • 🏠 System Apps: Built-in apps (Phone, Contacts, Camera, Settings)
  • 📱 User Apps: Apps installed by user (Facebook, Instagram, Games)
  • 🔧 Your Apps: Apps ដែលអ្នកបង្កើត

⚠️ សំខាន់: ការយល់ដឹងអំពី Android Architecture ជួយអ្នកបង្កើត apps ដែលមាន performance ល្អ, secure និង scalable!

📱 ប្រភេទនៃ Android Apps

ប្រភេទ បច្ចេកវិទ្យា គុណសម្បត្តិ គុណវិបត្តិ
Native Apps Java/Kotlin + Android SDK ✅ Performance ល្អបំផុត
✅ Full hardware access
✅ Best UX
❌ Android only
❌ Learning curve ខ្ពស់
Hybrid Apps HTML/CSS/JS + Cordova/Ionic ✅ Cross-platform (iOS + Android)
✅ Web skills reusable
❌ Performance ទាប
❌ Limited hardware access
React Native JavaScript + React ✅ Cross-platform
✅ Near-native performance
❌ Third-party dependency
❌ Larger app size
Flutter Dart language ✅ Fast development
✅ Beautiful UI
✅ Cross-platform
❌ New language to learn
❌ Smaller community
PWA (Progressive Web Apps) Web technologies ✅ No installation required
✅ Easy updates
❌ Limited features
❌ Requires internet

✨ នៅវគ្គនេះ: យើងនឹងរៀនបង្កើត Native Android Apps ជាមួយ Java ដែលផ្តល់ performance, user experience និង hardware access ល្អបំផុត!

🎯 Android App Components (បួនប្រភេទសំខាន់)

Android app ត្រូវបានបង្កើតឡើងពី 4 components ធំ៖

Component តួនាទី ឧទាហរណ៍
📱 Activity Single screen with UI - អ្នកប្រើប្រាស់មើលឃើញ និង interact Login screen, Home screen, Profile page
⚙️ Service Background operations - ធ្វើការនៅផ្នែកខាងក្រោយ Music player, File download, Location tracking
📡 BroadcastReceiver តម្លើង system/app events - ចាប់សញ្ញា Battery low, Network changed, SMS received
📦 ContentProvider ចែករំលែក data រវាង apps Contacts database, Media files, Calendar events

🔄 Android App Lifecycle

យល់ដឹងអំពី app lifecycle គឺសំខាន់ណាស់ដើម្បី៖

  • Save/Restore data នៅពេល app stop/restart
  • Optimize battery ដោយ stop unnecessary processes
  • Handle configuration changes (screen rotation)
  • Prevent crashes និង memory leaks
       [User launches app]
              │
              ▼
        ┌──────────┐
        │ onCreate │ ──► Initialize app (called once)
        └────┬─────┘
             │
        ┌────▼─────┐
        │ onStart  │ ──► App becomes visible
        └────┬─────┘
             │
        ┌────▼─────┐
        │ onResume │ ──► App in foreground (user can interact)
        └────┬─────┘
             │
         [Running]   ◄─► User interacts with app
             │
    [User presses Home/Switch app]
             │
        ┌────▼─────┐
        │ onPause  │ ──► App loses focus (partially visible)
        └────┬─────┘
             │
        ┌────▼─────┐
        │ onStop   │ ──► App not visible (background)
        └────┬─────┘
             │
    ┌────────┴────────┐
    │                 │
[User returns]   [System kills app]
    │                 │
    ▼                 ▼
┌─────────┐      ┌──────────┐
│onRestart│      │onDestroy │ ──► App destroyed
└────┬────┘      └──────────┘
     │
     └──► Back to onStart()

📊 Android Market Statistics (2025)

Metric Value
Global Market Share ~72% (iOS: ~28%)
Active Devices 3+ billion devices worldwide
Apps in Play Store 3.5+ million apps
Daily Downloads ~3.5 million apps downloaded/day
Developer Revenue (2024) $42+ billion USD
Top Categories Games (43%), Education (9%), Business (8%)

💼 Career Opportunities

Position Average Salary (USA) Skills Required
Junior Android Developer $65,000 - $85,000/year Java/Kotlin, XML, Android SDK
Mid-level Android Developer $85,000 - $120,000/year MVVM, Jetpack, APIs, Testing
Senior Android Developer $120,000 - $180,000/year Architecture, Leadership, Performance optimization
Android Architect $150,000 - $220,000/year System design, Scalability, Team management

💡 Note: Salaries vary by country, experience, and company. នៅប្រទេសកម្ពុជា Junior Android Developer អាចរកបាន $400-$800/month ចាប់ផ្តើម។