-
Notifications
You must be signed in to change notification settings - Fork 206
HowToInclude
You should be familiar with Android SDK.
OSMBonusPack library is now available as an AAR.
OSMBonusPack is available through JitPack (it is not available on Maven Central).
In the build.gradle of your Project (top level), add the jitpack repository:
repositories {
...
maven { url "https://jitpack.io" }
}
Then in the build.gradle of your app, add this dependency:
dependencies {
...
compile 'com.github.MKergall:osmbonuspack:6.3'
}
and that's it.
- In Releases, download the latest osmbonuspack.aar file.
- create a "libs" directory at the root of your project, and copy the file inside.
- No need to copy default resources for bubbles, as they are already included in the AAR.
- No need to copy other libraries.
In your build.gradle, add the following lines:
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
Then set the following dependencies:
dependencies {
compile(name:'osmbonuspack_v6.3', ext:'aar')
compile "com.android.support:support-v4:23.2.1"
compile 'org.osmdroid:osmdroid-android:5.6.4'
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
}
We assume that you have an Android project created.
First of all, you must include osmdroid library in your Android project. Refer to osmdroid documentation.
OSMBonusPack jars from v5.5 are based on osmdroid v5.0.1
(OSMBonusPack jars from v5.1 to v5.4 are based on osmdroid v4.3; OSMBonusPack jars from v4.5 to v5.0 are based on osmdroid v4.2; OSMBonusPack jars from v4.2.6 to v4.4 are based on osmdroid v4.1)
Take care to:
- put the osmdroid.jar in a "libs" directory
- configure the Build Path of your project so that osmdroid.jar appears in the "Referenced Libraries"
- set-up the permissions required by osmdroid in your AndroidManifest.xml (OSMBonusPack doesn't requires anything more than osmdroid).
Done? OK. Now you have to include the lib.
Download the latest version of osmbonuspack.jar
Copy it in the "libs" directory of your project, with osmdroid.jar.
Right-click on the project, "Build Path", "Configure Build Path...", "Add JARs...".
Select osmbonuspack.jar in libs, and click OK. It's added to the "Referenced Libraries", ready-to-use.
Following exactly the same method, you will also have to add the following libs:
- The Google-gson parser: gson-2.2.4.jar
- The Apache Commons Lang: commons-lang3-3.3.2.jar
You can get all of them here.
If you are going to use standard OSMBonusPack "bubbles", browse the source, go to OSMNavigator code repository, and download in your project resources the following files:
- For a white bubble:
- drawable-mpi/bonuspack_bubble.9.png
- layout/bonuspack_bubble.xml
- For a dark-grey bubble:
- drawable-mpi/bonuspack_bubble_black.9.png
- layout/bonuspack_bubble_black.xml
- For the "more info" button:
- drawable/btn_moreinfo.xml
- drawable-mpi/moreinfo_arrow.png
- drawable-mpi/moreinfo_arrow_pressed.png