android-platform

pluginagentmarketplace's avatarfrom pluginagentmarketplace

Android core components lifecycle, Activities, Fragments, Services, Intent system. Use when working with Android components or handling lifecycle.

⭐0stars🔀0forks📁View on GitHub🕐Updated Nov 19, 2025

When & Why to Use This Skill

This Claude skill provides expert-level guidance on the Android platform's core components and lifecycle management. It assists developers in mastering Activities, Fragments, Services, and the Intent system, offering best practices for resource management, state persistence, and robust application architecture to ensure high-performance mobile development.

Use Cases

  • Implementing lifecycle-aware components to prevent memory leaks and optimize app performance during state transitions.
  • Configuring Services and the Intent system for efficient background processing and seamless inter-component communication.
  • Designing Fragments and Activities that gracefully handle configuration changes, such as screen rotations, using modern Android architectural patterns.
nameplatform
descriptionAndroid core components lifecycle, Activities, Fragments, Services, Intent system.
version"2.0.0"
sasmp_version"1.3.0"
bonded_agent02-platform
bond_typePRIMARY_BOND
atomictrue
single_responsibilityAndroid platform components & lifecycle
typestring
enum[activity, fragment, service, intent, permission]
requiredfalse
max_attempts2
backoffexponential
on_failurereturn_lifecycle_diagram
levelinfo
include[query, component_type, response_time]

Android Platform Skill

Quick Start

Activity Lifecycle

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
    }
    
    override fun onDestroy() {
        super.onDestroy()
        // Cleanup
    }
}

Fragment Usage

class UserFragment : Fragment() {
    private val viewModel: UserViewModel by viewModels()
    
    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)
        viewModel.user.observe(viewLifecycleOwner) { user ->
            updateUI(user)
        }
    }
}

Key Concepts

Lifecycle Callbacks

  • onCreate(): Initial setup
  • onStart(): Become visible
  • onResume(): Gain focus
  • onPause(): Lose focus
  • onStop(): Hidden
  • onDestroy(): Final cleanup

Fragment Lifecycle

Similar to Activity but with:

  • onAttach(): Attached to activity
  • onDetach(): Detached
  • Fragment manager for transactions

Intent System

// Explicit
startActivity(Intent(this, DetailActivity::class.java))

// Implicit
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://example.com")))

Services

  • Started: startService()
  • Bound: bindService()
  • Foreground: Visible notification

Best Practices

✅ Handle lifecycle properly ✅ Use ViewModel for state ✅ Unregister listeners ✅ Test configuration changes ✅ Respect process lifecycle

Resources