Android – Project setup

The following steps set up a project environment in Android Studio for integration of the Point SDK.

  1. Unzip the downloaded file and copy the JAR file to the app/libs folder.
  2. Add the JAR file as a dependency in the Gradle build file (further details are provided below in the Setting up Android Studio project section).
  3. Add the required permissions and service declaration in the AndroidManifest.xml file (further details are provided below in the AndroidManifest.xml section).
  4. It is recommended to examine and build the Minimal Integration Example app project, available as source code on GitHub. It provides a working example to troubleshoot any integration issues that may arise.

Setting up the Android Studio project

The screenshot below illustrates how the Android Studio project structure will look once the .jar file is placed into the libs folder.

Starting from 1.13.* version, need to add GMS Play services location also in dependencies.

The example below shows how build.gradle will look once the dependency is added.

dependencies {
   implementation fileTree(include:'*.jar',dir: 'libs')
   implementation 'com.google.android.gms:play-services-location:16.0.0'
 }

AndroidManifest.xml

The following are the permissions are required in the AndroidManifest.xml file. Make sure that the permissions and services declarations are included within the application section(<application …> </application>) of the AndroidManifest.XML file. An example AndroidManifest.xml file is available in the Minimal Integration Example app on GitHub.

<!-- General Point SDK functionality -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!-- Required for Beacons integration -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

In addition to the above permissions, the following services must be declared:

<!-- General Point SDK functionality -->
<service
    android:name="au.com.bluedot.point.net.engine.BlueDotPointJobService"
    android:exported="false"
    android:permission="android.permission.BIND_JOB_SERVICE"/>

<service
    android:name="au.com.bluedot.point.net.engine.BlueDotPointService"
    android:exported="false" />

<service
    android:name="au.com.bluedot.point.net.engine.DataIntentService"
    android:permission="android.permission.BIND_JOB_SERVICE"
    android:exported="false" />

<service
    android:name="au.com.bluedot.point.net.engine.DataJobScheduler"
    android:exported="false"
    android:permission="android.permission.BIND_JOB_SERVICE" />

<service
    android:name="au.com.bluedot.point.net.engine.BDJobRegistryService"
    android:exported="false"
    android:permission="android.permission.BIND_JOB_SERVICE" />

<service android:name="au.com.bluedot.point.net.engine.BluedotLocationService"
    android:exported="false"
    android:permission="android.permission.BIND_JOB_SERVICE" />

<receiver
    android:name="au.com.bluedot.point.net.engine.BluedotBootReceiver"
    android:directBootAware="true"
    android:enabled="false"
    android:exported="false">
    <intent-filter>
        <action android:name="android.intent.action.BOOT_COMPLETED" />
        <action android:name="android.intent.action.QUICKBOOT_POWERON" />
        <action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
    </intent-filter>
</receiver>

<receiver android:name="au.com.bluedot.point.net.engine.LocationUpdatesReceiver"
    android:exported="true">
    <intent-filter>
        <action android:name="au.com.bluedot.point.net.engine.LocationUpdatesReceiver.ACTION_PROCESS_UPDATES" />
    </intent-filter>
</receiver>


<receiver android:name="au.com.bluedot.point.net.engine.StartJobIntentServiceReceiver"/>

<receiver android:name="au.com.bluedot.point.net.engine.BDJobBroadcastReceiver"/>
<!-- Required for Beacons integration --> 
<service android:name="au.com.bluedot.point.beacon.BlueDotBLEService" android:exported="false">
 </service>

Additional setup in the manifest file is required if you intend to use Google Maps in your app. Please refer to the Google Maps Android API Documentation for instructions on implementing this functionality.

image

AndroidManifest.xml changes

When integrating Bluedot Point SDK using the AAR, there is no need to declare permissions or the services used by the SDK within the app’s AndroidManifest.xml file. These declarations are imported from the AndroidManifest.xml file bundled into the AAR.

Created by Bluedot DevOps on January 16, 2018