1

私は、Bluetoothを介して2台のAndroid携帯電話からプレイできるAndroidゲーム(Target API-8)を開発しています。私のアプリはAPIレベル8(Androidバージョン2.2)を対象としているため、安全でない接続を使用できません。ただし、デバイスをペアリングするためにユーザーの介入は必要ありません。http://mobisocial.stanford.edu/news/2011/03/bluetooth-reflection-and-legacy-nfc/を指すいくつかの回答を見つけました。ここで、Bluetooth接続についていくつか質問があります。

1)ブログで提供されているソリューションは安全に使用できますか?それは他の問題を引き起こしますか?androidのすべてのバージョンで動作しますか(安全でないBluetooth接続の問題があるICSを除く)??

2)アプリで複数のBluetoothSocketオブジェクトを作成できますか?基本的に私が試しているのは:(BluetoothChatデモを参照して)

(i)AcceptThread-run()メソッド

       // Listen to the server socket if we're not connected
        while (mState != STATE_CONNECTED) {
            try {
                // This is a blocking call and will only return on a
                // successful connection or an exception

            <**Go for InsecureBluetooth connection as mentioned in the blog**>
          }catch(IOException e)
          {

                 try {
                // This is a blocking call and will only return on a
                // successful connection or an exception

                <**Go for default secure connection**>
                }catch(IOException e)
               {

               } //next level catch
          }//top level catch
        }//while

これが可能かどうか教えてください。

4

0 に答える 0