sir-chawakorn/power-ranger-toolkit/android-development

Claude Code and agent skill by sir-chawakorn/power-ranger-toolkit

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Android development patterns for Kotlin/Java including MediaProjection, Accessibility Service, Socket.IO, and foreground services. Use when working on TitanMirror or other Android projects.

Install

npx vskill@latest install sir-chawakorn/power-ranger-toolkit/android-development

SKILL.md

📱 Android Development Skill

Use Cases

  • Screen mirroring (MediaProjection)
  • Remote control (Accessibility Service)
  • Real-time communication (Socket.IO)
  • Background services

MediaProjection Setup

1. Request Permission
kotlin
val mediaProjectionManager = getSystemService(MEDIA_PROJECTION_SERVICE) as MediaProjectionManager
startActivityForResult(mediaProjectionManager.createScreenCaptureIntent(), REQUEST_CODE)
2. Create Projection
kotlin
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) {
mediaProjection = mediaProjectionManager.getMediaProjection(resultCode, data!!)
startCapture()
}
}
3. ImageReader for Frames
kotlin
val imageReader = ImageReader.newInstance(width, height, PixelFormat.RGBA_8888, 5)
imageReader.setOnImageAvailableListener({ reader ->
val image = reader.acquireLatestImage()
// Process frame...
image?.close()
}, handler)

Foreground Service (Android 14+)

⚠️ CRITICAL: Must call startForeground() immediately in onStartCommand()
kotlin
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
// FIRST: Start foreground immediately!
val notification = createNotification()
startForeground(NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION)
// THEN: Extract intent and start work
val resultCode = intent?.getIntExtra("resultCode", -1) ?: -1
val data = intent?.getParcelableExtra("data", Intent::class.java)
// Add delay before capture
Handler(Looper.getMainLooper()).postDelayed({
startCapture(resultCode, data)
}, 1500)
return START_NOT_STICKY
}

Socket.IO Connection

kotlin
val socket = IO.socket("http://192.168.1.x:3000")
socket.on(Socket.EVENT_CONNECT) {
Log.d("Socket", "Connected!")
socket.emit("register", deviceInfo)
}
socket.on("command") { args ->
val command = args[0] as JSONObject
handleCommand(command)
}
socket.connect()

Accessibility Service

kotlin
class RemoteControlService : AccessibilityService() {
override fun onAccessibilityEvent(event: AccessibilityEvent?) {
// Handle accessibility events
}
fun performClick(x: Int, y: Int) {
val path = Path().apply { moveTo(x.toFloat(), y.toFloat()) }
val gesture = GestureDescription.Builder()
.addStroke(GestureDescription.StrokeDescription(path, 0, 100))
.build()
dispatchGesture(gesture, null, null)
}
fun performSwipe(startX: Int, startY: Int, endX: Int, endY: Int) {
val path = Path().apply {
moveTo(startX.toFloat(), startY.toFloat())
lineTo(endX.toFloat(), endY.toFloat())
}
val gesture = GestureDescription.Builder()
.addStroke(GestureDescription.StrokeDescription(path, 0, 300))
.build()
dispatchGesture(gesture, null, null)
}
}

Decision Tree

Android task?
├── Screen capture? → MediaProjection + ImageReader
├── Background work? → Foreground Service (Android 14 rules!)
├── Remote control? → Accessibility Service
├── Network comm? → Socket.IO
└── Permissions? → Runtime request + Manifest

Common Pitfalls

ปัญหาสาเหตุแก้ไข
Black screenstartForeground timingCall immediately in onStartCommand
Crash on Android 14Wrong intent extractionUse getParcelableExtra(key, Class)
Low FPSBuffer too smallIncrease ImageReader buffer to 5
Service killedNot foregroundAdd FOREGROUND_SERVICE permission

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
33
Repository forks
6
7-day trend score
18

Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 20 Mar 2026, 8 months ago.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/sir-chawakorn/power-ranger-toolkit/android-development/badge)](https://verified-skill.com/skills/sir-chawakorn/power-ranger-toolkit/android-development)

Something wrong with this skill or its page? Tell us.