GoogleMaps for enaml-native
This package contains the following widgets:
MapView
with traffic, layers, buildings, and camera controlMapMarker
with customizable info windowsMapPolygon
,MapPolyline
, andMapCirlce
You may want to also use the LocationManager
from enamlnative.android.api
for GPS updates. See
- Install
enaml-native-maps
using the enaml-native-cli (or pip)
#: Using the enaml-native cli
enaml-native install enaml-native-maps
#: or via pip and link it
pip install enaml-native-maps
enaml-native link enaml-native-maps
-
Next, add
enaml-native-maps: ""
to your app'spackage.json
-
Then update the manifest in
android/app/src/main/AndroidManifext.xml
to include:
<!-- If using google maps these two are required.
You must also define the API key in gradle.properties-->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
Note: Make sure it is within the
<application>
tags!
- Now in
android/app/build.gradle
add theresValue
lines below under thebuildTypes
to tell gradle to pull your key from thegradle.properties
buildTypes {
debug {
// Add this line
resValue "string", "google_maps_key",
(project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// And add this line
resValue "string", "google_maps_key",
(project.findProperty("GOOGLE_MAPS_API_KEY") ?: "")
}
}
- Finally add your
GOOGLE_API_MAPS_KEY=yourapikey
inandroid/app/gradle.properties
.
See android's maps docs for help and to get an API key.
See the examples folder.