Skip to content

Commit

Permalink
Added Maven build and installation instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
shannah committed Mar 5, 2021
1 parent c0ee1db commit 7563d6f
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 32 deletions.
64 changes: 62 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,40 @@ fallback to Codename One MapComponent on other platforms.
Check out a brief tutorial on using this project here:
https://www.codenameone.com/blog/new-improved-native-google-maps.html

# Limitations
## Installation

### Via Codename One Preferences

1. Open Codename One Preferences (i.e. Control Center)
2. Go to "Advanced Settings" > "Extensions" in the menu.
3. Find the "Codename One Google Native Maps" option.
4. Press "Download"

Back in your IDE (e.g. IntelliJ, NetBeans, Etc..) select the "Refresh Cn1libs" option in the Codename One menu.

### Maven Dependency

If you are using Maven as your build tool, then you can simply paste the following snippet into your common/pom.xml file:

~~~~
<dependency>
<groupId>com.codenameone</groupId>
<artifactId>googlemaps-lib</artifactId>
<version>1.0.1</version>
<type>pom</type>
</dependency>
~~~~

NOTE: You should replace the `version` with the [latest on Maven central](https://search.maven.org/artifact/com.codenameone/googlemaps-lib).

## Limitations
1. The native maps are only supported on Android devices that have the Google Play store (e.g. not on Amazon Kindle)
and on iOS devices. All other devices will show the MapComponent by default.
Map component will be used on the simulator as well.

2. Since a native component is used placing overlays is problematic. You will need to use Dialogs and the API's of the MapContainer class to implement this.

# Configuration
## Configuration
The configuration portion is the hardest part, Google made it especially painful in the Google typical way.
You can follow the instructions from Google to get started for [Android](https://developers.google.com/maps/documentation/android/start), for [iOS](https://developers.google.com/maps/documentation/ios/start/), and
for [Javascript](https://developers.google.com/maps/documentation/javascript/). UWP uses https://code.msdn.microsoft.com/windowsapps/Bing-Maps-for-Windows-10-d7ae3e44[BingMaps] instead of Google maps.
Expand Down Expand Up @@ -41,3 +67,37 @@ Display.getInstance().setProperty("windows.bingmaps.token", "xxxxxxxxx");
NOTE: Version 23 and higher require google play services 9.4.0 or higher, this library will automatically cause your app to build against 9.4.0 or higher. If you require compatibility with the older version (8.3.0), you'll need to install GoogleMaps.cn1lib v22 or earlier. You can download v22 [here](https://github.com/codenameone/codenameone-google-maps/releases/tag/v22).

This project was migrated from an old project on Google code http://code.google.com/p/codenameone-google-maps

## Documentation

[Javadocs](https://www.javadoc.io/doc/com.codenameone/googlemaps-common/latest/index.html)

## Building From Source

This project uses Maven as its build tool.

~~~~
git clone https://github.com/codenameone/codenameone-google-maps
cd codenameone-google-maps/GoogleMaps
mvn install
~~~~

This will install the library into your local maven repository so that you'll be able to add it as a dependency to any of your projects with the snippet:

~~~~
<dependency>
<groupId>com.codenameone</groupId>
<artifactId>googlemaps-lib</artifactId>
<version>THE_VERSION</version>
<type>pom</type>
</dependency>
~~~~

Just replace `THE_VERSION` with the version in the GoogleMaps/pom.xml file.

IMPORTANT: Notice that you include the `googlemaps-lib` artifact and not the `googlemaps` artifact when using it as a dependency. The root "googlemaps" artifact is just a wrapper project for the multi-module project. The "lib" module is the actual cn1lib dependency.

### Building Legacy .cn1lib File

Maven projects no longer use .cn1lib file format, however the project still builds this format in case you want to distribute the cn1lib without using Maven's dependency mechanisms (or if you want to use the library with the legacy Ant project type). When you run `mvn install` it will automatically build the cn1lib file. **You'll find it inside the common/target** directory after performing a build.

31 changes: 1 addition & 30 deletions googlemaps-lib/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7563d6f

Please sign in to comment.