註冊 | 登入 | 全文檢索 | 排行榜 |
» JWorld@TW
» Java ME、Google Android 平台與 JavaCard 討論區
» Android
![]() ![]() |
![]() ![]() ![]() ![]() |
己加入精華區 |
by koji at 2009-05-08 09:16 |
本主題所含的標籤 |
作者 | Re:[提問]如何在emulator模擬sensor [Re:b9507] |
DavidLanz
![]() ![]() ![]() ![]() ![]() ![]() 發文: 6 積分: 1 ![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() mSensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); 但是以上這一行程式會導致AVD build target為Android 1.5(id=2)或Android Google APIs(id=3) 程式在Eclipse裡編譯正常,但是在以上兩個target模擬器執行階段發生Hang住的情況 我想Sensor simulator程式應該也是相同的寫法 所以在模擬器裡的remote程式 ![]() 與 ![]() 才會發生沒有回應的timeout問題(上兩圖為示意畫面,圖片連結至sensor simulator官方網站)。 已有網友曾經在Android Developers Forum提出了這個問題: http://groups.google.com/group/android-developers/browse_thread/thread/36c004c771849ae6/ad84a3277c9bf07f?show_docid=ad84a3277c9bf07f 並且由網友CommonsGuy2008發佈問題至Android Issue(單號:2566) http://code.google.com/p/android/issues/detail?id=2566 上述單號中,也有外國網友(markoteittinen)指出,這個問題只會在模擬器中發生 在CupCake(1.5)實機中使用是正常的,以下為引述內容: Comment 4 by markoteittinen, May 04 (3 days ago) Yes, this "only" happens in the emulator (I have cupcake on my dev phone and my app works there). But this bug makes debugging and development of apps that use sensors rather painful. In 1.1 I detected missing sensors by checking the return value of registerListener() call. Now I can't get to that point. How can we work around this problem in the emulator? And no, I don't like the idea of commenting out that part of my code while testing, and then uncommenting it for the release version. I'd rather detect that I am running on an emulator (or device where SENSOR_SERVICE is not available) and execute another if-branch. 而如果沒有使用到1.5的new feature,可以建立AVD target Android 1.1(id=1) 經測試是可正確執行Sensor simulator模擬程式 以上請您參考。歡迎您至本書官方網站:http://www.dubblogs.cc/Android/ 或在JavaWorld提出一起研究討論。 ![]() ![]() |
話題樹型展開 |
人氣 | 標題 | 作者 | 字數 | 發文時間 |
3068 |
![]() | b9507 | 194 | 2009-05-07 01:14 |
3024 |
![]() ![]() | DavidLanz | 1833 | 2009-05-08 08:55 |
» JWorld@TW » Java ME、Google Android 平台與 JavaCard 討論區 » Android |
![]() ![]() ![]() ![]() |
![]() ![]() ![]() |