Skip to content
Skills Library
Programming · Building & coding

android-sdk

/android-sdk

Expert Android SDK assistance covering Android architecture components, Activity/Fragment lifecycles, permissions, background work with WorkManager, and Gradle build optimizations. Use when building native Android applications, configuring ProGuard/R8, or interacting with platform SDK APIs.

Licence
MIT
Last repository change
01.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 01.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Expert Android SDK assistance covering Android architecture components, Activity/Fragment lifecycles, permissions, background work with WorkManager, and Gradle build optimizations. Use when building native Android applications, configuring ProGuard/R8, or interacting with platform SDK APIs.

Original author description

Expert Android SDK assistance covering Android architecture components, Activity/Fragment lifecycles, permissions, background work with WorkManager, and Gradle build optimizations. Use when building native Android applications, configuring ProGuard/R8, or interacting with platform SDK APIs.

How it works

  1. When to Use
  2. Quick Start
  3. Core Concepts
  4. Common Patterns
  5. Best Practices
  6. Troubleshooting
  7. References
Original SKILL.md headings · 154 lines, 582 words
SKILL.md preview
---
name: android-sdk
description: Expert Android SDK assistance covering Android architecture components, Activity/Fragment lifecycles, permissions, background work with WorkManager, and Gradle build optimizations. Use when building native Android applications, configuring ProGuard/R8, or interacting with platform SDK APIs.
---

# Android SDK

The traditional Android development toolkit (Views, Activities, Fragments, XML) using Kotlin/Java. Essential for maintaining the vast ecosystem of pre-Compose applications.

## When to Use

- **Native Android Development**: Building high-performance, platform-specific Android applications using Java or Kotlin.
- **Hardware & Sensor Access**: Interfacing with Bluetooth Low Energy, camera hardware, biometric sensors, and NFC directly.
- **Background Task Scheduling**: Managing deferred, periodic, or guaranteed background jobs using WorkManager and foreground services.
- **Deep System Integration**: Implementing custom launcher widgets, notification channels, accessibility services, and device admin policies.

## Quick Start

```kotlin
// build.gradle.kts: viewBinding = true

class MainActivity : AppCompatActivity() {
    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityMainBinding.inflate(layoutInflater)
        setContentView(binding.root)

        binding.myButton.setOnClickListener {
            Toast.makeText(this, "Clicked!", Toast.LENGTH_SHORT).show()
        }
    }
}
```

## Core Concepts

### Activity & Fragment Lifecycles

Activities represent single screens with user interfaces; lifecycle callbacks manage resource acquisition and release to prevent memory leaks during configuration changes:

```kotlin
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContentView(R.layout.activity_main)
    }

    override fun onStart() {
        super.onStart()
        // Connect sensors, start location listener
    }

    override fun onStop() {
        super.onStop()
        // Release heavy sensor streams to preserve battery
    }
}
```

### Dependency Injection with Hilt

Hilt standardizes Dagger dependency injection across Android components with predefined scopes tied to Android lifecycles:

```kotlin
@HiltAndroidApp
class MainApplication : Application()

@AndroidEntryPoint
class UserProfileFragment : Fragment() {
    @Inject lateinit var analyticsTracker: AnalyticsTracker
    private val viewModel: UserViewModel by viewModels()
}
```

### Permissions Architecture & Runtime Requests

Modern Android requires fine-grained runtime permission requests before accessing sensitive hardware or user records:

```kotlin
val requestPermissionLauncher = registerForActivityResult(
    ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
    if (isGranted) {
        openCamera()
    } else {
        showPermissionRationaleDialog()
    }
}

// Request permission when user triggers action
requestPermissionLauncher.launch(Manifest.permission.CAMERA)
```

## Common Patterns

### Background Processing with WorkManager

**Problem**: Long-running background sync operations get terminated by modern Android battery optimization (Doze mode).  
**Solution**: Schedule persistent background jobs with WorkManager and constraints.

```kotlin
class SyncWorker(ctx: Context, params: WorkerParameters) : CoroutineWorker(ctx, params) {
    override suspend fun doWork(): Result {
        return try {
            repository.syncData()
            Result.success()
        } catch (e: Exception) {
            Result.retry()
        }
    }
}

// Enqueue with network constraint
val constraints = Constraints.Builder()
    .setRequiredNetworkType(NetworkType.CONNECTED)
    .setRequiresBatteryNotLow(true)
    .build()

val syncRequest = PeriodicWorkRequestBuilder<SyncWorker>(1, TimeUnit.HOURS)
    .setConstraints(constraints)
    .build()

WorkManager.getInstance(context).enqueueUniquePeriodicWork(
    "DataSync", ExistingPeriodicWorkPolicy.KEEP, syncRequest
)
```

## Best Practices

**Do**:

- Adopt Edge-to-Edge Display: Target Android 15+ edge-to-edge system bars using WindowInsetsCompat.
- Use WorkManager for Background Tasks: Never spawn unmanaged background threads that get killed by battery optimizations (Doze).
- Enforce ViewBinding / Compose: Eliminate error-prone `findViewById` lookups by using ViewBinding or modern Jetpack Compose.
- Validate Scoped Storage: Store application files in private app storage (`context.filesDir`) or use the Storage Access Framework for public files.

**Don't**:

- Block the Main (UI) Thread: Keep networking, JSON parsing, and database transactions strictly on IO coroutine dispatchers.
- Hardcode dimensions or text: Always use `res/values/strings.xml` for localization and `res/values/dimens.xml` or density-independent pixels (`dp`).
- Hold static references to Context: Retaining an Activity context in static singletons causes permanent memory leaks.

## Troubleshooting

| Error                                          | Cause                                               | Solution                                    |
| :--------------------------------------------- | :-------------------------------------------------- | :------------------------------------------ |
| `ANR (App Not Responding)`                     | Blocking main thread for >5s.                       | Move work to `Dispatchers.IO` (Coroutines). |
| `IllegalStateException: Fragment not attached` | Accessing context after detachment.                 | Check `isAdded` or use `MainScope` safely.  |
| `Memory Leak`                                  | Holding Activity reference in Singleton/Background. | Use `WeakReference` or Application Context. |

## References

- [Android Developer Guides](https://developer.android.com/guide)
- [Guide to App Architecture](https://developer.android.com/topic/architecture)

Versions

The database has no other skills named android-sdk.

Database snapshot: 13.11.2026 · package version 2f7b7fb8ba3b (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95android-native
    Android native platform APIs beyond UI: Activity/Fragment lifecycle, Android Keystore (hardware-backed key storage), BiometricPrompt, EncryptedSharedPreferences, WorkManager, NFC (NDEF + HCE), Foreground Services, broadcast receivers, ContentProviders, Intents, FileProvider, App…
  • 100android-studio
    Expert Android Studio IDE assistance covering Gradle sync, Logcat, Layout Inspector, SDK Manager, and virtual devices (AVD). Use when developing native Android applications with Kotlin or Java.
  • 100android-background-workmanager-services
    Use this skill when scheduling deferrable, guaranteed background processing tasks and periodic workers on Android devices.
  • 90kotlin-android
    Build and upgrade native Android applications with Kotlin, Compose/View UI and lifecycle-aware work. Use when implementing Android screens, navigation, permissions or background jobs; coordinate Kotlin, Gradle, AGP and SDK compatibility.
  • 100android-expert
    Expert in Android development with Jetpack Compose, Material Design, ViewModel, and modern Android architecture. Use when the user mentions mobile, Kotlin, Jetpack Compose, Material Design, or Google, or when the task involves Android Architecture, Android Components, Jetpack…
  • 80role-mobile:android-native
    Expert guidance on Android native development — Kotlin idioms, Jetpack Compose UI, Room database, Hilt dependency injection, Coroutines and Flow for async work, WorkManager for background tasks, Gradle build configuration (KTS), Material Design 3 theming, and Navigation Compose.…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.