/
Probe API installation

Greenspector Documentation has been moved.
Please go to

https://greenspectorstudio.atlassian.net/l/cp/TDhqYDSu

Probe API installation

UP TO DATE

Android Probe API

Installation in your project libraries or in a Maven repository

Download the aar library from the GREENSPECTOR Modules page on the Web Interface and install it:

  • either in the libs folder of your Android project;
  • or in a local or remote Maven repository.

Example for a local Maven repository:

mvn install:install-file
-Dfile=greenspector-probe-android-[version].aar
-DgroupId=com.greenspector.probe.android
-DartifactId=greenspector-probe-android
-Dversion=[version]
-Dpackaging=aar

Integration in your Android project

If you have installed the library in the libs folder of your Android project

Add the dependency in your project's module build.gradle file:

build.gradle
dependencies {
	compile files('libs/greenspector-probe-android-[version].aar')
}

If you have installed the library in a Maven repository

Check your Maven repository is configured inside the project's build.gradle file.

Example for a local Maven repository:

build.gradle
repositories {
	mavenLocal()
}

Add the dependency in your project's module build.gradle file:

build.gradle
dependencies {
	compile ('com.greenspector.probe.android:greenspector-probe-android:[version]')
}

Android project configuration

In order to be able to correctly use the Probe API you need to add some permissions in your application's AndroidManifest.xml file.

  • Permission to use Internet (to send the results to the GREENSPECTOR Server):
AndroidManifest.xml
 <uses-permission android:name="android.permission.INTERNET"/>
  • Permissions to read and write on the SD Card (to read and write results files):
AndroidManifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

IMPORTANT

From Android 6.0 (API level 23), some permissions are considered dangerous.
The permissions android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE must be granted explicitly via ADB commands for the measures to run correctly.

First install your application on your mobile, then launch the following commands to grant permissions:

adb shell pm grant com.example.myapp android.permission.READ_EXTERNAL_STORAGE
adb shell pm grant com.example.myapp android.permission.WRITE_EXTERNAL_STORAGE

Related articles





Related content

Meter Android API
Meter Android API
More like this
CLI installation
CLI installation
Read with this
Smartphone integration tests
Smartphone integration tests
More like this
Cloud
Read with this
CLI
Read with this
Getting Started
Getting Started
Read with this