keel-module-amap
v0.1.0
Published
高德地图/定位 (AMap maps & location) for Keel apps — Android: getCurrentPosition + <AmapView> map; iOS pending (高德 SDK no arm64-sim).
Maintainers
Readme
keel-module-amap
高德地图 / 定位 (AMap maps & location) for Keel apps.
Android — real:
getCurrentPosition(one-shotAMapLocationClientfix) + the<KeelView name="amap"/>map view (AMapView, a@KeelViewoverTextureMapViewwith camera / markers / polyline / polygon). Needs a valid AMap key in the host manifest (com.amap.api.v2.apikey) + location permission to actually run.iOS — pending: the 高德 iOS SDK is CocoaPods-only and ships no arm64-simulator slice, so neither the location nor the map view is wired into the SPM build yet; the iOS
getCurrentPositionthrows a clear error.
Delivery
| Platform | Wrapper | Upstream SDK |
|----------|---------|--------------|
| iOS | SPM source target (Package.swift, @KeelModule macro) — keel-module autolink --emit=spm | declare the CocoaPods-only AMap SDK (e.g. AMapLocation / AMap3DMap) in module.yml ios.pods → host Podfile via --emit=pods ("pod + spm dual") |
| Android | AAR gradle subproject — keel-module autolink --emit=gradle | a normal implementation(...) in android/build.gradle.kts |
Install
keel install keel-module-amapKeel's autolinker discovers the module via its module.yml and wires both
platforms on the next build — no manual Podfile / Gradle edits.
Usage
import { getCurrentPosition } from 'keel-module-amap';
const pos = await getCurrentPosition({ highAccuracy: true, timeout: 15 });
console.log(pos.lat, pos.lng, pos.accuracy); // one-shot fix (Android)The map view (typed handle generated by keel-tsgen --views from the
@KeelView("amap") native class):
import { AmapView } from 'keel-module-amap'; // generated typed component
<AmapView
style={{ flex: 1 }}
camera={{ lat: 39.9, lng: 116.4, zoom: 14 }}
markers={[{ lat: 39.9, lng: 116.4, title: '天安门' }]}
/>;Development
keel-module validate # check module.yml against actual source pathsLicense
Apache-2.0 — see LICENSE in the parent monorepo.
