Senior Mobile Developer Interview Preparation Guide - FAANG Standards
This guide is based on general FAANG interview practices and may not reflect specific company procedures.
The interview process for a Senior Mobile Developer position at FAANG companies typically consists of 6-7 rounds designed to assess deep technical expertise in mobile development, system design thinking, leadership capabilities, and cultural fit. The process evaluates your ability to lead complex mobile projects, mentor junior developers, optimize performance at scale, and make architectural decisions for mobile platforms. Expect a combination of technical deep-dives on both iOS and Android ecosystems, real-world mobile development challenges, system design scenarios for scalable mobile applications, and behavioral assessment of leadership qualities.
Interview Rounds
Recruiter Screening
What to Expect
Your first interaction is with a technical recruiter who will assess your background, career trajectory, and general fit for the role. This 30-minute call is primarily behavioral and background-focused. The recruiter will review your resume, discuss your experience with mobile development, clarify your interest in the role and company, and answer your questions about the position and team. This is an important opportunity to establish rapport and get clarity on what to expect in subsequent rounds. The recruiter will also gauge your communication skills and enthusiasm for the role.
Tips & Advice
Be clear and concise about your mobile development experience. Highlight significant projects and your progression to senior level. Ask thoughtful questions about the team, the mobile platforms they support, and the scale of their user base. Express genuine enthusiasm for mobile development. Have a few anecdotes ready about why you love building mobile apps and how you've grown in your career. Listen carefully to the recruiter's description of the role and ask clarifying questions about the specific mobile platforms, frameworks, and challenges the team focuses on. This conversation will help you tailor your preparation for technical rounds.
Focus Topics
Motivation and Role Fit
Explain why you're interested in this specific role, company, and team. Connect your experience to the job description. Show you understand the mobile development landscape and what excites you about the opportunity.
Practice Interview
Study Questions
Technical Communication and Clarity
Practice explaining technical concepts and project details in clear, non-jargon-heavy language. Demonstrate your ability to communicate across different audiences, which is essential for senior-level roles that involve mentoring and cross-functional collaboration.
Practice Interview
Study Questions
Career Trajectory and Mobile Development Experience
Clearly articulate your progression from earlier roles to senior level, highlighting key projects where you owned mobile development. Be ready to discuss the scale of apps you've built (user numbers, downloads, MAU), the platforms you've worked on (iOS, Android, or cross-platform), and the technical challenges you've overcome.
Practice Interview
Study Questions
Technical Phone Screen - iOS Development Deep Dive
What to Expect
This 60-minute technical phone screen focuses deeply on your iOS development expertise. An experienced iOS engineer will quiz you on platform-specific concepts, best practices, and real-world scenarios. Expect questions about Swift/Objective-C, UIKit/SwiftUI, memory management, app lifecycle, networking, concurrency, and performance optimization on iOS. The interviewer will assess your depth of knowledge, problem-solving approach, and ability to think about trade-offs in mobile architecture. You may be asked to discuss architectural patterns, recent iOS features you've used, or how you'd solve specific iOS development challenges.
Tips & Advice
Go deep rather than broad. Demonstrate expertise in iOS development that goes beyond basics. Be ready to discuss not just how to build features but why you'd choose certain approaches. If you specialize in Android, still prepare thoroughly for iOS questions or clarify with the recruiter that your experience is primarily Android-focused. Reference real projects you've shipped on iOS. Discuss performance considerations—how you've optimized app startup time, memory usage, or battery consumption. For senior roles, interviewers expect you to think about iOS platform evolution, backwards compatibility, and integrating new iOS features. If asked about SwiftUI vs UIKit, discuss trade-offs rather than saying one is simply better. Ask clarifying questions about the specific challenges the interviewer's team faces with iOS development.
Focus Topics
App Store Distribution and App Lifecycle
Knowledge of app signing, provisioning profiles, iOS development certificates, and App Store submission process. Understanding of app lifecycle (launch, backgrounding, termination), background execution, and app extensions. Familiarity with iOS versioning and supporting multiple OS versions.
Practice Interview
Study Questions
Concurrency, Networking, and Performance Optimization
Understanding of GCD (Grand Central Dispatch), async/await, thread safety, and race conditions. Knowledge of URLSession, networking best practices, and handling network errors. Battery efficiency and performance profiling using Xcode tools. Optimization of app launch time, memory footprint, and responsiveness.
Practice Interview
Study Questions
Platform-Specific Features and Integrations
Experience with CoreLocation for location services, AVFoundation for camera/media, Push Notifications (APNs), Local Notifications, KeyChain for secure storage, UserDefaults, CoreData or other persistence mechanisms. Understanding of privacy considerations and permissions.
Practice Interview
Study Questions
iOS App Architecture and Design Patterns
Knowledge of MVC, MVVM, VIPER, and other architectural patterns. Understanding Model-View-ViewModel patterns and reactive programming. Ability to design scalable app architectures for large codebases. Discussion of dependency injection, modularity, and testability.
Practice Interview
Study Questions
Swift Language and Memory Management
Deep understanding of Swift syntax, type system, ARC (Automatic Reference Counting), weak/strong references, and avoiding retain cycles. Understanding of value types vs reference types and when to use each. Familiarity with modern Swift features like async/await, property wrappers, and generics.
Practice Interview
Study Questions
UIKit/SwiftUI and UI Development
Comprehensive knowledge of UIView hierarchy, view controllers, navigation, and animations. Understanding of SwiftUI declarative syntax and when it's appropriate vs UIKit. Knowledge of Auto Layout, constraints, and responsive design for different device sizes.
Practice Interview
Study Questions
Technical Phone Screen - Android Development Deep Dive
What to Expect
This 60-minute technical phone screen focuses on your Android development expertise. An experienced Android engineer will assess your knowledge of Android platform specifics, best practices, and real-world problem-solving. Expect questions about Kotlin/Java, Activities, Fragments, Services, lifecycle management, threading, coroutines, networking, data persistence, and performance optimization on Android. You'll be evaluated on your understanding of Android's unique challenges, how you structure Android apps for testability and maintainability, and your ability to optimize for diverse device configurations and Android versions.
Tips & Advice
Demonstrate deep Android expertise. Be ready to discuss the Android lifecycle in detail—Activities, Fragments, Services, and how they interact. If you've primarily worked on iOS, prepare thoroughly by reviewing Android fundamentals or clarify your primary platform. Show familiarity with Kotlin as the modern Android language, but also discuss Java where relevant. Discuss real performance challenges you've faced on Android: managing fragmentation across devices and OS versions, handling memory constraints on lower-end devices, optimizing battery usage, and managing background work. For senior roles, expect questions about architecture (MVVM, Clean Architecture) and testing strategies. Discuss your experience with dependency injection frameworks, thread safety, and handling Android lifecycle edge cases. Ask about the specific Android devices and OS versions the team supports, as this varies significantly between companies.
Focus Topics
Platform-Specific Features and Services
Experience with Android Services, Intent Services, Foreground Services, WorkManager for background work, Notifications (Push Notifications via FCM), Location services (LocationManager, FusedLocationProvider), Camera integration via Camera2 API, and other platform capabilities. Understanding of permissions model and runtime permissions.
Practice Interview
Study Questions
Android Fragmentation and Performance Optimization
Understanding of supporting multiple Android OS versions, different device screen sizes, and hardware capabilities. Knowledge of resource configuration qualifiers, dp/sp units, and responsive design. Experience optimizing app startup time, memory usage on low-end devices, battery consumption, and rendering performance.
Practice Interview
Study Questions
Networking, Data Persistence, and Security
Knowledge of Retrofit/OkHttp for networking, JSON parsing (Gson/Moshi/Kotlinx Serialization). Understanding of data persistence options: SharedPreferences, Room Database, ProtocolBuffers. Knowledge of secure storage using KeyStore and best practices for protecting user data. Experience with API design and error handling.
Practice Interview
Study Questions
Android Lifecycle and Component Management
Deep understanding of Activity lifecycle (onCreate, onStart, onResume, onPause, onStop, onDestroy), Fragment lifecycle, Service lifecycle, and BroadcastReceiver. Understanding of saved state, process death, and state restoration. Knowledge of how Android manages component lifecycles across configuration changes and system resource constraints.
Practice Interview
Study Questions
Concurrency, Threading, and Coroutines
Understanding of main thread, background threads, thread safety, and race conditions. Knowledge of coroutines as the modern approach to asynchronous programming on Android. Experience with Thread, Handler, AsyncTask (legacy), RxJava, and Coroutines. Understanding of Scope, Dispatchers, and structured concurrency.
Practice Interview
Study Questions
Android Architecture and Design Patterns
Comprehensive knowledge of MVVM (Model-View-ViewModel), Repository pattern, Clean Architecture, and other architectural patterns. Understanding of ViewModel, LiveData, StateFlow, and Jetpack components. Ability to design modular Android apps that are testable, maintainable, and scale with team size.
Practice Interview
Study Questions
Kotlin Language and Android Development
Strong command of Kotlin syntax, null safety, extension functions, coroutines, and Kotlin Flow. Understanding of how Kotlin improves upon Java for Android development. Knowledge of Kotlin best practices and design patterns specific to Android development.
Practice Interview
Study Questions
Mobile Development Challenge - Coding Interview
What to Expect
This 75-90 minute interview evaluates your practical mobile development skills through a real coding challenge. You'll be asked to build a small mobile feature or application, typically using a shared editor. The challenge is designed to assess your ability to write clean, well-structured code; think through requirements; handle edge cases; and communicate your approach. For senior roles, you're not just expected to make it work—you should discuss design decisions, consider performance implications, optimize the solution, and demonstrate awareness of platform best practices. You may be asked to build a UI component, implement a networking layer for an API, create a data model, or solve a complete small feature. The interviewer will likely ask follow-up questions about how you'd scale the solution, handle error cases, or adapt it to different requirements.
Tips & Advice
Start by asking clarifying questions about the requirements—what exactly are you building? What are the acceptance criteria? For senior roles, clarify edge cases and performance considerations upfront. Communicate as you code: explain your approach, your design decisions, and why you're choosing particular patterns or libraries. Write clean, readable code with appropriate naming and structure. Don't optimize prematurely; first write a working solution, then discuss optimizations if there's time. If you get stuck, think out loud—interviewers want to understand your problem-solving process. Consider testability from the start. Ask the interviewer for feedback on your approach partway through rather than coding in silence. Handle network errors, null/empty cases, and other edge cases thoughtfully. For async operations, use modern approaches (async/await on iOS, Coroutines on Android) rather than older patterns. If implementing UI, discuss how you'd make it responsive across different screen sizes. Time management is important—prioritize a working solution over trying to make it perfect.
Focus Topics
Data Persistence and State Management
Knowledge of storing data locally (UserDefaults, SharedPreferences, database), managing app state, and ensuring consistency across the app lifecycle. Understanding of managing state across configuration changes and process death scenarios.
Practice Interview
Study Questions
UI Implementation and Responsiveness
Ability to implement responsive UIs that work across different screen sizes and orientations. Knowledge of layout systems (AutoLayout/Constraints on iOS, Compose/XML layouts on Android). Understanding of accessibility considerations and user experience best practices.
Practice Interview
Study Questions
Writing Clean, Production-Quality Code
Ability to write well-structured, readable code that follows platform conventions and best practices. Code should use appropriate design patterns, have clear separation of concerns, include error handling, and be testable. Code should demonstrate awareness of code review standards and maintainability.
Practice Interview
Study Questions
API Integration and Data Handling
Practical experience making API calls, parsing responses, handling network errors and timeouts, retrying failed requests, and managing state from API responses. Understanding of async/await patterns, reactive programming, or callback-based approaches depending on platform.
Practice Interview
Study Questions
Problem-Solving and Communication
Ability to break down a problem into manageable pieces, ask clarifying questions, discuss trade-offs, and communicate your reasoning. Willingness to discuss alternative approaches and their pros/cons. Clear explanation of your code and design decisions.
Practice Interview
Study Questions
System Design - Mobile App Architecture at Scale
What to Expect
This 70-90 minute interview assesses your ability to design and architect complex mobile systems. You'll be presented with a scenario like 'Design a photo-sharing mobile app like Instagram' or 'Design a real-time chat application for mobile' and asked to propose an architecture. For a senior role, this goes beyond basic app structure—you're expected to consider scalability, performance, offline capabilities, data synchronization, security, testing strategy, and team maintainability. You'll discuss backend API design, client-side caching strategies, how to handle large data sets efficiently on mobile, optimization techniques, and trade-offs between different approaches. The interviewer will probe deeper into your choices: Why that architecture? How would you optimize for slow networks? How would you implement offline-first? What happens when the database grows to millions of records?
Tips & Advice
Start by asking clarifying questions about requirements: What are the core user journeys? What's the expected scale (daily active users, data volume)? Which platforms are we targeting? What are the network conditions? Clearly state your assumptions and check with the interviewer that they're reasonable. Propose a high-level architecture first, then dive into details. Discuss trade-offs: native vs cross-platform, monolithic vs modular app structure, caching strategies, database choices. Consider real-world constraints: limited storage and memory on mobile devices, variable network conditions, battery consumption. Discuss offline capabilities—how would the app work when the network is down? How would you sync data when back online? Address security: how would you store sensitive data, handle authentication tokens, prevent data breaches? Discuss scalability: as your user base grows from thousands to millions, how does your architecture scale? What about data synchronization for real-time features? Touch on testing strategy and debugging challenges in production. For senior roles, interviewers want to see that you think about team scaling too—how would you structure the codebase so multiple teams can work in parallel? Be open to feedback and refine your design based on interviewer questions.
Focus Topics
Testing Strategy and Quality Assurance
Comprehensive testing strategy: unit tests, integration tests, end-to-end tests, UI tests. Test coverage and trade-offs. Testing across different devices and OS versions. Debugging production issues. Crash reporting and analytics. Continuous integration and deployment for mobile apps.
Practice Interview
Study Questions
Performance and Optimization at Scale
Optimizing app startup time, memory usage, and battery consumption. Handling large data sets efficiently (pagination, lazy loading, virtualization). Network optimization (compression, request batching, connection pooling). Profiling and identifying performance bottlenecks. Optimizing for lower-end devices and poor network conditions.
Practice Interview
Study Questions
Security and Authentication in Mobile Apps
Secure storage of authentication tokens (OAuth, JWT). Best practices for handling credentials. Securing API communication (HTTPS, certificate pinning). Protecting against common mobile attacks (data interception, reverse engineering). Privacy considerations and compliance (GDPR, CCPA). Permission models and user consent.
Practice Interview
Study Questions
Mobile App Architecture and Modularity
High-level architecture of a mobile app at scale. Modular design for code maintainability. Separation between feature modules, shared libraries, and core infrastructure. Component APIs and inter-module communication. Dependency management and avoiding circular dependencies. Scaling the architecture as the team and codebase grow.
Practice Interview
Study Questions
Backend API Design for Mobile
Designing APIs specifically for mobile clients: considering bandwidth constraints, supporting versioning, pagination, filtering, partial responses. Rate limiting and quota management. Error responses and error recovery. Real-time data synchronization patterns (polling, WebSockets, Server-Sent Events).
Practice Interview
Study Questions
Data Caching and Synchronization Strategies
Client-side caching strategies: in-memory caches, disk-based caches, cache invalidation. Handling data freshness vs. stale data trade-offs. Synchronizing data between multiple views/components. Managing eventual consistency. Offline-first patterns and conflict resolution when syncing offline changes back online.
Practice Interview
Study Questions
Behavioral Interview - Leadership and Impact
What to Expect
This 60-minute behavioral interview evaluates your leadership qualities, teamwork, communication, and impact at a senior level. You'll be asked about situations where you demonstrated ownership, led a project or initiative, resolved conflicts, influenced decisions, mentored junior developers, or handled challenges. The interviewer is assessing your ability to drive projects forward, work cross-functionally, communicate effectively, adapt to change, and demonstrate values alignment with the company. For a senior role, you're expected to show examples of leadership beyond just coding—how you've grown teammates, improved processes, or made architectural decisions that had broader impact.
Tips & Advice
Prepare 4-6 concrete stories from your professional experience using the STAR method (Situation, Task, Action, Result). Focus on stories that demonstrate leadership, ownership, mentorship, dealing with failure, driving impact, and collaborating cross-functionally. For each story, clearly articulate the impact: metrics improved, time saved, team velocity increased, product launched, users served, or team members developed. Practice delivering stories concisely (2-3 minutes). Be ready to answer questions about values alignment—research the company's stated values and prepare examples showing how you embody them. Discuss how you've handled disagreements with teammates or managers. Show examples of learning from mistakes. Discuss your approach to mentoring and developing junior team members. Be authentic and conversational rather than rehearsed-sounding. Listen carefully to questions and answer specifically rather than forcing a pre-prepared story. Show enthusiasm for the company's mission and products.
Focus Topics
Handling Ambiguity and Driving Decisions Under Uncertainty
Examples of making decisions with incomplete information. How you gather information, weigh trade-offs, and move forward. Dealing with changing requirements or priorities. Balancing technical excellence with shipping features.
Practice Interview
Study Questions
Impact and Results
Quantifiable examples of impact: features shipped, users served, latency improvements, crash rate reduction, team productivity increased, etc. Show how your technical decisions translated to business outcomes or user benefits. Multiple examples demonstrating consistent delivery of impact.
Practice Interview
Study Questions
Communication and Collaboration
Examples of collaborating effectively across teams (designers, product managers, backend engineers). How you communicate complex technical concepts to non-technical stakeholders. Situations where you had to explain trade-offs or advocate for a position. Working through disagreements productively.
Practice Interview
Study Questions
Mentorship and Team Development
Examples of mentoring junior developers, helping teammates grow, or creating learning opportunities. How you've improved team capability or processes. Situations where you've invested in teammates' development and seen positive outcomes.
Practice Interview
Study Questions
Ownership and Accountability
Examples of taking ownership of projects or problems, driving them to completion, and being accountable for results. Situations where you went above and beyond normal responsibilities. How you handle setbacks and learn from mistakes.
Practice Interview
Study Questions
Leadership and Influence
Examples of leading projects or initiatives, influencing team decisions, or driving change in processes or architecture. How you've influenced others without formal authority. Examples of making tough technical decisions and the impact they had. Driving alignment across teams with different perspectives.
Practice Interview
Study Questions
Hiring Manager Round - Role Fit and Cultural Alignment
What to Expect
This 60-minute conversation with the hiring manager is your opportunity to assess role fit from the other direction and demonstrate cultural alignment. The hiring manager will discuss the team dynamics, current challenges, and how the role fits into their broader engineering organization. They'll ask about your career goals, what you're looking for in a role, and assess how you'd work with their team. This is a two-way conversation—you should ask thoughtful questions about the team's structure, challenges, opportunities for growth, and technical priorities. The hiring manager wants to understand your working style, communication preferences, and whether you'd be a good fit for the team. Be authentic about your strengths and growth areas.
Tips & Advice
Prepare thoughtful questions about the team, their technical challenges, priorities for the next year, and how you could contribute. Research the company's mobile strategy and recent product launches. Discuss your career goals and what you're seeking in this role—be genuine about what matters to you (technical leadership, impact, mentoring, specific platforms, etc.). Share your working style: how you prefer to receive feedback, how you collaborate, your approach to code reviews, etc. Be ready to discuss how you'd approach the team's current challenges. Listen more than you talk in this round—the hiring manager is assessing cultural fit and team compatibility. Be honest about areas where you'd need to grow or learn. Ask about the team's values, how decisions are made, and what success looks like in the first year.
Focus Topics
Career Goals and Trajectory
Clear understanding of your career direction. Where do you want to be in 3-5 years? What attracts you to this specific role? How does this role fit into your career goals? Your vision for your growth as an engineer.
Practice Interview
Study Questions
Understanding Role and Team Context
Clear understanding of the specific challenges the team faces, the mobile platforms and technologies they use, current product priorities, and team structure. Thoughtful questions that demonstrate you've done research and are genuinely interested.
Practice Interview
Study Questions
Working Style and Team Fit
How you prefer to work, collaborate, receive feedback, and resolve conflicts. Your communication style. How you balance individual contribution with team needs. Your approach to code review, pair programming, and knowledge sharing.
Practice Interview
Study Questions
Alignment with Company Mission and Values
Authentic connection to the company's products or mission. Understanding of the company's values and how they resonate with you personally. Examples of how you've demonstrated similar values in previous roles.
Practice Interview
Study Questions
Frequently Asked Mobile Developer Interview Questions
You have a recurring 30-minute one-on-one with someone you mentor. Walk through how you'd structure the agenda to balance day-to-day blockers, skill development, and career conversation, and how that structure should evolve over a quarter.
Sample Answer
Direct answer
A recurring 30-minute 1:1 works best with a light, predictable structure (a quick check-in, blockers, a skill or growth item, and a career or forward-looking question), but the real skill is protecting the last two from being crowded out by whatever operational fire is loudest that week, and shifting the balance of the agenda as the relationship matures over the quarter.
Structured elaboration
A default structure for 30 minutes
| Segment | Rough time | Purpose |
|---|---|---|
| Check-in | 3-5 min | Surface anything urgent, gauge how they're actually doing |
| Blockers / operational | 8-10 min | Whatever's actively in their way right now |
| Skill or growth item | 8-10 min | One concrete thing they're building toward, not a status update |
| Forward-looking / career | 5-7 min | Where this is headed, not just what's happening this week |
Guarding against the common failure mode
A well-known failure pattern: the 1:1 happens reliably every week, on time, with all the segments technically present, but the career and growth segments become shallow ritual ("anything on your mind for growth?" "nope, all good") while blockers quietly eat the real time. The fix isn't just having a slot on the agenda, it's asking a specific, forward-looking question each cycle rather than an open-ended one, and being willing to occasionally protect that segment even when there's a real blocker competing for the time.
Diagnosing what's actually going on, not just tracking status
Part of the value of a recurring 1:1 is using it to figure out whether a struggle you're observing is a skill gap or a mindset or behavioral issue, because the two need different responses. Someone who's struggling because they don't yet know how needs teaching and practice; someone who's struggling because of avoidance, overconfidence, or a mismatch in how they're approaching the work needs a more direct conversation about the pattern itself, not more technical instruction. A 1:1 is a good place to probe for which one you're actually looking at before assuming.
An alternative structure for hands-on technical work
For roles where the most valuable use of the time is genuinely technical, a 1:1 doesn't have to follow the career-conversation template at all. Structuring it around live debugging together, walking through a real problem with explicit hypotheses ("I think it's X, here's how we'd check") and tracking which ones got ruled out, can be a more valuable use of 30 minutes than a generic status-and-goals agenda, especially early in a relationship when trust and technical credibility are still being built.
Evolving the structure over a quarter
- Early on, more of the time typically goes to blockers and establishing trust; the person needs to know the meeting is safe and useful before career conversations will be genuine rather than performative.
- As confidence builds, the balance should shift toward growth and forward-looking conversation, and the blockers segment should shrink because there's simply less friction to clear.
- If that shift isn't happening by mid-quarter, that's itself a signal worth naming directly rather than just continuing to run the same agenda.
Worked example
Situation
Early in a mentoring relationship, our 1:1s were almost entirely blockers: real, legitimate ones, but every week's slot filled up before we got near growth or career topics.
Action
I made an explicit change: reserved the last five minutes for a specific forward-looking question every time, stated as a fixed rule rather than something to get to if there was time, and moved lower-urgency blockers to async channels so they didn't have to consume the live time by default.
Result
By partway through the quarter, the ratio had genuinely shifted: blockers took less of the time because fewer new ones were coming up, and the growth and forward-looking segments started generating real, substantive conversation instead of the same shallow "all good" answer each week.
Trade-offs & pitfalls
- Mistaking a full agenda for a working one. Hitting every segment on the template doesn't mean the 1:1 is actually working if the career and growth segments are consistently shallow.
- Applying the same generic structure to a technical, debugging-heavy role. Forcing a career-conversation template onto a context where live technical problem-solving would be more valuable wastes the time on both sides.
- Not distinguishing skill gap from mindset issue. Responding to a mindset or behavioral pattern with more technical coaching, or the reverse, burns the time without addressing what's actually going on.
- Never revisiting the structure. A rigid agenda that never evolves as the mentee matures signals the relationship isn't actually progressing, even if the meeting keeps happening.
Scenario: Production dashboards show high CPU and battery usage correlated with your app's networking subsystem after a recent release. Describe an investigation plan to find root causes (e.g., excessive concurrent requests, retry storms, not reusing connections), what instrumentation you would add on-device and server-side, and specific remediation steps you might take.
Sample Answer
Clarify scope & goals
- Reproduce: confirm CPU/battery spikes map to networking events (time, release, devices, OS versions).
- Success metrics: reduce CPU by X%, battery drain W%, lower concurrent connections/requests.
Investigation plan
- Triage: collect samples (device logs, crash reports, timeline traces) and correlate with backend metrics (RPS, error rates, latency).
- Reproduce: run on representative devices with profiler (Android Profiler / Xcode Instruments) under realistic network conditions (3G/4G/poor).
- Hypotheses to test: excessive concurrent requests, retry storms, no HTTP connection reuse, busy-waiting threads, expensive serialization.
Instrumentation — on-device
- Add lightweight tracing: record request start/end, thread IDs, queueing delays, retry count, and connection pool hits/misses.
- Periodic battery/CPU samples tagged to current network activity.
- Attach sampling stack traces around heavy CPU windows.
- Metrics upload: aggregate anonymized histograms (per-device, per-OS) to backend for analysis.
Instrumentation — server-side
- Log client identifiers, request timestamps, user-agent, connection reuse (keep-alive) flags, and retry identifiers.
- Expose per-client connection/session counts, error codes, and spike alerts.
- Correlate backend load with client-side traces.
Remediation steps
- Short-term: throttle/consolidate outgoing requests (debounce, batch), cap concurrency per-device, exponential backoff with jitter for retries.
- Medium: enable/reinforce HTTP connection pooling and keep-alive; switch to HTTP/2 where supported to multiplex.
- Long-term: move heavy tasks off main thread, offload to background/scheduled work (JobScheduler/WorkManager, BackgroundTasks), introduce caching, optimize serialization (binary formats) and reduce unnecessary polling.
- Validation: rollout staged canary, monitor instrumented metrics, iterate.
This plan yields concrete data to pinpoint root cause and incremental fixes that minimize user impact while measuring improvement.
You're updating an iOS app's Core Data model: rename attribute title to name on Entity Note, and add a new relationship owner:User. Describe a safe migration plan using lightweight migration where possible. If lightweight migration isn't sufficient, outline a custom migration strategy and how you would test it across multiple app versions with live data.
Sample Answer
Plan overview (goal): rename Note.title → Note.name and add relationship owner:User with minimal user-visible risk. Prefer lightweight migration; fall back to a custom mapping if needed.
Lightweight migration steps
- Create a new Core Data model version (Editor → Add Model Version) and set it as current.
- In the new model: rename attribute
title→name. Set the attribute's Renaming ID to the old name (title) (in Xcode inspector, set "Renaming Identifier"). - Add relationship
owneron Note pointing to User. If owner can be nil for existing records, mark relationship optional. - Enable automatic lightweight migration when adding the store:
swift
let options = [ NSMigratePersistentStoresAutomaticallyOption: true, NSInferMappingModelAutomaticallyOption: true ] container.persistentStoreDescriptions.first?.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey) container.loadPersistentStores(completionHandler: { _, error in ... }) - Reasoning: Renaming with Renaming ID and adding an optional relationship are supported by lightweight inference. This preserves data and requires no custom code.
When lightweight is insufficient
- If owner must be populated from existing info (e.g., Note has ownerID stored externally), or relationship cardinality/transformations are complex, create a custom mapping:
- Create an explicit Mapping Model (File → New → Mapping Model) between old and new versions.
- Implement an NSEntityMigrationPolicy subclass for Note to set the
ownerrelationship during migration:swiftclass NoteMigrationPolicy: NSEntityMigrationPolicy { override func createDestinationInstances(forSource sInstance: NSManagedObject, in m: NSMigrationManager) throws { try super.createDestinationInstances(forSource: sInstance, in: m) let dest = m.destinationInstances(forEntityMappingName: "NoteToNote", sourceInstances: [sInstance]).first as? NSManagedObject if let ownerID = sInstance.value(forKey: "ownerID") as? String { // lookup or create User in destination context then set relationship } } } - Attach the policy to the Note entity mapping in the mapping model.
- Use NSMigrationManager to run the custom mapping when replacing the store.
Testing strategy (across live data / versions)
- Automated migration tests:
- Keep an archive of old model .momd versions. Programmatically load an old store seeded with representative records and run migration code to the new model; assert renamed attribute values and owner relationships.
- Manual / integration testing on devices:
- Build an app binary with the old model, seed devices via TestFlight or local install with realistic data (create notes, set owner scenarios).
- Install new version over the old on device and run acceptance tests covering UI, CRUD, and background sync. Verify no data loss,
namepopulated, andownerset/optional as expected.
- Edge checks:
- Test corrupted/partially-migrated stores — ensure graceful error and clear recovery (backup & restore prompt).
- Test on multiple iOS versions and large stores for performance.
- Rollback / telemetry:
- Log migration success/failure with non-sensitive metrics and provide a safe rollback path (keep pre-migration backup copy of the sqlite + WAL files and surface an in-app restore option for support).
This approach minimizes user disruption, uses lightweight migration where possible, and provides a clear custom path and test plan when transformations require code.
Design a secure authentication flow for a mobile Android app using OAuth2 with refresh tokens. Explain why Authorization Code Flow with PKCE is recommended for mobile, how to store tokens securely (or avoid storing refresh tokens on device), how to implement token refresh and revocation, and how to handle deep links or custom tabs for the authentication flow.
Sample Answer
Clarify goal
Design a secure OAuth2 auth flow for Android using Authorization Code + PKCE, safe token storage, refresh/rotation, revocation, and deep-link/CCT handling.
Why Authorization Code Flow with PKCE
- PKCE prevents code interception on public clients (no client secret).
- Mobile apps are public clients; PKCE ensures exchanged code is bound to the verifier generated by the app.
High-level flow
- App generates cryptographically random code_verifier and code_challenge (S256).
- Open authorization endpoint in Chrome Custom Tab (or system browser) with code_challenge and app redirect URI.
- User authenticates; IdP redirects to app redirect (custom scheme or App Link).
- App exchanges code + code_verifier for access_token ± refresh_token at token endpoint.
Token storage / avoid storing refresh tokens
- Prefer not storing long-lived refresh tokens on device. Options:
- Backend-for-frontend (BFF): app authenticates to your backend; backend holds refresh tokens and issues short-lived app tokens. Best for security.
- If refresh must be on-device: use Refresh Token Rotation (IdP rotates refresh tokens and issues one-time-use tokens) + short lifetime.
- When storing tokens on Android:
- Use Android Keystore + EncryptedSharedPreferences or use AccountManager with encrypted storage.
- Keep access tokens short-lived (minutes); avoid plaintext storage; minimize token scope.
Token refresh & revocation
- Implement refresh token rotation: when refreshing, send refresh_token to token endpoint; replace stored token with new one; detect reuse to force re-auth.
- On refresh failure (invalid/expired) prompt reauth via PKCE flow.
- Revoke tokens on logout: call token revocation endpoint for access and refresh tokens; clear local storage and invalidate session on backend.
- Log out across devices: backend tracks refresh tokens per device and can revoke specific tokens.
Deep links & Custom Tabs
- Use AppAuth Android library or custom flow:
- Preferred: Chrome Custom Tabs or system browser to preserve user credentials and SSO.
- Redirect URI: use App Links (https) when possible to avoid interception; fallback to private-use URI scheme if needed.
- Configure intent filters for redirect; validate state param before exchange to prevent CSRF.
- Close CCT on redirect and handle redirect in a secure activity that completes exchange and clears browser state if needed.
Additional protections
- Always use HTTPS, validate issuer/jwks when parsing ID tokens, verify nonce/state, pin IdP TLS if required, limit scopes, implement device fingerprinting for suspicious refresh attempts.
This design balances usability with defense-in-depth for mobile-specific threats.
Implement rotor-like quick actions (VoiceOver rotor) or equivalent context actions for a complex list where users want to jump between categories (e.g., unread/starred). Describe how to expose these on iOS (UIAccessibilityCustomRotor/UIAccessibilityCustomAction) and the Android equivalents (AccessibilityNodeInfo actions), including code-level details, discoverability, and localization considerations.
Sample Answer
Approach (brief)
Implement platform-specific accessibility actions that let users jump between list categories. On iOS use UIAccessibilityCustomRotor for rotor navigation and UIAccessibilityCustomAction for single actions. On Android add custom AccessibilityAction IDs to AccessibilityNodeInfo and handle them in AccessibilityDelegate/AccessibilityService.
iOS (Swift) — rotor + actions
- Add a rotor to the container (e.g., UITableView/UICollectionView):
let unreadRotor = UIAccessibilityCustomRotor(name: NSLocalizedString("Unread", comment:"Rotor: unread")) { predicate in
// find next unread cell after predicate.currentItem.targetElement
return UIAccessibilityCustomRotorItemResult(targetElement: nextUnreadElement, targetRange: nil)
}
UIAccessibility.customRotors = [unreadRotor, /* starred rotor */]
- Add custom actions for long-press or action menus:
cell.accessibilityCustomActions = [
UIAccessibilityCustomAction(name: NSLocalizedString("Jump to Unread", comment:""), target: self, selector: #selector(jumpToUnread))
]
- Ensure each element has meaningful accessibilityLabel, traits, and accessibilityValue; use accessibilityHint for action purpose.
Android (Kotlin) — actions
- In onInitializeAccessibilityNodeInfo:
info.addAction(AccessibilityNodeInfo.AccessibilityAction(
R.id.action_jump_unread, context.getString(R.string.jump_unread)
))
- Handle in AccessibilityDelegate or performAccessibilityAction:
override fun performAccessibilityAction(action: Int, args: Bundle?): Boolean {
if (action == R.id.action_jump_unread) { scrollToUnread(); return true }
return super.performAccessibilityAction(action, args)
}
- For TalkBack rotor-like motion, expose collection info and custom actions; newer Android releases support accessibility shortcuts and navigation granularity — implement AccessibilityService shortcuts if app-wide rotor is required.
Discoverability
- Provide clear accessibilityHint text and announce actions when focused (UIAccessibility.post(notification: .announcement,...)). Add a visible Help/Accessibility Settings screen that documents rotor names and available actions.
- For iOS, rotors appear in VoiceOver rotor menu; ensure names are short and prioritized by order in UIAccessibility.customRotors.
- For Android, actions appear in TalkBack local context menu and via swipe gestures; ensure action labels are concise.
Localization & Testing
- Localize all action and rotor names with NSLocalizedString / Android string resources, including context comments.
- Test with VoiceOver and TalkBack in multiple languages and with different rotor/action orders. Verify dynamic content changes post notifications to update rotor results.
Trade-offs & Notes
- Rotors are best for repeated granular navigation; custom actions are suited for one-off jumps. Keep rotor count reasonable to avoid clutter.
In Kotlin, implement a thread-safe in-memory LRU cache class for Bitmaps with a configurable maximum size in bytes. API should include get(key), put(key, bitmap, sizeInBytes), and automatic eviction of least-recently-used entries until total size is below the limit. Operations must be O(1). Provide the class structure, key data structures used (LinkedHashMap or custom doubly-linked list + hashmap), and note concurrency considerations.
Sample Answer
Approach (brief)
Use a LinkedHashMap with accessOrder = true to maintain LRU ordering and a running total size. Keep O(1) get/put by map operations and update size on insert/remove. Ensure thread-safety with a single ReentrantLock (or synchronize) to avoid race conditions during reads/writes and eviction.
Kotlin implementation
import android.graphics.Bitmap
import java.util.LinkedHashMap
import java.util.concurrent.locks.ReentrantLock
import kotlin.concurrent.withLock
class LruBitmapCache(private val maxBytes: Long) {
private val lock = ReentrantLock()
// accessOrder=true -> iteration order is LRU -> MRU
private val map = object : LinkedHashMap<String, Bitmap>(16, 0.75f, true) {}
private var currentSize = 0L
fun get(key: String): Bitmap? = lock.withLock {
return map[key] // accessOrder ensures this marks it as recently used
}
fun put(key: String, bitmap: Bitmap, sizeInBytes: Int) = lock.withLock {
val prev = map.put(key, bitmap)
if (prev != null) {
currentSize -= sizeOf(prev)
}
currentSize += sizeInBytes
evictIfNeeded()
}
private fun evictIfNeeded() {
val iter = map.entries.iterator()
while (currentSize > maxBytes && iter.hasNext()) {
val entry = iter.next()
val removed = entry.value
currentSize -= sizeOf(removed)
iter.remove()
// optionally recycle bitmaps: removed.recycle()
}
}
private fun sizeOf(bitmap: Bitmap): Int {
// API-safe: bytes per row * height or bitmap.byteCount on newer APIs
return bitmap.byteCount
}
}
Key points & trade-offs
- Data structures: LinkedHashMap(accessOrder=true) + hashmap semantics -> O(1) lookup and ordering.
- Concurrency: ReentrantLock ensures atomic get/put/evict. For higher read concurrency, consider ReadWriteLock or lock striping, but must ensure consistent size accounting.
- Eviction: done inside put while holding lock to avoid races.
- Memory: track byte sizes precisely; handle large single items (if item > maxBytes decide to reject or clear cache first).
- Android notes: consider using Bitmap.recycle() if appropriate and watch for bitmap.byteCount availability across API levels.
Implement an LRU cache in Swift with O(1) get(key:) and put(key:value:) operations. Describe the data structures you will use and provide Swift code showing the core logic (dictionary + doubly-linked list). Discuss thread-safety options for use from multiple threads and how to account for item costs such as image byte size.
Sample Answer
Approach (brief)
Use a Dictionary<Key, Node> for O(1) lookups and a doubly-linked list to maintain recency (head = most-recent, tail = least-recent). Each Node stores key, value, cost (e.g., image byte size). Track totalCost and evict from tail until under capacity.
Swift implementation (core logic)
final class LRUCache<Key: Hashable, Value> {
private class Node {
let key: Key
var value: Value
var cost: Int
var prev, next: Node?
init(key: Key, value: Value, cost: Int) {
self.key = key; self.value = value; self.cost = cost
}
}
private var map = [Key: Node]()
private var head: Node?
private var tail: Node?
private var totalCost = 0
private let capacityCost: Int
init(capacityCost: Int) { self.capacityCost = capacityCost }
private func moveToHead(_ node: Node) {
guard head !== node else { return }
// unlink
node.prev?.next = node.next
node.next?.prev = node.prev
if tail === node { tail = node.prev }
// insert at head
node.next = head
node.prev = nil
head?.prev = node
head = node
if tail == nil { tail = head }
}
private func insertAtHead(_ node: Node) {
node.next = head; node.prev = nil
head?.prev = node; head = node
if tail == nil { tail = head }
}
private func removeTail() -> Node? {
guard let node = tail else { return nil }
map[node.key] = nil
totalCost -= node.cost
if head === tail {
head = nil; tail = nil
} else {
tail = node.prev
tail?.next = nil
}
return node
}
func get(_ key: Key) -> Value? {
guard let node = map[key] else { return nil }
moveToHead(node)
return node.value
}
func put(_ key: Key, value: Value, cost: Int = 1) {
if let node = map[key] {
totalCost -= node.cost
node.value = value
node.cost = cost
totalCost += cost
moveToHead(node)
} else {
let node = Node(key: key, value: value, cost: cost)
map[key] = node
insertAtHead(node)
totalCost += cost
}
// Evict while over capacity
while totalCost > capacityCost {
_ = removeTail()
}
}
}
Complexity
- get / put: O(1) time; space O(n).
Thread-safety options
- For simple use, wrap public methods with a serial DispatchQueue (DispatchQueue(label:..., attributes: .concurrent) with .barrier for mutations) or use os_unfair_lock/NSLock for low-latency locking.
- Example: use private let queue = DispatchQueue(label: "lru.cache", attributes: .concurrent); read via queue.sync, writes via queue.async(flags: .barrier) to avoid races and keep reads concurrent.
Accounting for item costs (images)
- Provide cost parameter (bytes) per put; maintain totalCost; evict least-recent until totalCost <= capacityCost. For images, use image.pngData()?.count or image.costForCaching API; consider approximate costs to avoid expensive size computations.
Edge cases & notes
- Handle large single-item cost > capacity (optionally reject or allow by evicting all others).
- Consider weak references if values should be released when not strongly held elsewhere (NSCache alternative).
An app that runs on user devices needs a feature that calls a vendor API requiring a secret key. How do you avoid shipping that key in the client while still delivering the feature, and what do you do if the key leaks?
Sample Answer
The idea in plain words
Anything shipped inside an app on a user's device can be extracted by that user: strings, obfuscated or not, can be read from the binary or seen by watching the app's network traffic. So a secret key must not be in the client. The feature is delivered by moving the secret-holding call to a server you control: the app calls your backend, your backend attaches the key and calls the vendor.
The approach
-
Add a backend endpoint (a thin proxy: a small server-side relay that forwards one kind of request on the app's behalf) for just this feature. The app calls
POST /v1/translateon your server; the server adds the vendor key from its secret store (the protected place the server reads its secrets from, such as environment variables injected at deploy time or a vault) and calls the vendor. The key never leaves the server.An illustrative exchange, with an invented vendor host and parameter names, showing where the key sits. The app sends no vendor key, only the user's own session token:
POST /v1/translate HTTP/1.1 Host: api.yourapp.example Authorization: Bearer <user session token> Content-Type: application/json {"text": "Good morning", "target": "fr"}Your server checks the session, applies its limits, then makes its own call to the vendor, where the secret is added:
POST /translate HTTP/1.1 Host: api.vendor.example Authorization: Bearer <VENDOR_SECRET_KEY, read from the server's secret store> Content-Type: application/json {"text": "Good morning", "target": "fr", "model": "fixed-on-the-server"}The vendor's reply is passed back to the app as
200 OKwith only the field the app needs, such as{"translation": "Bonjour"}. TheAuthorizationheader with the secret exists only on the second hop. -
Authenticate the app's caller to your backend, using the user's session or token, so only signed-in users can spend your quota. Where available, add app attestation (a platform service that gives your server evidence the request comes from a genuine, unmodified app install); treat it as a signal that raises the cost of abuse, not as proof.
-
Do not make the proxy a generic pipe. Expose only the operations the feature needs, validate and size-limit inputs, fix the vendor model or parameters on the server, and strip what the vendor does not need. An open relay (a proxy that forwards whatever it is given, to wherever it is told) lets anyone use your key through your server.
-
Rate-limit and budget per user and per device (and in total), since the vendor charges you. Return 429 with Retry-After when exceeded: 429 is the HTTP status code for Too Many Requests, and the
Retry-Afterheader tells the client how many seconds to wait before trying again. Illustratively, a user who has used 100 of 100 daily calls, with 18,000 seconds (5 hours) left in the window, getsHTTP/1.1 429 Too Many RequestswithRetry-After: 18000and a short JSON body saying the daily limit was reached. -
Prefer vendor-issued short-lived, scoped client tokens if the vendor offers them: your server mints a scoped client token (one limited to named operations, for example translate only, so a stolen copy can do little) valid for minutes, and the app talks to the vendor directly with it. This keeps heavy traffic (for example uploads) off your servers. The long-lived secret stays on the server.
-
Check whether the key is meant to be public. Some vendors issue a restricted "publishable" key that is safe in a client because it can do only limited things (and can be restricted by app identity or domain). A secret key that can create charges or read data is not that.
Worked scenario (assumed numbers)
Assume the vendor bills per call and a normal user makes about 20 calls a day. A per-user cap of 100 calls a day is 5 times normal use (100 / 20 = 5): generous for real users, and a stolen account can cost at most 100 calls a day. Without a cap, one script using the leaked key is bounded only by the vendor's own limits.
If the key leaks
- Rotate: create a new key at the vendor and deploy it to the server. Because the app never held the key, no app update is needed and old app versions keep working. That is the main operational payoff of the proxy.
- Revoke the old key at the vendor as soon as the new one is live (or immediately if abuse is under way, accepting a short outage).
- Review vendor usage logs and billing for the exposure window; ask the vendor to credit fraudulent usage if their terms allow.
- Find the leak path (repository history, logs, a build artifact, a crash report) and fix it; scan history for other secrets.
- Add detection: alerts on spend or request spikes, and secret scanning in CI.
If the design had embedded the key in the app, rotation would require shipping a new app version and waiting for users to update, while the old key stays valid until you revoke it and break every old install. That asymmetry is the reason to take the proxy route.
Trade-offs
The proxy adds a hop (latency, a service to run and scale) and makes your server a rate-limit and cost control point. For low volume this is trivial; for heavy payloads, short-lived tokens avoid proxying the bytes.
Common mistakes
- Believing obfuscation or splitting the key into pieces protects it. It slows casual reading only.
- Authenticating the proxy with another static secret in the app, which moves the problem.
- A proxy that forwards arbitrary vendor paths.
- No per-user limits.
Define optimistic versus pessimistic updates. Give two cases where each is the better choice, and say what the user should see when an optimistic update fails.
Sample Answer
Direct answer
An optimistic update changes the screen immediately, as if the server had already accepted the action, then sends the request and corrects the screen if it fails. A pessimistic update waits for the server's answer before changing the screen, usually showing a pending state meanwhile. Choose optimistic when the action almost always succeeds, is cheap to undo, and the server adds nothing the user needs to see; choose pessimistic when failure is plausible, the effect is costly or irreversible, or the result depends on something only the server knows. When an optimistic update fails, the user should see their change reverted, a short message next to where they acted saying what did not save, and a way to retry without retyping.
Two cases where each is better
| Update style | Case | Why it fits |
|---|---|---|
| Optimistic | Liking, bookmarking or ticking a checkbox | Succeeds almost always, one tap undoes it, a wrong count for a second harms nobody |
| Optimistic | Dragging a card to a new column on a board | The result is visible only after the move, and waiting would make the drag feel broken. The server's rejection is rare and the card can slide back |
| Pessimistic | Paying for an order or transferring money | Failure is plausible (declined card), the effect is costly, and showing "Paid" and then taking it back damages trust |
| Pessimistic | Booking the last seat or claiming a unique username | Only the server knows whether it is still free, so any optimistic answer is a guess that will often be wrong, and the server may also assign the id, price or confirmation number |
Other signals: an action that triggers side effects outside the browser (an email is sent, a permission is granted) is pessimistic even if it usually works. An action that fails often because of validation should be validated on the client first and then treated as optimistic or pessimistic by its remaining failure rate.
Worked example: the like button
The server holds liked = false, count = 41.
- The user taps. The UI shows
liked = true,count = 42at once and remembers what it replaced (false,41). - The request returns 500. The UI restores
false,41, shows "Couldn't save your like. Try again" beside the button, and keeps the button usable. - Whether it succeeds or fails, the reliable last step is to refetch the real value, so the screen ends up matching the server rather than matching the client's guess.
The TanStack Query documentation describes this: when you update optimistically "there is a chance that the mutation will fail", in which case "you can instead choose to roll back your update", and for many failures "you can just trigger a refetch for your optimistic queries to revert them to their true server state" (TanStack Query v5, Optimistic Updates).
What breaks rollback: overlapping updates
Restoring "the previous value" is wrong when two requests for the same item are in flight. Trace it with the like button, starting at liked = false, count = 41:
| Step | Screen | Snapshot saved for rollback |
|---|---|---|
| Tap 1 (like) | liked, 42 | A = (not liked, 41) |
| Tap 2 (unlike) before tap 1 returns | not liked, 41 | B = (liked, 42) |
| Request 1 fails | restore A: not liked, 41 | |
| Request 2 fails | restore B: liked, 42 |
The server never accepted either request, so the true state is not liked, 41, but restoring snapshots left the screen on liked, 42. Two safer designs: refetch when the last in-flight request settles and show the server value, or compute the screen as "server value plus the edits still in flight" and drop only the failed edit. Either way the rollback must be tied to the specific change that failed.
What the user should see on failure, in order
- The value goes back, so the screen never keeps showing something the server does not have.
- A message at the place of the action that names the action ("Couldn't save your like"), not a generic "Error". If the user has already moved to another screen, use a toast (a small message that appears over the screen for a few seconds without blocking it) that identifies the item. On a phone, where the list the user acted on may no longer be visible, the toast carries the whole message: for example "Couldn't save your like on 'Trip to Lisbon'. Tap to retry", with the item's name and a retry action in the same message.
- Their work is not lost. For a typed comment, keep the text in the field and offer Retry; reverting the field to empty would turn a network blip into data loss.
- A way forward: Retry for transient failures (timeouts, and 5xx responses: HTTP status codes from 500 to 599, meaning the server failed rather than the request being wrong), and a specific explanation for rejections the user can fix (validation, permission).
- Announce it to assistive technology, for example by putting the message in an element with
role="alert"(an HTML attribute that makes a screen reader, the software that reads the page aloud to blind users, speak the message as soon as it appears) and test it with a screen reader.
Pessimistic done well
Waiting is not the same as freezing: disable the control, show a spinner or "Saving...", prevent double submission (disable after the first click, or send an idempotency key: a unique token the client attaches to the request so that the server, if it receives the same token twice, performs the action once), and change the screen only on success. If latency is the complaint, a middle path is to show the pending item in a "sending" style and mark it confirmed on success, which is optimistic in layout but honest in state.
Pitfalls
- Optimistic code needs a failure path, a rollback that survives overlapping requests, and a refetch; if a feature will not get all three it is cheaper to be pessimistic.
- Do not make an optimistic update look final: no success toast, confirmation email or navigation until the server confirms.
- Test the failure path deliberately (a mocked 500, an offline toggle), because it is the part that rarely runs in development.
In Flutter, StatefulWidgets often create objects like AnimationController or TextEditingController. Provide a compact code example that correctly creates these controllers in initState and disposes them in dispose. Explain why forgetting to call dispose causes leaks and how this appears in Flutter DevTools memory graphs.
Sample Answer
Approach (brief)
Create controller instances in initState and dispose them in dispose to free native resources and stop listeners/animations.
Code example
import 'package:flutter/material.dart';
class MyWidget extends StatefulWidget {
@override
_MyWidgetState createState() => _MyWidgetState();
}
class _MyWidgetState extends State<MyWidget> with SingleTickerProviderStateMixin {
late final AnimationController _animController;
late final TextEditingController _textController;
@override
void initState() {
super.initState();
_animController = AnimationController(vsync: this, duration: Duration(seconds: 1));
_textController = TextEditingController();
}
@override
void dispose() {
_animController.dispose();
_textController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => Container();
}
Why dispose matters
Controllers hold native handles, timers, or listeners. If not disposed they remain referenced (listeners still registered), preventing GC → memory leaks, CPU usage from running animations.
How it shows in DevTools
- Heap snapshot shows retained instances (AnimationController/TextEditingController) and their listeners.
- Memory chart may grow over time; object count increases after screen navigation.
- Retaining paths trace shows why GC can’t collect them (active listener from framework).
Recommended Additional Resources
- LeetCode (Medium-Hard Mobile Development Problems)
- HackerRank Mobile Development Challenges
- Apple Developer Documentation (Swift, UIKit, SwiftUI, Concurrency)
- Android Developer Documentation (Kotlin, Jetpack, Architecture Components)
- System Design Primer (for mobile architecture design)
- "Designing Data-Intensive Applications" by Martin Kleppmann (relevant for mobile scale considerations)
- FAANG company mobile blog posts and engineering publications
- Ray Wenderlich tutorials (iOS and Android)
- CodePath Android Guides
- "Swift Programming Language" official guide by Apple
- "Kotlin Coroutines: Deep Dive" by Marcin Moskala
- Mobile performance profiling tools documentation (Instruments for iOS, Android Profiler)
- "Building Great Mobile Apps" - Modern app architecture patterns
- Cracking the Coding Interview by Gayle Laakmann McDowell (general interview prep)
- Mock interview platforms: Pramp, InterviewBit for mobile-specific challenges
Search Results
Meta Software Engineer Interview (questions, process, prep)
Ace the Meta software engineer interviews with this preparation guide. See updates to the interview process, example coding interview questions and ...
Top 25 Mobile App Developer Interview Questions and Answers for ...
... guide common questions” “mobile application developer job interview questions and answers examples ... Senior Android Developer position - 14 Questions.
A Guide on Apple Phone Interview Questions
In this article, we'll discuss Apple's phone interview process — what it is, how you can prepare, and tips to help you during the interview ...
How Can Mobile App Developers At Garage2Global Prepare To Ace ...
Researching the typical interview flow for mobile developers helps you target preparation (screen, technical phone screen, coding challenge, onsite or virtual ...
Top 35+ UI Developer Interview Questions and Answers for 2026
Basic UI Developer Interview Questions · 1. What exactly is the role of a UI developer? · 2. What's the difference between a UI developer and a UX developer? · 3.
This interview preparation guide was generated using AI-powered research from the sources listed above. While we strive for accuracy, we recommend verifying critical information from official company sources.
Want to create your own tailored preparation guide using our deep research?
Get Started for FreeInterview-Ready Courses
Visual-first, interactive, structured learning paths
Browse Mobile Developer jobs
AI-enriched listings across hundreds of company career pages
Explore Jobs