-
Notifications
You must be signed in to change notification settings - Fork 917
Manual Installation
Step 1. Create a cordova project and add Android platform. Please refer the cordova document.
$> cordova create ./mydir com.example.googlemap MyProject
$> cd mydir
$> cordova platform add android
Step 2. In the Cordova Android application you will need to put the following in your res/xml/config.xml
file as a child to the plugin tag:
<feature name="GoogleMaps">
<param name="android-package" value="plugin.google.maps.GoogleMaps" />
</feature>
Step 3. You'll need to set up the Google Play Services SDK and link to it.
- Install the Google Play Services SDK for Android
- Import the Google Play Services SDK into Eclipse
- Link the Google Play Services SDK library to your project. View the properties for the project, and navigate to the 'Android' tab. In the lower part of the dialog, click 'Add' and choose the 'google-play-services_lib' project from the workspace.
Step 4. Add these permissions and elements to your AndroidManifest.xml
.
Please refer the more detailed exlpain in the Google Maps Document.
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<!-- The following two permissions are not required to use
Google Maps Android API v2, but are recommended. -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!-- OpenGL ES version 2 -->
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
Step 5. Still in your AndroidManifest.xml
, add your Google Maps API key under the <application> tag.
Please refer the more detailed exlpain in the Google Maps Document.
Replace YOUR_GOOGLE_MAPS_ANDROID_API_KEY_IS_HERE with your google maps api key.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR_GOOGLE_MAPS_ANDROID_API_KEY_IS_HERE" />
<!-- for Google Play Services SDK -->
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Step 6. From this plugin folder copy the www/googlemaps-cdv-plugin.js
and example/Simple/
files into your application's assets/www
folder. Overwrite the existing index.html file.
Step 7. From this plugin folder copy the src/android/
folder into your application's src
folder.
Step 1. First of all, download the latest SDK from the official document.
Step 2. Create a cordova project and add iOS platform. Please refer the cordova document.
$> cordova create ./mydir com.example.googlemap MyProject
$> cd mydir
$> cordova platform add ios
Step 3. Install the SDK to your project following the official document.
Step 4. From this plugin folder copy the www/googlemaps-cdv-plugin.js
and example/Simple/
files into your application's assets/www
folder. Overwrite the existing index.html file.
Step 5. From this plugin folder copy the src/ios/
folder into your application's Plugins
folder.
Step 6. In the Cordova iOS application you will need to put the following in your config.xml
file as a child to the plugin tag:
<feature name="GoogleMaps">
<param name="ios-package" value="GoogleMaps" />
</feature>
Step 7. Under the group Resources, find your [PROJECTNAME]-Info.plist, add a new entry. For the key, add Google Maps API Key, and its value is your Google Maps API Key for iOS.
If you get an error, feel free to ask me on the official community or the issue list.
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.
New versions will be announced through the official community. Stay tune!
Feel free to ask me on the issues tracker.
Or on the official community is also welcome!
New version 2.0-beta2 is available.
The cordova-googlemaps-plugin v2.0 has more faster, more features.