Get Started with the Android SDK Follow
The Meridian Android SDK has all the tools you’ll need to build your own Meridian-powered app.
Once you’ve added maps, routes, and placemarks to the Meridian Editor, you can use the Meridian SDK to integrate that content into your Meridian-powered Android app.
Go here for the Meridian Android SDK Reference documentation.
Go here to download the latest version of the Android SDK.
Once you’ve downloaded the SDK, be sure to open the
README.md
file. It explains how to get started.
The Meridian Samples App
The Meridian Samples app is included with the Android SDK to demonstrate common Meridian features and workflows. The Samples app has the following Examples:
•Maps - Basic map fragment sample that is in the main activity
•How to load a map fragment and set various map options
•How to highlight markers
•How to customize the color and font size of a marker
•Nearby - how to find nearby placemarks. Requires bluedot subscription
•Search - how to search for nearby placemarks using the local search API
•Markers - how to create custom markers, How to create a custom placemark, How to add additional markers to the map, How to remove a marker from the map
•Triggers - how to start, stop and reset triggers
•Scrolling - how to programmatically scroll to placemarks
•Location - how to use the location manager
•Location Sharing - how to share your location with friends
•Single Marker - how to create a map with just a single marker on it
•Tags - how to view asset tags on the map
•Location sharing map - how to show your friends on the map
•Overlay - how to overlay graphics on the map. How to create custom overlay markers and make overlays respond to map events
•MapView - how to use the MapView instead of the MapFragment. How to customize directions route color, customize the bluedot, and highlight markers
•Bottom Sheet (beta) - how to use the map fragment that includes a bottom sheet
•Google Maps - how to switch between Google and Meridian maps
•Deep links - how to deeplink to a placemark
Add the SDK to Your Project
In order to simplify using the Meridian SDK library with your Android project, we’ve bundled our SDK code into a binary distribution of the Android Library Project (AAR) file.
The Meridian SDK supports devices with Android 8.0+ (Oreo) API Level 26 and higher.
Add the AAR Relative Path
Complete these steps to add the AAR file to your Android project.
-
Choose a location for
meridian-x.y.z.aar
. -
Edit your app’s
build.gradle
file to add the relative path to themeridian-x-y-z.aar
file location insideflatDir { }
, where our app will look for dependencies. Intorepositories { }
, insert:
repositories { google() mavenCentral() // Tell gradle to look in our parent directory for the meridian AAR package. flatDir { dirs '[relative file path to the AAR directory]' } }
Add Dependencies
To use the Meridian SDK classes in your project, add the implementation information for the dependencies to the build.gradle
file. These are the meridian-x.y.z.aar file and two required external dependencies.
To find the project’s current dependencies, look in build.gradle
in the MeridianSamples directory.
In the build.gradle
file inside dependencies { }
, insert implementation
for the meridian-x.y.z.aar file and the three required external dependencies:
dependencies { implementation 'com.arubanetworks.meridian:meridian:x.y.z@aar' // Google Support Libraries implementation 'androidx.legacy:legacy-support-v4:1.0.0' implementation 'androidx.appcompat:appcompat:1.4.0' // Required for GPS on newer Android devices. implementation 'com.google.android.gms:play-services-location:18.0.0'
implementation 'com.google.android.material:material:1.7.0'
// The SDK also has these external dependencies that you'll need to include:
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.squareup:otto:1.3.8'
implementation 'org.conscrypt:conscrypt-android:2.5.2'
implementation 'org.greenrobot:eventbus:3.3.1'
implementation 'com.lemmingapex.trilateration:trilateration:1.0.2'
}
Import Packages
When this is done, you’ll be able to import the com.arubanetworks.meridian
packages to your project and use Meridian classes in your source files.
The SDK’s MeridianSamples/app
project folder has an example of what the finished build.gradle
file should look like.
Add Permissions
To enable the Meridian SDK’s location-awareness features, add the following permissions to your project’s AndroidManifest.xml
file:
<!-- For using GPS and Location in general --> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <!-- For using location derived from bluetooth beacons --> <uses-permission android:name="android.permission.BLUETOOTH"/> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<!-- For using location derived from bluetooth beacons on Android 12 and later -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN/>
To enable Meridian SDK's location-aware features (e.g. location sharing) in the background, add the following permission to your project’s AndroidManifest.xml
file and request the permission from the user as required for the Android version:
<!-- For using bluetooth in the background -->
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
Configure the SDK with a Meridian Token
Before you can use the features of the Meridian SDK, you’ll need to create an instance of MeridianConfig
. This will configure the SDK.
Meridian uses token-based authentication. In order for your Meridian-powered app to communicate with the Editor, you’ll need to specify a Meridian token when initializing the SDK.
Put the following line in the onCreate
method of your Application
class or main activity.
// Configure Meridian Meridian.configure(this, YOUR_EDITOR_TOKEN);
Comments
0 comments
Please sign in to leave a comment.