Loading...
Loading...
Use for ANY task that ports or implements Android functionality from an iOS/Swift codebase — including single-feature tasks (BLE scanning, location/GPS tracking, billing, Health Connect, background work, database, one screen), not just full-app migrations. Primary coordinating skill for migrating iOS apps and subsystems to Android (Jetpack Compose, Room, Kotlin Coroutines and Flow, Architecture Components). Handles both full-app greenfield migrations and scoped sub-component feature migrations: Info.plist permissions and AndroidManifest.xml mapping (Android 14+ runtime permissions and foreground service types), SwiftUI views and screen layouts, CoreData/Room, StoreKit/Google Play Billing (in-app subscriptions and purchases), HealthKit/Health Connect, CoreBluetooth/BLE, CoreLocation/GPS, BGTaskScheduler/WorkManager, and UserDefaults/DataStore. Don't use for Android-only work with no iOS source, for converting Android XML Views to Compose, or for building or changing iOS apps.
npx skill4agent add android/skills ios-to-androidreferences/references/[!IMPORTANT] Important: This gate is mandatory. Readingalone is not sufficient to complete a migration --- this root document is an index and a set of invariants; the reference guides hold the actual API-level implementation patterns. Skipping them is the single most common cause of mock-stub managers, missing runtime permissions, and non-idiomatic layouts that compile cleanly and then fail review.SKILL.md
.migration/migration_walkthrough.md## Reference Guides Consulted.migration/feature_specification.mdreferences/./gradlew assembleDebug./gradlew assembleDebug./gradlew testWaitMsBeforeAsync: 10000write_to_filereplace_file_contentapp/src/main/java/gradle/libs.versions.tomldata/domain/ui/feature/home/feature/catalog/@Inject@HiltViewModel@InstallInAppContainer@Module@ProvidesStateFlow<UiState>MutableState@IoDispatcherDispatchers.IOui/theme/AppButtonAppCardgradle/libs.versions.tomlfind . -maxdepth 3 -type dPodfilePackage.swiftCartfilefeature_specification.md.migration/| Detected iOS Indicator / Code Pattern | Supplemental Reference Guide | Android Target Architecture |
|---|---|---|
| references/ui-layout-swiftui-to-compose.md | Jetpack Compose (LazyColumn, Row, Column, Box) |
| references/database-coredata-to-room.md | Jetpack Room, SQLite, KSP |
| references/location-fusedprovider.md | FusedLocationProviderClient / LocationManager |
| references/in-app-billing.md | Google Play Billing Library 8 |
| references/health-connect.md | Jetpack Health Connect |
| references/bluetooth-ble.md | Android BLE GATT & Scanner |
| references/camera-camerax.md | Jetpack CameraX (PreviewView, ImageAnalysis) |
| references/push-notifications-fcm.md | NotificationManager & FCM |
| references/background-tasks-workmanager.md | Android WorkManager (CoroutineWorker) |
| references/preferences-datastore.md | Jetpack Preferences DataStore |
| references/navigation-compose.md | Navigation Compose with Type-Safe Routing |
| references/ui-animations.md | Jetpack Compose Animation APIs |
| references/testing-unit-and-compose.md | JUnit5, MockK, ComposeTestRule |
| references/screenshots-screengrab.md | Fastlane Screengrab, UI Automator |
| iOS Framework / Capability | Android Runtime Mechanism | Dedicated Android Contract / API |
|---|---|---|
Standard Runtime Permissions ( | Activity Result Launcher | |
HealthKit ( | Health Connect Permission Contract | |
Photo Library ( | Activity Result Photo Picker | |
Document Picker ( | Storage Access Framework | |
In-App Purchases / Subscriptions ( | Play Billing Flow | |
| Android 14+ Foreground Services | Manifest Service Declaration | `<service android:foregroundServiceType="health |
[!IMPORTANT] Important: Android 14+ (API 34+) Manifest & Foreground Service Rules : 1. Foreground Service Types : Anytag in<service>that runs in the foreground MUST specifyAndroidManifest.xmlmatching the exact permissions and functionality used (e.g.android:foregroundServiceType,health,location,dataSync,camera). Omitting this attribute will trigger a runtimeconnectedDeviceon Android 14+. 2.SecurityExceptionHealthKit Mapping (Info.plist/NSHealthShareUsageDescription) : Always map iOS HealthKit privacy keys inNSHealthUpdateUsageDescriptionto Android 14+ Health Connect permissions (AndroidManifest.xml,android.permission.health.READ_STEPS,android.permission.health.READ_HEART_RATE, etc.) alongsideandroid.permission.health.READ_ACTIVE_CALORIES_BURNED.<queries><package android:name="com.google.android.apps.healthdata" /></queries>
libs.versions.tomlMainActivity.ktdata/local/data/preferences/domain/model/ui/navigation/ui/screens/ui/theme/MainActivity.ktenableEdgeToEdge()NavHostdata/local/data/preferences/@Entity@DaoFlow<List<T>>RoomDatabaseDataStore<Preferences>res/values/strings.xmlui/theme/Theme.ktres/values/strings.xmlColorSchemeTheme.ktui/navigation/NavGraph.ktNavHostlaunchSingleTop = truerestoreState = trueNavHostNavHostnavController.navigate(...)AndroidManifest.xmlrememberLauncherForActivityResult(ActivityResultContracts.RequestMultiplePermissions())ui/screens/*.ktViewModelcollectAsStateWithLifecycle()collectAsState()LazyColumnkey = { ... }settings.gradle.ktsbuild.gradle.ktsapp/build.gradle.ktsMainActivity.ktsettings.gradle.ktsbuild.gradle.ktsapp/build.gradle.ktsnamespaceapplicationIdMainActivity.ktdata/local/data/preferences/domain/model/ui/navigation/ui/screens/ui/theme/app/build.gradle.ktsgradle/libs.versions.tomlapp/build.gradle.ktsimport HealthKitminSdk = 26defaultConfig {}implementation("androidx.health.connect:connect-client:1.1.0-alpha07")implementation("com.google.guava:guava:33.0.0-android")dependencies {}import StoreKitimplementation("com.android.billingclient:billing-ktx:8.3.0")dependencies {}import BackgroundTasksimplementation("androidx.work:work-runtime-ktx:2.9.0")dependencies {}import CoreLocationimplementation("com.google.android.gms:play-services-location:21.2.0")dependencies {}settings.gradle.ktsbuild.gradle.ktsgradle/libs.versions.toml.xcassetsres/mipmap-anydpi-v26/ic_launcher.xmlLocalizable.stringsres/values/strings.xmlUserDefaults@AppStorageRoomDatabase.Callback.sqliteonCreate().sqliteassets/createFromAsset()@EntityZ*IllegalStateException: Pre-packaged database has an invalid schemaassembleDebugcreateFromAsset()IllegalStateExceptionsuspendFlowinit {}runBlockingviewModelScopeDispatchers.IORoomDatabase.CallbackallowMainThreadQueries()asyncawaitViewModelSavedStateHandle@State@BindingmutableStateOfStateFlowSharedFlowcollectAsStateWithLifecycleStateFlowSharedFlowcollectAsStateWithLifecycle()androidx.lifecycle.compose.collectAsStateWithLifecyclecollectAsState()collectAsState()AppContainer.ktMainActivity.ktItemRepository(context = this, api = api)local.propertiesbuildConfigFieldval CustomBrandBlue = Color(...)Assets.xcassetsColorSchemeui/theme/Theme.ktprimarysecondarytertiarysurfacesurfaceVarianterrorExtendedColorSchemeCompositionLocalProviderMaterialTheme.colorScheme.<slot>enableEdgeToEdge()WindowInsets@Preview@ComposablerememberLauncherForActivityResult(ActivityResultContracts.RequestMultiplePermissions())PermissionController.createRequestPermissionResultContract()registerForActivityResult()MainActivity.ktRowTextColumnButtonTextFilterChipSegmentedButtonIconButtonSwitchModifier.weight(1f)maxLines = 1TextArrangement.SpaceBetweenModifier.weight(1f)Text("Literal")LocalizedStringKeyText("Literal")contentDescriptiontexttitlelabelstringResource(R.string....)strings.xmlstrings.xmlString(localized:)NSLocalizedStringL10nR.string<string name="trail_distance">Distance: %1$s</string>stringResource(R.string.trail_distance, distance)@StringRes IntStringcontext.getString(...)Info.plistrememberPermissionRequestAndroidManifest.xmlPreviewViewAndroidViewImageCaptureWorkManager[!CAUTION] Caution: Non-Negotiable Real Platform SDK Contract (Never Write Pure Mock Managers) : iOS codebases often include Simulator fallbacks or dummy data inside their platform-service managers (for example HealthKit, CoreBluetooth, StoreKit, CoreLocation, background tasks, camera, push notifications, MapKit or CloudKit). When migrating (including full-app Mode A migrations), you MUST NOT replace platform SDKs with pure mock timers or. Implement the real Android SDK in each manager/service class. Wrap hardware/SDK calls inSharedPreferencesso JVM unit tests and devices without the hardware or SDK don't crash; this covers missing hardware , never missing permissions --- check the permission first, then call insidetry/catch. Sample/demo data is allowed only as a fallback when the SDK is unavailable or the user denies permission: never mixed into real results, and never granting an entitlement. If the source gates sample/demo data behind a user setting, debug flag ortry/catch, port that gate (a DataStore preference or#if targetEnvironment(simulator)); never call a demo-data loader unconditionally fromBuildConfig.DEBUGor from a scan/read entry point. 1. Runtime permissions : see Runtime Permission Invariants below.initis not a permission implementation; it is allowed only on a call site guarded by@SuppressLint("MissingPermission"). 2. Health Connect :ContextCompat.checkSelfPermission(...) == PackageManager.PERMISSION_GRANTED,HealthConnectClient.getOrCreate(context)/HealthPermission.getReadPermission(...)for the record types matching the HealthKit types the source app reads and writes,getWritePermission(...)andreadRecords(ReadRecordsRequest(...)). See references/health-connect.md. 3. Google Play Billing :insertRecords(...); aBillingClient.newBuilder(context).setListener(purchasesUpdatedListener).enablePendingPurchases(PendingPurchasesParams.newBuilder().enableOneTimeProducts().build()).build()whoseBillingClientStateListeneractually reconnects (for example with exponential backoff, or reconnect-on-next-request) rather than only logging;onBillingServiceDisconnected(),queryProductDetailsAsync, andlaunchBillingFlow(activity, params). Placeholder prices may be displayed as a fallback, but a purchase with no ready client or no Activity fails --- delete mock purchase code rather than keeping it as anacknowledgePurchasebranch. See references/in-app-billing.md. 4. Bluetooth LE :else→BluetoothManagerwith a concreteBluetoothLeScanner.startScan(filters, settings, scanCallback), and a concreteScanCallback(BluetoothGattCallback,onConnectionStateChange,onServicesDiscoveredparsing the GATT characteristics the iOS code reads). Manifest:onCharacteristicChanged(withBLUETOOTH_SCANunless location is derived from scans) andandroid:usesPermissionFlags="neverForLocation", both requested at runtime; legacyBLUETOOTH_CONNECT/BLUETOOTHand any scan-onlyBLUETOOTH_ADMINlimited withACCESS_FINE_LOCATION. See references/bluetooth-ble.md. 5. Location :android:maxSdkVersion="30"withLocationServices.getFusedLocationProviderClient(context)and aLocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, intervalMillis)(LocationCallback/requestLocationUpdates). When tracking must continue after the UI leaves the screen (iOSremoveLocationUpdates/allowsBackgroundLocationUpdates), add aUIBackgroundModes: locationthat callsServicewith an ongoing notification, declared withstartForegroundplusandroid:foregroundServiceType="location"andFOREGROUND_SERVICE. Don't declareFOREGROUND_SERVICE_LOCATIONunless a code path reads location with no visible UI and no foreground service; never declare permissions the migrated code doesn't use. See references/location-fusedprovider.md. 6. WorkManager : aACCESS_BACKGROUND_LOCATIONscheduled withCoroutineWorker, mirroring the iOS task's cadence and constraints. See references/background-tasks-workmanager.md.WorkManager.getInstance(context).enqueueUniquePeriodicWork(..., ExistingPeriodicWorkPolicy.KEEP, PeriodicWorkRequestBuilder<...>(...).setConstraints(...).build())
rememberPermissionRequest[!CAUTION] Caution: The runtime prompt MUST be the real Android system dialog, launched throughfrom the user action that needs the permission, and a screen MUST still render its content when a permission is not granted. These shapes are a failed migration : * ❌ A utility object of staticrememberLauncherForActivityResulthelpers. Checking is not requesting. * ❌ A permission helper or launcher that is defined or imported but never invoked from a screen. * ❌hasXPermission(). Permission state may disable a control or populate an empty state; it must never replace the screen.if (granted) ScreenContent() else PermissionScreen()
BLUETOOTH_SCANBLUETOOTH_CONNECTCAMERAPOST_NOTIFICATIONSLaunchedEffectPermissionController.createRequestPermissionResultContract()RequestMultiplePermissions()permissionController.getGrantedPermissions()./gradlew compileDebugKotlinViewModelScreen ComposableRouteViewModel./gradlew compileDebugKotlin./gradlew :app:assembleDebug./gradlew :app:testDebugUnitTestsetContent { Text("test") }MainActivity.ktAndroidManifest.xmlCAMERAText("text = "title = "label = "contentDescription = "setContentTitle("setContentText("$strings.xmlcreateFromAsset()./gradlew :app:assembleDebug./gradlew :app:testDebugUnitTestsnapshotfeature_specification.md.migration/migration_walkthrough.mdnamespaceapplicationIdapp/build.gradle.ktslibs.versions.tomlNavHostAndroidManifest.xmlInfo.plistrememberLauncherForActivityResult(ActivityResultContracts.RequestMultiplePermissions())res/values/strings.xml@Entity@DaoRoomDatabaseFlowDataStore<Preferences>feature_specification.md./gradlew assembleDebug./gradlew testDebugUnitTestenableEdgeToEdge()collectAsStateWithLifecycle()key = { ... }LazyColumnlocal.properties@Previewsettings.gradle.ktsbuild.gradle.ktsapp/build.gradle.ktsnamespaceMainActivity.ktAndroidManifest.xmlrememberLauncherForActivityResultreferences/SKILL.mdfindViewByIdAsyncTask./gradlew assembleDebugTODOInfo.plist