2011-10-03 56 views
0

有沒有辦法在monkeyrunner上wifi開關otherthan使用cordinates.?Can我們使用WifiManager API從monkeyrunner。有沒有辦法在monkeyrunner上wifi開關otherthan使用cordinates

from android.net.wifi import WifiManger 將android.jar文件複製到工具/ lib位置後正在工作。但是如何在android fon中使用monkeyrunner/monkey調用WifiManger方法.. ??有人請幫忙。

回答

0

幾個月前,我研究了這個確切的問題。這對我來說似乎不可能;至少很容易。我能找到的最佳方法是使用startActivity儘可能地接近Wi-Fi設置,然後使用D-PAD命令進行編程,直到突出顯示正確的字段。你可以使用這個邏輯來開發一個小型的,目的建立的應用程序,onCreate或onResume切換wi-fi。就我而言,這不值得花這麼多時間。

+0

喜說笑A,感謝reply.yea d-PAD命令工作正常,但在我的情況,我想連接到一個掃描的wifi網絡也,所以它不可能找出掃描網絡中的位置,它改變ACC到信號strength.so不能夠使用DPAD連接.ANY IDEA ?? – Rilwan

1

您可以通過其他方式打開Wi-Fi。開始設置的活動並轉到「無線網絡設置」並啓用它。

下面的代碼是開始的設置的活動:

# sets a variable with the package's internal name 
package = 'com.android.settings' 

# sets a variable with the name of an Activity in the package 
activity = 'com.android.settings.Settings' 

# sets the name of the component to start 
runComponent = package + '/' + activity 

setting = 'com.android.settings.Settings' 

print("") 
print("") 
print("Start the Activity...") 

# Runs the component 
device.startActivity(component=runComponent) 

後由新聞發佈會上使用「向下」和「ENTER」鍵碼,您可以啓用了Wi-Fi ...! !

+0

我可以通過shell直接訪問設置頁面(「monkey -p com.android.settings 1」,「」,「」)..和DOWN UP工作正常。但是有什麼方法可以知道Wthr WIFI打開或關閉?? – Rilwan

相關問題