← Közös mobilalkalmazás-alapok csapata adatlapja
Nézd meg, miben segít
1. Handle every lifecycle transition (
Ellenálló mobiléletciklus
Megőrzi a fontos állapotot háttérbe kerülés, folyamatleállás, hálózatváltás és újrahitelesítés közben.
mobile-lifecycle-resilience
Ezt a skillt használó csapattagok
Mikor hasznos?
Akkor használd, ha visszatéréskor munka vész el vagy dupla kérés indul.
Miben segít neked?
- Meghatározza a helyreállítást aktív, inaktív, háttér- és leállt állapotból.
- Kezeli a megszakadt átvitelt és hálózati kapcsolatváltást.
- Egyetlen tokenfrissítést koordinál, felszabadítja a figyelőket és erőforrásokat.
Például ezt kérheted
Folytass feltöltést hálózatváltás és újraindulás után második szerveroldali elem létrehozása nélkül. Válts wifiről mobilnetre, állítsd le az alkalmazást, majd nyisd újra. Visszaigazolt állapottól folytasson, és egy kész távoli objektum legyen.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Mobile Lifecycle & Resilience
Mobile apps run in an interruptible environment: phone calls, app switching, OS memory pressure, process death and radio handoffs (Wi-Fi to cellular) happen mid-operation. Design every flow to survive interruption without losing user work or leaking resources.
1. Handle every lifecycle transition (active / inactive / background / process death)
- On
inactive/background(AppStatein React Native,AppLifecycleListenerin Flutter,ScenePhase/LifecycleObserverin native):- Immediately pause camera previews, audio/video playback, high-frequency timers, sensor/GPS polling and continuous animations.
- Flush or checkpoint unsaved form drafts and in-progress state to local storage synchronously or immediately—the OS may kill the backgrounded process without further warning.
- On
active(foreground resume):- Re-validate session/token expiry, refresh stale time-sensitive queries, and reconcile the status of any in-flight mutation or payment that was interrupted.
- Re-check runtime permissions (camera, location, notifications) that the user may have toggled in OS Settings while away.
- OS process death & state restoration: never rely solely on in-memory singletons surviving backgrounding; restore screen routes by ID and reload data or persisted drafts on cold/warm restart.
2. Flaky networks, radio switches and interrupted transfers
- Connectivity != reachability:
NetInfo/connectivity_plusreporting Wi-Fi does not mean the API is reachable (captive portals, blackholed cellular handoffs). Enforce explicit connect/read timeouts (10-30s) and distinguish network/timeout errors from4xxbusiness rejections. - Never destroy user input on failure: if a form save, comment or upload fails due to a timeout or connection drop, keep the user's draft intact on screen and provide a clear Retry action.
- Background & chunked transfers: iOS and Android throttle background sockets within seconds; for large media uploads/downloads, show progress, support cancellation/resume, and use OS background transfer APIs (
URLSessionbackground config, AndroidWorkManager,expo-file-systembackground tasks) when work must survive app switching.
3. Single-flight token refresh and resource cleanup
- Guard
401 Unauthorizedtoken refresh with a single-flight mutex/promise so 5 concurrent requests resuming after foregrounding await one refresh call instead of racing and triggering false logouts. - Remove every
AppState,NetInfo, keyboard, notification, stream and timer listener inuseEffectcleanup /dispose()/onCleared().
Before you finish
- Backgrounding pauses sensors/media/timers and checkpoints unsaved drafts before potential OS process death.
- Foregrounding refreshes stale data, reconciles pending work and re-verifies OS permissions.
- Network timeouts/drops preserve user input and offer safe retry without infinite loops.
- Concurrent 401 token refreshes share a single-flight lock; all listeners and timers are cleaned up.
Csomagban lévő fájlok 2
LICENSE.txtSKILL.md
