这里会显示出您选择的修订版和当前版本之间的差别。
en:razor:android-developer-guide [2015/03/18 15:21] cobub [2.2 SDK Usage Step] |
en:razor:android-developer-guide [2017/07/14 11:18] |
||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Cobub Razor Android Developer Guide ====== | ||
- | |||
- | - [[#Overview|Overview]] | ||
- | - [[#Basic Setup Guide|Basic Setup Guide]] | ||
- | - [[#Advanced Setup Guide|Advanced Setup Guide]] | ||
- | - [[#App Update|App Update]] | ||
- | - [[#Data Sending|Data Sending]] | ||
- | - [[#Online Configuration|Online Configuration]] | ||
- | |||
- | ===== 1 Overview ===== | ||
- | |||
- | |||
- | ==== 1.1 Documentation Goal ==== | ||
- | |||
- | |||
- | The goal of this document is to explain usage rules of Cobub Razor Android SDK for facilitating developers. | ||
- | |||
- | ==== 1.2 Application Scope ==== | ||
- | |||
- | |||
- | This document is for Android SDK developers, who use the Open Source Mobile Analytics – Cobub Razor. | ||
- | |||
- | ==== 1.3 Terms and Abbreviations ==== | ||
- | |||
- | |||
- | Cobub Razor - [[en:razor:|The Open Source Mobile Analytics]] | ||
- | |||
- | ===== 2 Basic Setup Guide ===== | ||
- | |||
- | |||
- | ==== 2.1 Register App,Obtain AppKey,Download Developer Documentation ==== | ||
- | |||
- | |||
- | First please setup the Web Server of Cobub Razor ([[en:razor:installation|instruction]]), then register App on web server and fill App info after login. Once App is created successfully, you could obtain AppKey. | ||
- | |||
- | ==== 2.2 SDK Usage Step ==== | ||
- | |||
- | |||
- | === 2.2.1 Import com.wbkit1.0.jar === | ||
- | |||
- | |||
- | 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. | ||
- | |||
- | === 2.2.2 Configure AndroidManifest.xml === | ||
- | |||
- | * Add App **AppKey** (mandatory) | ||
- | Add AppKey obtained by App to meta-data of AndroidManifest.xml. | ||
- | |||
- | (Note: String must be ‘UMS_APPKEY‘) | ||
- | |||
- | * Add permission **android.permission.INTERNET** (mandatory) | ||
- | Send user analytic data to server. | ||
- | |||
- | * Add permission **android.permission.READ_PHONE_STATE** (mandatory) | ||
- | Obtain relevant status info of phone. | ||
- | |||
- | * Add permission **android.permission.ACCESS_FINE_LOCATION** (mandatory) | ||
- | Obtain current user’s location info. | ||
- | |||
- | * Add permission **android.permission.ACCESS_WIFI_STATE** (mandatory) | ||
- | Visit Wi-Fi network status info. | ||
- | |||
- | * Add permission **android.permission.GET_TASKS** (mandatory) | ||
- | Obtain recent running task info. | ||
- | |||
- | * Add permission **android.permission.WRITE_EXTERNAL_STORAGE** (mandatory) | ||
- | Read and write file to sdcard. | ||
- | |||
- | * Add permission **android.permission.READ_LOGS**(mandatory) | ||
- | Read program error log. | ||
- | |||
- | * Add permission **android.permission.ACCESS_NETWORK_STATE**(mandatory) | ||
- | Visit GSM network info. | ||
- | |||
- | The AndroidManifest.xml file as shown below: | ||
- | |||
- | <code><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></code> | ||