Learn-skills.dev capacitor-android
Expert in Capacitor cross-platform development and Android native Java code for background services and battery optimization.
install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/abelv22/project-foundation/capacitor-android" ~/.claude/skills/neversight-learn-skills-dev-capacitor-android && rm -rf "$T"
manifest:
data/skills-md/abelv22/project-foundation/capacitor-android/SKILL.mdsource content
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
receivers to restart tracking on device reboot.BOOT_COMPLETED
2. Battery & Power Management
- Wakelocks: Smart management of
to balance tracking consistency with battery life.PARTIAL_WAKE_LOCK - Doze Mode: Using
for reliable 60s intervals.AlarmManager.setExactAndAllowWhileIdle() - Optimization Whitelisting: Handling
.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
3. Capacitor Plugin Development
- Bridge Communication: Efficiently passing data between
and React.ProTrackingPlugin.java - Native-to-Web Events: Using
for real-time status updates in the UI.notifyListeners
4. Background Geolocation
- Providers: Fine-tuning
settings (Priority, Interval, FastestInterval).FusedLocationProviderClient - 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).