-
Notifications
You must be signed in to change notification settings - Fork 1
Technical support
###Requirements
- Malcom Android library requires a minimum version 2.2, Froyo (API Level 8).
- The device needs at least a configured account. In the simulator the AVD needs the Google APIs and a configured account.
###Malcom Library integration
- Maven is the recommended way to add MalcomLib to your project
You have to configure the Malcom repository in your pom.xml
to use it.
In the repositories section:
<repositories>
<repository>
<id>Malcom Repository</id>
<url>http://maven-repo.mobivery.com.s3.amazonaws.com/release</url>
</repository>
</repositories>
In dependencies section:
<dependencies>
<dependency>
<groupId>com.malcom.library.android</groupId>
<artifactId>malcom-android-library</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
- Also you can add the library manually to your project. The Malcom Library for Android is composed by 3 .jar files.
- The source code ["malcom-android-library-1.0.4-sources.jar"](http://maven-repo.mobivery.com.s3.amazonaws.com/release/com/malcom/library/android/malcom-android-library/1.0.4/malcom-android-library-1.0.4-sources.jar
- "malcom-android-library-1.0.4.jar" ) (allows debbuging)
- The javadoc "malcom-android-library-1.0.4-javadoc.jar"
In order to integrate the library you have two options:
a) Add the "malcom-android-library-.jar" in "libs" folder.
b) Add the 3 files described above.
Option a) is better if you don't want to debug the library, option b) allows you to do so. With option b) you'll need to setup the "malcom-android-library--sources.jar" into the build path in the project properties.
#####Android Manifest
In your Manifest.xml you'll need to add the following permissions:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PHONE_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.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<!-- ..... -->
<application>
<!-- ..... -->
<service android:name="com.malcom.library.android.module.stats.services.PendingBeaconsDeliveryService" />
<!-- ..... -->
</application>
###Initializing
Firstly, you'll need to init Malcom in your Application extended class, make this call inside the onCreate() method because is the entry point for each activity of your application:
MCMCoreAdapter.getInstance().initMalcom(this, UUID_MALCOM, SECRET_KEY);
where the UUID_MALCOM is the MalcomAppId and SECRET_KEY is the MalcomAppSecretKey both provided by the Malcom Web.
Secondly you'll need to set the MalcomActivityLifecycleCallbacks to allow Malcom to know when your app is going to background or foreground. You'll need add this after the initMalcom call:
MalcomApplicationHelper.registerActivityLifecycleCallbacks(this, new MalcomActivityLifecycleCallbacks());
Thirdly, if your application is targeted for Android version before 4 (API 14), you'll need all your activities extending MalcomActivity.java
.
We have developed some Activity base classes to allow the use of FragmentActivity, ListActivity
or PreferenceActivity
but if you want to use other libraries (such ActionbarSherlock) that requires your activities extend too,
this is an example about how do that:
Example for the extend of Activity (ActionBarSherlock library)
Now you can use these modules: