Courses / Mobile Application Development (CDE-315) – BS CS 5th Semester

Week 17 Theory – Performance/Power Trade-offs; Mobile Platform Constraints; Emerging Technologies

Week 17 – Performance, Power, Platform Constraints and Emerging Technologies · 90 min read · 27 MCQs to check yourself

Android Developers – App Standby vs Doze: understanding system sleep

Philipp Lackner – Foreground services (and when to use them)

React Native vs Flutter vs Native in 2026 (AI-assisted mobile development)

1. Performance and power trade-offs

On a mobile device, performance (speed, smoothness, freshness of data, accuracy) and power (battery life) compete – doing more work faster usually costs more energy. Good apps choose the right balance for the task.

Where the energy goes

Component Energy use Notes
Display Highest in most use Brightness, refresh rate (60/90/120 Hz); dark theme saves power on OLED screens
Cellular radio (4G/5G) Very high per transfer After each transfer the radio stays in a high-power state for several seconds ("tail energy")
GPS High Continuous high-accuracy location drains battery fast
CPU / GPU High under load Heavy computation, animations, games
Wi-Fi Medium Cheaper than cellular per byte
Sensors, camera, Bluetooth Varies Camera and continuous sensors are costly
Wake locks Prevent sleep A forgotten wake lock keeps the CPU awake

Classic trade-offs

Decision More performance / freshness More battery life
Location PRIORITY_HIGH_ACCURACY, updates every 1 s Balanced/low power, every few minutes, passive, geofences
Network Poll the server every 30 s Push (FCM), batch requests, sync with WorkManager when charging/on Wi-Fi
Data freshness Always download newest Cache and refresh on demand
Computation Do it on the device now Defer, do on the server (cloud offloading) or when charging
Graphics 120 Hz animations, high resolution Fewer animations, lower frame rates for simple screens
Images Full resolution Compressed, resized (WebP/AVIF), lazy loading
Precision of ML Large on-device model Smaller/quantised model or cloud inference (but network cost)

Cloud offloading trade-off: sending work to a server saves CPU energy but costs radio energy and latency – worth it for heavy work with small data, not for small work with large data.

Batching and the radio state machine

The cellular radio moves between states: idle (low power) → connected (high power) → tail (waiting) → idle. Many small requests keep it awake; one larger batched request lets it return to idle sooner. Hence: batch analytics, prefetch data you will need, avoid frequent polling.

2. Android power management

Feature (version) What it does What apps must do
Doze mode (6.0) When the phone is unplugged, stationary and screen-off for a while, the system defers network access, jobs, syncs and alarms to periodic maintenance windows Use WorkManager/FCM high-priority messages; setExactAndAllowWhileIdle only for real alarms
App Standby (6.0) Apps the user has not used recently lose network/jobs access Do not depend on background work for unused apps
App Standby Buckets (9) Apps placed in Active, Working set, Frequent, Rare, Restricted buckets – limits jobs and alarms accordingly Provide value so users open the app
Background execution limits (8.0) Background services stopped shortly after the app leaves the foreground; implicit broadcasts limited Use WorkManager or foreground services
Background location limits (8.0) Background apps get location only a few times per hour Use geofences/passive updates
Battery Saver Reduces performance and background work Respect PowerManager.isPowerSaveMode
Restricted / Adaptive Battery (9+) ML predicts which apps you use; restricts others —
Foreground service types (14) Must declare foregroundServiceType (location, mediaPlayback, dataSync…) Use only for user-visible ongoing tasks
App memory limits (17) Per-app memory limits based on device RAM Fix memory leaks, release caches

Battery-friendly coding checklist

3. Mobile platform constraints

Constraint Description Developer response
Battery Finite energy, users judge apps by drain Efficient work, batching, push
Processing power and thermal limits Mobile CPUs throttle when hot Move heavy work to background threads/server; optimise algorithms
Memory (RAM) Limited; OS kills apps; Android 17 per-app memory limits Avoid leaks (static Context references, unregistered listeners), load images at needed size, use RecyclerView
Storage Limited and shared Small APK (AAB splits, R8), clear caches
Screen size and input Small screens, touch, foldables, tablets Responsive/adaptive layouts, window size classes, accessibility
Network Slow, intermittent, metered Offline-first, caching, retry
Fragmentation Many OS versions, OEM changes (aggressive battery killers), hardware variety Test on many devices; use Jetpack/AndroidX for compatibility; set sensible minSdk
OS and store policies Permissions, background limits, target API requirements, review guidelines Follow policies; update yearly
Security and privacy Sandbox, permissions, sensitive data Least privilege, encryption, HTTPS
App lifecycle Apps can be paused/killed at any time Save state, handle configuration changes and process death
Distribution Store review, update adoption delays Staged rollouts, backward compatibility

Performance targets users notice

4. Measuring and improving performance

Tool Measures
Android Studio Profilers CPU (method traces), Memory (heap dump, allocations, leaks), Network, Energy/Power
Layout Inspector View hierarchy depth, recompositions (Compose)
LeakCanary (library) Detects memory leaks automatically
StrictMode Detects disk/network access on the main thread during development
Macrobenchmark / Baseline Profiles Startup and scrolling performance; AOT-compile hot code for faster start
Perfetto / System trace Detailed system-wide traces
Battery Historian Analyse battery usage from bug reports
Android vitals (Play Console) Real-world crash, ANR, startup, battery and wake-lock metrics
Firebase Performance Monitoring & Crashlytics Network latency, traces, crashes in production

Common fixes: move I/O off the main thread; flatten layouts; use RecyclerView with stable IDs and DiffUtil; cache bitmaps (Glide/Coil); avoid creating objects in onDraw/tight loops; remove unused libraries; enable R8.

5. Emerging mobile technologies

Technology What it means for mobile apps
On-device AI / Generative AI Models run on the phone's NPU – private, offline, fast (e.g. Gemini Nano via Android's AI APIs/ML Kit GenAI, Apple Intelligence foundation models); cloud AI (Gemini API, Firebase AI Logic) for larger tasks; features: summarisation, smart reply, image understanding, translation
AI-assisted development Gemini in Android Studio, Copilot, "vibe coding" tools generate code, tests and UI – developers still review, test and secure the code
5G and edge computing High bandwidth + ~ms latency; processing at the network edge for AR, cloud gaming, real-time video
IoT and wearables Phones as hubs for smartwatches (Wear OS, watchOS), health sensors, smart homes (Matter standard)
AR / VR / XR ARCore (Android), ARKit (iOS), Android XR headsets and glasses, Apple visionOS
Foldables, tablets and desktop mode Adaptive UIs, multi-window, window size classes; Android 16/17 enforce resizability on large screens
Cross-device experiences Handoff/Continue On (Android 17), cars (Android Auto/Automotive), TVs
Declarative UI Jetpack Compose, SwiftUI, Compose Multiplatform – the industry standard for new UIs
Kotlin Multiplatform Shared business logic across Android/iOS/web
Super apps and mini-apps One app hosting many services (payments, rides, shopping)
Mobile payments and digital identity NFC wallets, QR payments (Raast in Pakistan), digital IDs, passkeys replacing passwords
Privacy-preserving tech Privacy Sandbox on Android, on-device processing, photo picker, approximate location
Satellite connectivity Emergency SOS and messaging via satellite on new phones
Blockchain / Web3 (niche) Crypto wallets, digital collectibles
Instant apps / App Clips Use part of an app without full install

Impact on developers

New skills (Kotlin + Compose, AI APIs, adaptive layouts, privacy), new trade-offs (on-device vs cloud AI: privacy and latency vs model size and battery), and continuous learning as platforms change every year.

Short and long questions

1. Discuss performance and power trade-offs in mobile application development. Explain the main sources of energy consumption, Android's power management features (Doze, App Standby, background limits) and techniques developers use to build battery-efficient apps.

Model answer

Trade-off: mobile devices have limited batteries; work that makes an app faster, more accurate or more up to date (frequent location fixes, constant network polling, rich animations, heavy on-device computation) consumes more energy. Developers must match accuracy and freshness to the real need.

Energy consumers: the display (brightness, refresh rate; OLED dark themes save power), the cellular radio (high power during transfers plus several seconds of tail energy), GPS, CPU/GPU under load, Wi-Fi, camera, sensors and Bluetooth, and wake locks that keep the CPU awake.

Android power management: Doze (6.0) defers network, jobs and alarms to maintenance windows when the device is idle; App Standby and Standby Buckets (9) restrict background work of rarely used apps; background execution limits (8.0) stop background services and limit implicit broadcasts and background location; Battery Saver and Adaptive Battery restrict further; foreground services must declare types (14); Android 17 adds per-app memory limits.

Techniques: use push (FCM) instead of polling; batch and prefetch network requests; cache data and images; compress data; schedule deferrable work with WorkManager under constraints (charging, unmetered network, battery not low); choose suitable location priorities and stop updates in onPause; use geofences instead of continuous tracking; release wake locks and sensors; avoid unnecessary animations and high refresh rates; offload heavy computation to servers only when data transfer is small; profile with the Energy/Power profiler and Battery Historian and watch Android vitals.

2. List five components that consume battery in a smartphone.

Model answer

Display, cellular radio (4G/5G), GPS, CPU/GPU, Wi-Fi (also camera, sensors, Bluetooth and wake locks).

3. What is meant by the performance/power trade-off in mobile apps? Give three examples.

Model answer

Faster, fresher or more accurate results usually require more energy, so apps must balance user experience with battery life. Examples: high-accuracy GPS every second versus balanced location every few minutes; polling the server versus push notifications; downloading large images versus compressed/cached images (also on-device versus cloud processing).

4. What is Doze mode?

Model answer

Doze (Android 6.0+) is a power-saving state entered when the device is unplugged, stationary and screen-off for some time; the system defers network access, jobs, syncs and standard alarms, allowing them only in periodic maintenance windows, which greatly extends standby battery life.

5. List six constraints of mobile platforms.

Model answer

Limited battery, limited CPU and thermal throttling, limited RAM (apps can be killed), limited storage, small/varied screens with touch input, unreliable metered networks, fragmentation of devices and OS versions, and strict OS/store policies on permissions and background work.

6. Name five tools used to measure the performance of Android apps.

Model answer

Android Studio Profilers (CPU, memory, network, energy), Layout Inspector, LeakCanary, StrictMode, Macrobenchmark/Baseline Profiles, Perfetto, Battery Historian and Android vitals in Play Console (also Firebase Performance Monitoring and Crashlytics).

7. Describe the constraints of mobile platforms and discuss emerging technologies that are shaping the future of mobile application development.

Model answer

Constraints: battery capacity; limited CPU with thermal throttling; limited RAM where the OS kills background apps (and Android 17 per-app memory limits); limited storage; small and varied screens with touch input, plus foldables and tablets; slow, intermittent and metered networks; fragmentation across OS versions, manufacturers and hardware; strict OS and store policies (permissions, background limits, yearly target API requirements); security/privacy requirements; and an unpredictable lifecycle where apps can be paused or killed. Developers respond with efficient code, adaptive layouts, offline-first design, Jetpack compatibility libraries, testing on many devices and profiling tools.

Emerging technologies:

  1. On-device and generative AI – NPUs run models like Gemini Nano for private, offline summarisation, smart replies and image understanding; cloud models (Gemini API) for heavier tasks; AI also assists developers in Android Studio.
  2. 5G and edge computing – gigabit speeds and millisecond latency enabling cloud gaming, AR and real-time video.
  3. AR/VR/XR – ARCore/ARKit apps, Android XR and visionOS headsets.
  4. Wearables and IoT – Wear OS/watchOS, health sensors, Matter smart homes, cars (Android Automotive).
  5. Foldables and large screens – adaptive multi-pane UIs, mandatory resizability on Android 16/17.
  6. Declarative UI and multiplatform – Jetpack Compose, SwiftUI, Kotlin/Compose Multiplatform and Flutter.
  7. Digital payments and identity – NFC wallets, QR and instant payments (Raast), passkeys.
  8. Privacy-preserving technologies – on-device processing, photo picker, approximate location, Privacy Sandbox.
  9. Satellite connectivity and cross-device experiences – emergency messaging, Handoff/Continue On. These trends require developers to learn new APIs, balance on-device versus cloud processing, and design for privacy, battery and many form factors.

8. List five emerging technologies in mobile computing with one application each.

Model answer

On-device generative AI – smart reply and summarisation; 5G with edge computing – cloud gaming/AR; AR/XR (ARCore, Android XR) – furniture preview; wearables and IoT (Wear OS, Matter) – health tracking and smart homes; foldables – multi-pane productivity apps (also passkeys, instant payments like Raast, Kotlin Multiplatform).

This lesson ends with a quiz of 27 MCQs. Open the lesson on PrepOasis to take it and save your progress.

Previous: Week 16 Lab 16 – Generate an APK File and Install It on an Android Device or Emulator · Next: Week 17 Lab 17 – Campus Feedback App: Form, 10-Second Countdown, Current Location and Email

All lessons in Mobile Application Development (CDE-315) – BS CS 5th Semester