Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

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

Android Studio integration

Put the Maven local or remote repository inside the project's build.gradle. Example with Maven local repository:

build.gradle
buildscript {
	repositories {
		jcenter()
		mavenLocal()
	}
}

Inside the dependencies of the application build.gradle file (your application and not the build.gradle in the root project), add the library :

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

Android Application

To use Internet, put:

AndroidManifest.xml
 <uses-permission android:name="android.permission.INTERNET"/>

To write results in sdcard, put:

AndroidManifest.xml
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

IMPORTANT

Beginning in Android 6.0 (API level 23), some permissions are now 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 work.

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




  • No labels