Cobub Razor
Cobub Toaster
Other Links
Cobub Razor
Cobub Toaster
Other Links
这是本文档旧的修订版!
The goal of this document is to explain usage rules of Cobub Razor Android SDK for facilitating developers.
This document is for Android SDK developers, who use the Open Source Mobile Analytics – Cobub Razor.
Cobub Razor - The Open Source Mobile Analytics
First please setup the Web Server of Cobub Razor (instruction), then register App on web server and fill App info after login. Once App is created successfully, you could obtain AppKey.
Open android_sdk in the directory you uploaded on the server. Import android_sdk to Eclipse and Eclipse will compile src and produce a bin folder. Zip the com folder in bin\classes as com.wbkit1.0.jar. Eclipse users right click own project root directory and select Properties —>Java Build Path —>libraries. Then click Add External JARs and select path of com.wbkit1.0.jar. Finally, click OK and then import is completed.
Add AppKey obtained by App to meta-data of AndroidManifest.xml.
(Note: String must be ‘UMS_APPKEY‘)
Send user analytic data to server.
Obtain relevant status info of phone.
Obtain current user’s location info.
Visit Wi-Fi network status info.
Obtain recent running task info.
Read and write file to sdcard.
Read program error log.
Visit GSM network info.
The AndroidManifest.xml file as shown below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.wbtech.test_sample" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_PHONE_STATE"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/> <uses-permission android:name="android.permission.GET_TASKS"/> <uses-permission android:name="android.permission.READ_LOGS"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".MainActivity" android:label="@string/title_activity_main" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <meta-data android:name="UMS_APPKEY" android:value="bb08202a625c2b5cae5e2632f604352f "/> </application> </manifest>
* Add Reference
import com.wbtech.ums.UmsAgent;
* Set web server URL
Call UmsAgent.setBaseURL(String url)in onCreate() method of App enter Activity, note that this method should be placed before all other methods.
* Obtain UserID
Call UmsAgent.bindUserIdentifier(String userID) method where you can obtain the unique identifier of user, and this method will record the userID on behalf of the user of using this application.
* Bind Tags
Call UmsAgent.postTags(final Context context, final String tags) method where you can obtain the attributes to tag the user. The tag values will be sent to server.
* Register Activity
Call UmsAgent.onResume(Context) in onResume method of every Activity. The passed parameter is the reference of current context. This method will read AppKey from AndroidManifest.xml automatically and record the time of user enters into this activity. Do not pass global application context.