|
@@ -31,8 +31,12 @@ import androidx.annotation.RequiresApi;
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
import androidx.appcompat.widget.Toolbar;
|
|
|
|
|
|
+import com.yanzhenjie.andserver.sample.util.Constant;
|
|
|
+import com.yanzhenjie.andserver.sample.util.HostUtil;
|
|
|
+import com.yanzhenjie.andserver.sample.websocket.SocketServer;
|
|
|
import com.yanzhenjie.loading.dialog.LoadingDialog;
|
|
|
|
|
|
+import java.net.InetSocketAddress;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -73,6 +77,12 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe
|
|
|
mServerManager.register();
|
|
|
BluetoothManager bluetoothManager = (BluetoothManager) this.getSystemService(Context.BLUETOOTH_SERVICE);
|
|
|
mBluetoothAdapter = bluetoothManager.getAdapter();
|
|
|
+ new Thread(() -> {
|
|
|
+ String address = HostUtil.getHostIp();
|
|
|
+ InetSocketAddress inetSocketAddress = new InetSocketAddress(address, Constant.WEB_SOCKET_PORT);
|
|
|
+ SocketServer socketServer = new SocketServer(inetSocketAddress);
|
|
|
+ socketServer.run();
|
|
|
+ }).start();
|
|
|
// startServer;
|
|
|
mBtnStart.performClick();
|
|
|
}
|