今天繼續研究這個問題,因為 android 很多 API 是隱藏的,例如:
/**
* Construct an unencrypted, unauthenticated, RFCOMM server socket.
* Call #accept to retrieve connections to this socket.
* @return An RFCOMM BluetoothServerSocket
* @throws IOException On error, for example Bluetooth not available, or
* insufficient permissions.
* @hide----!!!!!!!!!!
*/
public BluetoothServerSocket listenUsingInsecureRfcommOn(int port) throws IOException
解決的方法有兩種。
1. 直接放到 Android Source 中編譯。但是這樣就不使用 eslipse
2. 通过途观java反射机制,调用该方法。
第二點,是我在網路上查的方法。但是對方沒有細說要如何做。請問有人可以指點,要如何使用第二種方法嗎?