2026-02-20 06:41:52 -06:00
# `:core:api` (Meshtastic Android API)
2026-01-29 13:45:00 -06:00
2026-02-20 06:41:52 -06:00
## Overview
The `:core:api` module contains the stable AIDL interface and dependencies required for third-party applications to integrate with the Meshtastic Android app.
2026-01-29 13:45:00 -06:00
## Integration
To communicate with the Meshtastic Android service from your own application, we recommend using **JitPack** .
2026-02-20 06:41:52 -06:00
### Dependencies
Add the following to your `build.gradle.kts` :
2026-01-29 13:45:00 -06:00
```kotlin
dependencies {
2026-02-07 16:19:10 -06:00
// The core AIDL interface and Intent constants
2026-02-20 06:41:52 -06:00
implementation("com.github.meshtastic.Meshtastic-Android:meshtastic-android-api:v2.x.x")
2026-01-29 13:45:00 -06:00
2026-02-24 06:37:33 -06:00
// Data models (DataPacket, MeshUser, NodeInfo, etc.) - Kotlin Multiplatform
2026-02-20 06:41:52 -06:00
implementation("com.github.meshtastic.Meshtastic-Android:meshtastic-android-model:v2.x.x")
2026-01-29 13:45:00 -06:00
2026-02-24 06:37:33 -06:00
// Protobuf definitions (PortNum, Telemetry, etc.) - Kotlin Multiplatform
2026-02-20 06:41:52 -06:00
implementation("com.github.meshtastic.Meshtastic-Android:meshtastic-android-proto:v2.x.x")
2026-01-29 13:45:00 -06:00
}
```
2026-02-20 06:41:52 -06:00
*(Replace `v2.x.x` with the latest stable version).*
2026-01-29 13:45:00 -06:00
## Usage
2026-02-05 07:24:15 -06:00
### 1. Bind to the Service
2026-02-20 06:41:52 -06:00
Use the `IMeshService` interface to bind to the Meshtastic service.
2026-02-05 07:24:15 -06:00
```kotlin
val intent = Intent("com.geeksville.mesh.Service")
2026-02-20 06:41:52 -06:00
// ... query package manager and bind
2026-02-05 07:24:15 -06:00
```
### 2. Interact with the API
2026-02-20 06:41:52 -06:00
Once bound, cast the `IBinder` to `IMeshService` .
2026-02-05 07:24:15 -06:00
### 3. Register a BroadcastReceiver
2026-02-20 06:41:52 -06:00
Use `MeshtasticIntent` constants for actions. Remember to use `RECEIVER_EXPORTED` on Android 13+.
## Key Components
- **`IMeshService.aidl` **: The primary AIDL interface.
- **`MeshtasticIntent.kt` **: Defines Intent actions for received messages and status changes.
## Module dependency graph
<!-- region graph -->
```mermaid
graph TB
:core:api[api]:::android-library
:core:api --> :core:model
classDef android-application fill:#CAFFBF ,stroke:#000 ,stroke-width:2px,color:#000 ;
classDef android-application-compose fill:#CAFFBF ,stroke:#000 ,stroke-width:2px,color:#000 ;
2026-03-12 22:15:20 -05:00
classDef compose-desktop-application fill:#CAFFBF ,stroke:#000 ,stroke-width:2px,color:#000 ;
2026-02-20 06:41:52 -06:00
classDef android-feature fill:#FFD6A5 ,stroke:#000 ,stroke-width:2px,color:#000 ;
classDef android-library fill:#9BF6FF ,stroke:#000 ,stroke-width:2px,color:#000 ;
classDef android-library-compose fill:#9BF6FF ,stroke:#000 ,stroke-width:2px,color:#000 ;
classDef android-test fill:#A0C4FF ,stroke:#000 ,stroke-width:2px,color:#000 ;
classDef jvm-library fill:#BDB2FF ,stroke:#000 ,stroke-width:2px,color:#000 ;
2026-03-17 16:51:09 -05:00
classDef kmp-feature fill:#FFD6A5 ,stroke:#000 ,stroke-width:2px,color:#000 ;
2026-02-20 06:41:52 -06:00
classDef kmp-library fill:#FFC1CC ,stroke:#000 ,stroke-width:2px,color:#000 ;
classDef unknown fill:#FFADAD ,stroke:#000 ,stroke-width:2px,color:#000 ;
2026-02-05 07:24:15 -06:00
```
2026-02-20 06:41:52 -06:00
<!-- endregion -->