mcpField
C
capacitor-android

capacitor-android

github.com/abelv22Development090 installsUpdated today
Repository

About capacitor-android

capacitor-android is a skill for assistants working with React and Java/Android code for background tracking. It covers Android service lifecycles, power management, Capacitor bridge communication, and geolocation permissions and providers.

Key features

  1. 01Manage foreground service lifecycles
  2. 02Handle notifications and reboot persistence
  3. 03Balance wakelocks and battery optimization
  4. 04Connect Capacitor plugins with React
  5. 05Configure background geolocation and permissions

Use cases

  1. 01Implement Android background location tracking
  2. 02Debug service restarts and persistent notifications
  3. 03Pass native status updates to a React UI
  4. 04Review location permissions and power behavior

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/abelv22/project-foundation --skill capacitor-android

After installing, type/capacitor-androidin Claude Code to confirm it loaded.

Details

From the project README

Capacitor & Android Native Bridge Skill

This skill enables the assistant to handle the complex interaction between the Web layer (React) and the Native layer (Java/Android) specifically for background tracking.

Knowledge Areas

1. Android Foreground Services
  • Lifecycle Management: Start/stop/restart logic for LocationTrackingService.java.
  • Notifications: Maintaining persistent notifications required by Android for foreground tasks.
  • Boot Persistence: Implementing BOOT_COMPLETED receivers to restart tracking on device reboot.
2. Battery & Power Management
  • Wakelocks: Smart management of PARTIAL_WAKE_LOCK to balance tracking consistency with battery life.
  • Doze Mode: Using AlarmManager.setExactAndAllowWhileIdle() for reliable 60s intervals.
  • Optimization Whitelisting: Handling REQUEST_IGNORE_BATTERY_OPTIMIZATIONS.
3. Capacitor Plugin Development
  • Bridge Communication: Efficiently passing data between ProTrackingPlugin.java and React.
  • Native-to-Web Events: Using notifyListeners for real-time status updates in the UI.
4. Background Geolocation
  • Providers: Fine-tuning FusedLocationProviderClient settings (Priority, Interval, FastestInterval).
  • Permissions: Managing granular location permissions (Fine, Background) and notification permissions.

Guidelines for Responses

  • When modifying Java code, ensure Thread Safety (especially for network calls and location updates).
  • Always recommend releasing Wakelocks when the GPS fix is obtained or if a timeout occurs.
  • Suggest exponential backoff for failed HTTP requests in LocationApiClient.java.
  • Keep in mind Android 14+ requirements (Foreground Service Types).

Comments

Markdown supported