Modern Android cheat sheet
The 10 Modern Android interview answers in 30 seconds each, plus quick facts. Printable, free.
One page per topic: print it or save it as PDF from your browser's print menu. Practise these questions
Rules of thumb
- enableEdgeToEdge plus insets; never hard-code bar heights.
- Back callbacks only when enabled for a reason.
- App Links need assetlinks.json with Play's signing key.
- Semantics, 48dp targets, sp text, test with TalkBack.
- Raise targetSdk yearly, early.
Edge-to-edge and window insets
Edge-to-edge means your app draws behind the status and navigation bars. It's enforced for apps targeting Android 15 (API 35), and the opt-out is gone for API 36. Call enableEdgeToEdge() and pad content with insets: Scaffold's innerPadding, or modifiers like windowInsetsPadding(WindowInsets.safeDrawing) and imePadding(), so nothing sits under bars, cutouts or the keyboard.
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: android.os.Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
setContent {
Scaffold { innerPadding ->
LazyColumn(contentPadding = innerPadding) {
items(50) { Text("Row $it", Modifier.padding(16.dp)) }
}
}
}
}
}Predictive back
Predictive back shows a preview of where Back goes while the user swipes, such as the home screen or the previous screen. To support it, stop overriding onBackPressed() or intercepting KEYCODE_BACK and use OnBackPressedDispatcher callbacks, or BackHandler in Compose. For apps targeting API 36 the system animations are on by default and onBackPressed isn't called.
@Composable
fun EditNote(hasUnsavedChanges: Boolean, onAskDiscard: () -> Unit) {
BackHandler(enabled = hasUnsavedChanges) { onAskDiscard() }
Text("Editing")
}Deep links and App Links
A deep link is any URI that opens a screen in your app via an intent filter with VIEW, DEFAULT and BROWSABLE. An App Link is an https link verified with autoVerify and a /.well-known/assetlinks.json file on your domain, so it opens your app directly without a chooser. Since Android 12, unverified web links open in the browser. Route the URI to a screen, such as with navDeepLink, and validate its input.
<activity android:name=".MainActivity" android:exported="true">
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="example.com" android:pathPrefix="/articles" />
</intent-filter>
</activity>Accessibility in Compose
Compose builds a semantics tree that TalkBack and other services read. Give icons a contentDescription (or null if decorative), merge related items with Modifier.semantics(mergeDescendants = true) or clickable rows, set roles and state descriptions, mark headings, keep touch targets at least 48dp, use sp for text so it scales, and check contrast. Test with TalkBack and Accessibility Scanner.
Passkeys and Credential Manager
Use Jetpack Credential Manager. One API handles passkeys, saved passwords and Sign in with Google. To register, your server creates a WebAuthn challenge and the app calls createCredential with it; to sign in, call getCredential with passkey and password options, then send the response to your server to verify. It replaces older Smart Lock and legacy Google Sign-In APIs.
suspend fun signIn(context: android.content.Context, requestJson: String): androidx.credentials.Credential? {
val manager = androidx.credentials.CredentialManager.create(context)
val request = androidx.credentials.GetCredentialRequest(
listOf(
androidx.credentials.GetPublicKeyCredentialOption(requestJson),
androidx.credentials.GetPasswordOption(),
),
)
return try {
manager.getCredential(context, request).credential
} catch (e: androidx.credentials.exceptions.NoCredentialException) {
null
}
}Home screen widgets with Glance
Glance lets you write widgets with a Compose-style API. You extend GlanceAppWidget and build UI in provideGlance using Glance composables like Column and Text from the glance packages. Glance translates them into RemoteViews, because widgets run in the launcher's process. Update widgets with update() or from WorkManager, and keep the work small.
Kotlin Multiplatform
Kotlin Multiplatform (KMP) compiles shared Kotlin code to JVM for Android and to native frameworks for iOS. Teams usually share business logic, networking, storage and models, using libraries like Ktor, kotlinx.serialization, SQLDelight or Room and DataStore, which support KMP. Platform APIs use expect/actual. UI can stay native or use Compose Multiplatform.
On-device AI features
On supported devices, Gemini Nano runs through AICore, and ML Kit's GenAI APIs expose tasks like summarisation, proofreading, rewriting and image description. Check the feature's availability, download the model if needed, run the request off the main thread and stream results. Plan a fallback for devices without support, such as a cloud model or hiding the feature.
Target SDK upgrades
targetSdk tells Android which behaviour changes your app is ready for; compileSdk is the API you compile against; minSdk is the oldest you support. Raising targetSdk opts into new rules, such as edge-to-edge at 35 and predictive back defaults at 36. Google Play requires apps to target an API level within about a year of the newest release, so plan upgrades yearly.
Foldables and large screens
Apps targeting Android 16 (API 36) can no longer lock orientation or resizability on large screens (smallest width 600dp and up); the system ignores those manifest settings. So layouts must adapt: use window size classes, canonical layouts like list-detail, keep state across resizes and folds, and handle the posture (half-open) with Jetpack WindowManager if useful.
Quick facts
- Edge-to-edge
- Apps targeting Android 15 (API 35) are drawn edge-to-edge by default.
- App Links
- Since Android 12, unverified https links open in the browser instead of a chooser.
- Widget updates
- updatePeriodMillis can't schedule widget updates more often than every 30 minutes.
- Passkeys
- Credential Manager handles passkeys, passwords and Sign in with Google through one API.
- Large screens
- Apps targeting API 36 can't lock orientation or resizability on screens 600dp wide and up.