2011-07-12 51 views
3

我試圖將我的Android手機廣播爲藍牙服務器,爲此,我首先要讓Android「可發現」。在Android上禁用「Bluetooth權限請求」確認 - 使用ACTION_REQUEST_DISCOVERABLE

我這樣使用ACTION_REQUEST_DISCOVERABLE,如下所示: http://developer.android.com/guide/topics/wireless/bluetooth.html#EnablingDiscoverability

testIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); 
startActivity(testIntent); 

不幸的是,這也彈出一個「藍牙權限請求」對話框的電話。

有沒有辦法讓我的手機「可發現」,而不必提示用戶?

謝謝!

回答

0

嘗試包括BLUETOOTH_ADMIN允許您的應用程序了

+0

試了一下......不行...... –

+0

好像你不能使用意圖的時候..解決方法是使用反射並在覆蓋用戶對話框您可以使用反射來調用BluetoothService的setScanMode方法,請參閱此線程... http://code.google.com/p/android/issues/detail?id=6348#c34 –

+0

我無法根據手機對於這個應用程序...無論如何。 –