2011年10月29日 星期六

[Sensor Simulator] 利用感測器模擬軟體來開發Android Sensor應用程式

1. 建立新專案



2.產生Hello程式,修改資源檔。


3. 修改程式


4.修改AndroidManifest.xml檔案。

5.測試

[Sensor Simulator] 設定TCP/IP使用許可權

由於感測器模擬軟體採用TCP/IP技術來設計,因此我們在設計Android應用程式時,,要記得在AndroidManifest.xml檔中加上TCP/IP使用許可權。

2011年10月28日 星期五

[Sensor Simulator] 運用感測器模擬軟體來發展Android App的祕技

如何運用感測器模擬軟體來發展Android App的步驟寫在原始程式SensorSimulatorDemoActivity.java程式中,第57行到第79行中,如圖所示。

[Sensor Simulator] 編譯及執行感測器模擬軟體原始程式

1. 打開eclipse,File選單中的import選項。

2. 選擇SensorSimulatorDemo原始程式。

3. 按下確定鈕。

4. 執行程式。

5. 測試程式。

[Sensor Simulator] 感測器模擬軟體安裝及使用


1. 打開bin目錄,執行sensorsimulator-2.0-rc1.jar。

2. 執行手機模擬器

3. 使用放到android-sdk-windows\tools目錄下的adb來安裝感測器模擬軟體設置檔到Android模擬器上。

4. 在手機模擬器上執行剛才安裝的程式。

5.設定IP


6.選取Sensor Simulator Settings上的Testing標籤,按下connect按鈕,並勾選選項,測試感知器的動作。

[Sensor Simulator] 感測器模擬程式 2.0下載及目錄說明

感測器模擬程式 2.0在2011年8月23日提供下載,其網址為
http://code.google.com/p/openintents/downloads/list
下載請將它展開後其目錄有
- bin (*): 包括可執行檔SensorSimulator.jar,SensorSimulatorSettings.apk and SensorRecordFromDevice.apk。
- lib (*): 包括函式庫sensorsimulator-lib.jar。
- release: 編譯腳本來說明組裝發行。
- samples: Android範例檔。
- SensorSimulator: 包括感測器模擬器的原始碼。
- SensorSimulatorSettings: 包括感測器模擬器設置檔的原始程式。
- SensorRecordFromDevice: 包括從裝置讀取感測值的原始程式。