Android SDK : Download and Setup
Registration and Download
This is the first step to integrating an app with BleshCMS. Registering creates a Blesh account and provides access to everything needed to get started. You can sign up by clicking this link.
Register to Download
You will have to be registered to BleshCMS to be able to download the Android SDK.
Setting Up your Android Project
Before starting with this guide please download the Android BleshSDK framework first.
We are distributing the BleshSDK as a library project believing this will make the integration process more convenient for developers. Basically, this process should not be any different than importing any other Android library project. In this documentation, you will find platform specific information and restrictions related to the BleshSDK for Android developers using Eclipse. Download the BleshSDK library project and extract it to a local folder of your preference. In order to import BleshSDK into your workspace, go to āFile -> Importā¦ā and choose āExisting Projects into Workspaceā under General.
Importing Blesh SDK Library
Specify the location for the extracted BleshSDK library project which will import the library project into your workspace. If you do not want to copy the project folder into your current workspace, please leave āCopy projects into workspaceā box unchecked.
Specifying The Location
Now you can reference the BleshSDK library project in your dependent application. In your new/existing application, go to Project -> Properties -> Android -> Library -> Add⦠and choose the BleshSDK project you have imported in the previous step.
Android Project Properties
Apart from importing and referencing the BleshSDK in your project, you should also change your project properties file in order to merge manifest files for your application to use the BleshSDK features. Edit your āproject.propertiesā file in the project folder and add the following line:
manifestmerger.enabled = true
PS
Please note that if you are using Eclipse on Mac platform, āmanifestmerger.enabled = trueā may not work as expected. In that case, you should manually register the necessary definitions in your projects manifest file. Manual registration is also required in case you have any other library project imported to your project, such as the Facebook SDK.
This should be sufficient to claim necessary permissions and register the required elements for the BleshSDK library in your project. Alternatively, you can modify your projectās āAndroidManifest.xmlā file manually and do the necessary editing. You can find the BleshSDK manifest file within the project folder. However, you should be aware of the confliction issues regarding the required Android SDK version for Bluetooth Low Energy libraries. In order to use Bluetooth Smart technology features, Android requires minimum SDK version of 4.3 (API Level 18) as well as the related bluetooth and bluetooth admin permissions. However, you can still import the BleshSDK to your project if you want your device to support earlier Android versions. Blesh will not operate on devices running previous Android versions, but your applicationās remaining features should continue to work as before.
Androidmanifest.xml Configuration
Here are the permissions required for BleshSDK.
<!-- BLE is not supported for devices running on OS lower than Android 4.3.
It is perfectly ok to use a lower minimum or higher target version if your application supports a broader range.
Although Blesh service will not operate on those lower versions. It will not throw an exception, it will not startand it will just stay down.
This should not affect the rest of your application. -->
<uses-sdk
android:minSdkVersion="18"
android:targetSdkVersion="19" />
<!-- Blesh SDK required permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- Blesh SDK manifest definitons -->
<!-- between application tags -->
<activity android:name="com.blesh.sdk.activity.BleshMainActivity"
android:exported="true" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name="com.blesh.sdk.classes.Blesh"
android:enabled="true"
android:exported="true" >
</service>
<receiver android:name="com.blesh.sdk.broadcastreceiver.BleshBootup" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<receiver android:name="com.blesh.sdk.broadcastreceiver.BluetoothStatusChangeReceiver" >
<intent-filter>
<action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />
</intent-filter>
</receiver>
<service
android:name="com.blesh.sdk.ibeacon.service.IBeaconService"
android:enabled="true"
android:exported="true"
android:isolatedProcess="false"
android:label="iBeacon" >
</service>
<service
android:name="com.blesh.sdk.ibeacon.IBeaconIntentProcessor"
android:enabled="true" >
</service>
<!-- Blesh SDK manifest definitons -->
<!-- between application tags -->
Proguard
If you are using Proguard, add the following parameters to your Proguard config file(default is 'proguard-android.txt').
##----Blesh----##
-keep class com.blesh.sdk.** { *; }
##----OkHttp----##
-dontwarn rx.**
-dontwarn okio.**
-dontwarn com.squareup.okhttp.**
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
##----Gson----##
-keepattributes Signature
-keepattributes *Annotation*
-keep class sun.misc.Unsafe { *; }
-keep class com.google.gson.examples.android.model.** { *; }
Thatās all. Now you can assign a campaign using Blesh CMS Platform ā My Campaigns section.
If you have an iBeacon, you can also experience the iBeacon campaign from your application. In order to do that, donāt forget to mount your iBeacon with the corresponding UUID, Major and Minor values to the Blesh CMS Platform.
Canāt get enough? Try Community pages for further information and pro tips or you can always contact us at [email protected].
Updated less than a minute ago
