|
|
|
For the full requirements and configuration, please see the [[Integration Guide|Integration-guide]].
|
|
|
|
|
|
|
|
## Requirements
|
|
|
|
|
|
|
|
The beacon technology is based on **Bluetooth 4.0 LE**, also called Low Energy or Bluetooth Smart Ready. It is available on most Android devices, with a minimum of **Android 4.3**, API level 18. Please ensure that Play Services are installed and that Bluetooth is enabled as well as Location Services.
|
|
|
|
|
|
|
|
## Copy main SDK and dependencies
|
|
|
|
|
|
|
|
The SDK is distributed in .JAR format. It can be added directly with the other dependencies. Copy [all the dependencies' .JAR files](https://github.com/ezeeworld/B4S-Android-SDK/tree/master/sample-eclipse/libs) to your local `libs` folder. Ensure that you use the correct version of the `b4s-android-sdk-playservicesXXX.jar` file, as explained in the next section.
|
|
|
|
|
|
|
|
## Add Play Services
|
|
|
|
|
|
|
|
If not yet present, the Google Play Services should be added to your project as a library project.
|
|
|
|
|
|
|
|
1. Import the Google Play Services library project. If not installed yet, use the Android SDK Manager to install this. It is advised to copy the library project to your local directory from `android-sdk/extras/google/google_play_services/libproject`. Import the `google-play-services_lib` directory using File -> Import... -> Existing Android Code Into Workspace wizard. Make sure it is marked as Library Project in the Android properties.
|
|
|
|
2. Open the properties page of your Android project and add the for the google-play-services_lib as library project dependency. The jar files in `libs` should already be adopted into your Android Private Libraries build.
|
|
|
|
3. Copy the correct B4S SDK - Play Services connection .JAR file from [the `sdk/jar` release folder](https://github.com/ezeeworld/B4S-Android-SDK/tree/master/sdk/jar) to your `libs` folder. For every Play Services version there is a corresponding `b4s-android-sdk-playservicesXXX.jar` version. For example, when still on Play Services 6.5.X (v22) you should use `b4s-android-sdk-playservices650.jar`.
|
|
|
|
|
|
|
|
See [the `sample-eclipse` project](https://github.com/ezeeworld/B4S-Android-SDK/tree/master/sample-eclipse) for an example setup.
|
|
|
|
|
|
|
|
## Services definitions
|
|
|
|
|
|
|
|
As the B4S project .JAR files only include the code, the services (and activities and broadcast receivers) still need to be declared in your `AndroidManifest.xml`:
|
|
|
|
|
|
|
|
1. Open your project AndroidManifest.xml
|
|
|
|
2. Add the required permissions for access to internet, Bluetooth LE, location and the boot receiver:
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<uses-permission android:name="android.permission.BLUETOOTH" />
|
|
|
|
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
|
|
|
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
|
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
|
|
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
|
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
|
|
<uses-feature android:name="android.hardware.bluetooth_le" android:required="false" />
|
|
|
|
```
|
|
|
|
|
|
|
|
3. The Google Play Services requires some meta data in the `<application>` tag.
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<meta-data android:name="com.google.android.gms.version"
|
|
|
|
android:value="@integer/google_play_services_version" />
|
|
|
|
```
|
|
|
|
|
|
|
|
4. Add the B4S services to the `<application>` element to allow background scanning for and interacting with beacons.
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<!-- Background monitoring for beacons -->
|
|
|
|
<service
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.monitor.MonitoringManager"
|
|
|
|
android:exported="true"
|
|
|
|
tools:ignore="ExportedService">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="com.ezeeworld.b4s.android.sdk.monitor.B4S_ENSURE_SCANNING" />
|
|
|
|
<action android:name="com.ezeeworld.b4s.android.sdk.monitor.B4S_QUERY_SCHEDULE" />
|
|
|
|
<action android:name="com.ezeeworld.b4s.android.sdk.monitor.B4S_SCHEDULE_RESULT" />
|
|
|
|
<action android:name="com.ezeeworld.b4s.android.sdk.monitor.B4S_QUERY_VERSION" />
|
|
|
|
<action android:name="com.ezeeworld.b4s.android.sdk.monitor.B4S_REPORT_VERSION" />
|
|
|
|
</intent-filter>
|
|
|
|
</service>
|
|
|
|
<service
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.monitor.ScanService"
|
|
|
|
android:exported="false" />
|
|
|
|
<service
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.monitor.InteractionService"
|
|
|
|
android:exported="true"
|
|
|
|
tools:ignore="ExportedService">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="com.ezeeworld.b4s.android.sdk.monitor.B4S_OBSERVATIONS" />
|
|
|
|
</intent-filter>
|
|
|
|
</service>
|
|
|
|
<service
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.notifications.NotificationService"
|
|
|
|
android:exported="false" />
|
|
|
|
|
|
|
|
<activity
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.monitor.WebViewInteractionActivity"
|
|
|
|
android:configChanges="orientation|keyboardHidden"
|
|
|
|
android:exported="true"
|
|
|
|
android:noHistory="true" />
|
|
|
|
|
|
|
|
<receiver android:name="com.ezeeworld.b4s.android.sdk.monitor.SystemEventReceiver">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="android.intent.action.ACTION_USER_PRESENT" />
|
|
|
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
|
|
</intent-filter>
|
|
|
|
</receiver>
|
|
|
|
```
|
|
|
|
|
|
|
|
## Push messaging defintitions
|
|
|
|
|
|
|
|
If you use the push messaging feature of the B4S SDK, also add the push services. Outside of the `<application>` you need additional permissions:
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
|
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
|
|
|
<permission android:name="com.ezeeworld.b4s.android.sdk.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" />
|
|
|
|
```
|
|
|
|
|
|
|
|
and in the `<application>` tag the push services registration:
|
|
|
|
|
|
|
|
```xml
|
|
|
|
<!-- Push messaging -->
|
|
|
|
<receiver
|
|
|
|
android:name="com.google.android.gms.gcm.GcmReceiver"
|
|
|
|
android:exported="true"
|
|
|
|
android:permission="com.google.android.c2dm.permission.SEND">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
|
|
|
<category android:name="com.ezeeworld.b4s.android.sdk.gcm" />
|
|
|
|
</intent-filter>
|
|
|
|
</receiver>
|
|
|
|
|
|
|
|
<service
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.push.GcmListenerService"
|
|
|
|
android:exported="false">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
|
|
|
</intent-filter>
|
|
|
|
</service>
|
|
|
|
<service
|
|
|
|
android:name="com.ezeeworld.b4s.android.sdk.push.InstanceIDListenerService"
|
|
|
|
android:exported="false">
|
|
|
|
<intent-filter>
|
|
|
|
<action android:name="com.google.android.gms.iid.InstanceID" />
|
|
|
|
</intent-filter>
|
|
|
|
</service>
|
|
|
|
```
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
For a fully defined example, please see [the `sample-eclipse` project's `AndroidManifest.xml`](https://github.com/ezeeworld/B4S-Android-SDK/blob/master/sample-eclipse/AndroidManifest.xml).
|
|
|
|
|
|
|
|
## Configuration
|
|
|
|
|
|
|
|
Continue with the [[configuration as described in the main Integration Guide|Integration-guide]]. |
|
|
|
\ No newline at end of file |