Android的BluetoothServerSocket和BluetoothSocket无法连接

发布于 2025-01-11 06:51:46 字数 12713 浏览 0 评论 0原文

我尝试开发一个蓝牙服务器客户端应用程序。但我在作为客户端连接时遇到问题。客户端不连接到服务器,它只是等待或尝试连接。设备未配对,我知道我们可以使用BluetoothServerSocket 来通信两个未配对的设备。

这里我的服务器端代码

    BluetoothServerSocket bluetoothServer;
    BluetoothAdapter mBluetoothAdapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //displayText = (TextView) findViewById(R.id.display_text);
        //bluetoothServer = new BluetoothServer(handler, updateUI);
        //bluetoothServer.start();
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        mBluetoothAdapter.enable();
        Log.i("bluetooth", "connecting<--------------");
        try {
            bluetoothServer = mBluetoothAdapter.listenUsingInsecureRfcommWithServiceRecord("helloService",
                    UUID.fromString("00001101-0000-1000-8000-008099999999"));
            bluetoothServer.accept();
            Log.i("bluetooth", "connected<--------------");
        }catch (Exception e){
            Log.e("error", String.valueOf(e));
        }

    }



服务器端代码的控制台输出:


03/01 14:49:56: Launching 'app' on samsung SM-A310F.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.dicle_attendance/com.example.dicle_attendance.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.example.dicle_attendance
Connected to process 31581 on device 'samsung-sm_a310f-310016b9f135132f'.
Connecting to com.example.dicle_attendance
Connected to the target VM, address: 'localhost:57260', transport: 'socket'
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
E/Zygote: v2
I/libpersona: KNOX_SDCARD checking this for 10060
I/libpersona: KNOX_SDCARD not a persona
E/Zygote: accessInfo : 0
W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -4 -1 0 1]
I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.example.dicle_attendance 
I/art: Late-enabling -Xcheck:jni
D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
W/ActivityThread: Application com.example.dicle_attendance is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/art: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1311)
W/System: ClassLoader referenced unknown path: /data/app/com.example.dicle_attendance-2/lib/arm
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/TextView: setTypeface with style : 0
D/TextView: setTypeface with style : 0
D/TextView: setTypeface with style : 0
D/BluetoothAdapter: enable()
D/BluetoothAdapter: enable(): BT is already enabled..!
I/bluetooth: connecting<--------------
D/BluetoothSocket: bindListen(): myUserId = 0
W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback

如您所见,连接已写入,但未连接。

这是我的客户端代码:

    BluetoothAdapter bAdapter;
    BluetoothDevice device;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        bAdapter = BluetoothAdapter.getDefaultAdapter();
        bAdapter.enable();
        IntentFilter filter = new IntentFilter();

        filter.addAction(BluetoothDevice.ACTION_FOUND);
        filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
        filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
        registerReceiver(mReceiver, filter);
        bAdapter.startDiscovery();
        Log.d("tag","######connecting########");
        try {
            BluetoothSocket socket = device.createInsecureRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-008099999999"));
            socket.connect();
            Log.d("tag","######connected########");

        }catch (Exception e){
            Log.e("tag", String.valueOf(e));
        }


    }

这是我的客户端输出:


03/01 14:41:06: Launching 'app' on Xiaomi M2003J15SC.
Install successfully finished in 93 ms.
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1473)
I/ForceDarkHelper: packageName:com.example.client_side getForceDarkConfigInfo null  forceDarkAppConfigJsonString:null
I/ForceDarkHelper: ForceDarkConfigInfo: null
I/MiuiForceDarkConfig: MiuiForceDarkConfig setConfig density:2.750000, mainRule:17, secondaryRule:0, tertiaryRule:0
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/Looper: PerfMonitor longMsg : seq=3 plan=14:41:05.059 late=73ms wall=4771ms running=803ms runnable=4ms h=android.app.ActivityThread$H w=110 procState=12
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
D/View: com.example.client_side initForcedUseForceDark: 1
D/DecorView[]: getWindowModeFromSystem  windowmode is 1
D/DecorView: createDecorCaptionView windowingMode:1 mWindowMode 1 isFullscreen: true
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
I/chatty: uid=10294(com.example.client_side) identical 1 line
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
W/ple.client_sid: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/ple.client_sid: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
D/BluetoothAdapter: enable(): BT already enabled!
D/tag: ######connecting########
E/tag: java.lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothSocket android.bluetooth.BluetoothDevice.createInsecureRfcommSocketToServiceRecord(java.util.UUID)' on a null object reference
W/Activity: Slow Operation: Activity com.example.client_side/.MainActivity onCreate took 1112ms
I/SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@2ef5d55
D/ViewRootImpl[MainActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/InputTransport: Create ARC handle: 0xb40000771fce8800
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
W/Looper: PerfMonitor longMsg : seq=4 plan=14:41:05.061 late=4900ms wall=1774ms running=1656ms runnable=1ms h=android.app.ActivityThread$H w=159 procState=12
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=1774ms latency=4900ms running=1656ms  procState=12 ClientTransaction{ callbacks=[android.app.servertransaction.LaunchActivityItem] lifecycleRequest=android.app.servertransaction.ResumeActivityItem } historyMsgCount=3 (msgIndex=1 wall=76ms seq=1 running=65ms io=3ms late=5ms h=android.app.ActivityThread$H w=162) (msgIndex=3 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110)
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=3ms latency=6727ms running=4ms  procState=12 ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] } historyMsgCount=4 (msgIndex=1 wall=76ms seq=1 running=65ms io=3ms late=5ms h=android.app.ActivityThread$H w=162) (msgIndex=3 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=4 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=3ms latency=3528ms running=4ms  procState=12 ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] } historyMsgCount=5 (msgIndex=1 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=2 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=14ms latency=3531ms running=15ms  procState=12 ClientTransaction{ lifecycleRequest=android.app.servertransaction.PauseActivityItem } historyMsgCount=6 (msgIndex=1 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=2 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=41ms latency=3059ms running=36ms  procState=12 ClientTransaction{ lifecycleRequest=android.app.servertransaction.StopActivityItem } historyMsgCount=8 (msgIndex=1 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=2 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
I/ple.client_sid: ProcessProfilingInfo new_methods=0 is saved saved_to_disk=0 resolve_classes_delay=8000
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
E/ion: ioctl c0044901 failed with code -1: Invalid argument
W/Looper: PerfMonitor doFrame : time=323ms vsyncFrame=0 latency=34ms procState=2 historyMsgCount=1
W/RenderInspector: QueueBuffer time out on com.example.client_side/com.example.client_side.MainActivity, count=1, avg=18 ms, max=18 ms.
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0

正如您再次看到的,连接文本已写入,但未连接。

虽然服务器端是 anroid 7,客户端是 android 11,

但应用程序的权限相同,如下所示:


    <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

I try to develop a bluetooth server-client application. But I have a problem about connecting as client. The client does not connect to server it just waits or trying to connect. The devices are not paired, I know we can use BluetoothServerSocket to communicate two no-paired devices.

Here my server side codes

    BluetoothServerSocket bluetoothServer;
    BluetoothAdapter mBluetoothAdapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //displayText = (TextView) findViewById(R.id.display_text);
        //bluetoothServer = new BluetoothServer(handler, updateUI);
        //bluetoothServer.start();
        mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
        mBluetoothAdapter.enable();
        Log.i("bluetooth", "connecting<--------------");
        try {
            bluetoothServer = mBluetoothAdapter.listenUsingInsecureRfcommWithServiceRecord("helloService",
                    UUID.fromString("00001101-0000-1000-8000-008099999999"));
            bluetoothServer.accept();
            Log.i("bluetooth", "connected<--------------");
        }catch (Exception e){
            Log.e("error", String.valueOf(e));
        }

    }



console output of the server side codes:


03/01 14:49:56: Launching 'app' on samsung SM-A310F.
App restart successful without requiring a re-install.
$ adb shell am start -n "com.example.dicle_attendance/com.example.dicle_attendance.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.example.dicle_attendance
Connected to process 31581 on device 'samsung-sm_a310f-310016b9f135132f'.
Connecting to com.example.dicle_attendance
Connected to the target VM, address: 'localhost:57260', transport: 'socket'
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
E/Zygote: v2
I/libpersona: KNOX_SDCARD checking this for 10060
I/libpersona: KNOX_SDCARD not a persona
E/Zygote: accessInfo : 0
W/SELinux: SELinux selinux_android_compute_policy_index : Policy Index[2],  Con:u:r:zygote:s0 RAM:SEPF_SECMOBILE_7.0_0009, [-1 -1 -4 -1 0 1]
I/SELinux: SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.example.dicle_attendance 
I/art: Late-enabling -Xcheck:jni
D/TimaKeyStoreProvider: TimaKeyStore is not enabled: cannot add TimaSignature Service and generateKeyPair Service
W/ActivityThread: Application com.example.dicle_attendance is waiting for the debugger on port 8100...
I/System.out: Sending WAIT chunk
I/art: Debugger is active
I/System.out: Debugger has connected
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1311)
W/System: ClassLoader referenced unknown path: /data/app/com.example.dicle_attendance-2/lib/arm
W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
D/TextView: setTypeface with style : 0
D/TextView: setTypeface with style : 0
D/TextView: setTypeface with style : 0
D/BluetoothAdapter: enable()
D/BluetoothAdapter: enable(): BT is already enabled..!
I/bluetooth: connecting<--------------
D/BluetoothSocket: bindListen(): myUserId = 0
W/BluetoothAdapter: getBluetoothService() called with no BluetoothManagerCallback

As you see connecting is wroten but connected not.

Here my client side codes:

    BluetoothAdapter bAdapter;
    BluetoothDevice device;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        bAdapter = BluetoothAdapter.getDefaultAdapter();
        bAdapter.enable();
        IntentFilter filter = new IntentFilter();

        filter.addAction(BluetoothDevice.ACTION_FOUND);
        filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_STARTED);
        filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
        registerReceiver(mReceiver, filter);
        bAdapter.startDiscovery();
        Log.d("tag","######connecting########");
        try {
            BluetoothSocket socket = device.createInsecureRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-008099999999"));
            socket.connect();
            Log.d("tag","######connected########");

        }catch (Exception e){
            Log.e("tag", String.valueOf(e));
        }


    }

Here my output of the client side:


03/01 14:41:06: Launching 'app' on Xiaomi M2003J15SC.
Install successfully finished in 93 ms.
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1473)
I/ForceDarkHelper: packageName:com.example.client_side getForceDarkConfigInfo null  forceDarkAppConfigJsonString:null
I/ForceDarkHelper: ForceDarkConfigInfo: null
I/MiuiForceDarkConfig: MiuiForceDarkConfig setConfig density:2.750000, mainRule:17, secondaryRule:0, tertiaryRule:0
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
W/Looper: PerfMonitor longMsg : seq=3 plan=14:41:05.059 late=73ms wall=4771ms running=803ms runnable=4ms h=android.app.ActivityThread$H w=110 procState=12
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
D/View: com.example.client_side initForcedUseForceDark: 1
D/DecorView[]: getWindowModeFromSystem  windowmode is 1
D/DecorView: createDecorCaptionView windowingMode:1 mWindowMode 1 isFullscreen: true
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
I/chatty: uid=10294(com.example.client_side) identical 1 line
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
W/ple.client_sid: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
W/ple.client_sid: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
D/BluetoothAdapter: enable(): BT already enabled!
D/tag: ######connecting########
E/tag: java.lang.NullPointerException: Attempt to invoke virtual method 'android.bluetooth.BluetoothSocket android.bluetooth.BluetoothDevice.createInsecureRfcommSocketToServiceRecord(java.util.UUID)' on a null object reference
W/Activity: Slow Operation: Activity com.example.client_side/.MainActivity onCreate took 1112ms
I/SurfaceFactory: [static] sSurfaceFactory = com.mediatek.view.impl.SurfaceFactoryImpl@2ef5d55
D/ViewRootImpl[MainActivity]: hardware acceleration = true , fakeHwAccelerated = false, sRendererDisabled = false, forceHwAccelerated = false, sSystemRendererDisabled = false
I/InputTransport: Create ARC handle: 0xb40000771fce8800
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
W/Looper: PerfMonitor longMsg : seq=4 plan=14:41:05.061 late=4900ms wall=1774ms running=1656ms runnable=1ms h=android.app.ActivityThread$H w=159 procState=12
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=1774ms latency=4900ms running=1656ms  procState=12 ClientTransaction{ callbacks=[android.app.servertransaction.LaunchActivityItem] lifecycleRequest=android.app.servertransaction.ResumeActivityItem } historyMsgCount=3 (msgIndex=1 wall=76ms seq=1 running=65ms io=3ms late=5ms h=android.app.ActivityThread$H w=162) (msgIndex=3 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110)
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=3ms latency=6727ms running=4ms  procState=12 ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] } historyMsgCount=4 (msgIndex=1 wall=76ms seq=1 running=65ms io=3ms late=5ms h=android.app.ActivityThread$H w=162) (msgIndex=3 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=4 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=3ms latency=3528ms running=4ms  procState=12 ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] } historyMsgCount=5 (msgIndex=1 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=2 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=14ms latency=3531ms running=15ms  procState=12 ClientTransaction{ lifecycleRequest=android.app.servertransaction.PauseActivityItem } historyMsgCount=6 (msgIndex=1 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=2 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
W/Looper: PerfMonitor looperActivity : package=com.example.client_side/.MainActivity time=41ms latency=3059ms running=36ms  procState=12 ClientTransaction{ lifecycleRequest=android.app.servertransaction.StopActivityItem } historyMsgCount=8 (msgIndex=1 wall=4771ms seq=3 running=803ms runnable=4ms late=73ms h=android.app.ActivityThread$H w=110) (msgIndex=2 wall=1774ms seq=4 running=1656ms runnable=1ms late=4900ms h=android.app.ActivityThread$H w=159)
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
E/libc: Access denied finding property "ro.vendor.pref_scale_resolution"
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
I/ple.client_sid: ProcessProfilingInfo new_methods=0 is saved saved_to_disk=0 resolve_classes_delay=8000
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
E/ion: ioctl c0044901 failed with code -1: Invalid argument
W/Looper: PerfMonitor doFrame : time=323ms vsyncFrame=0 latency=34ms procState=2 historyMsgCount=1
W/RenderInspector: QueueBuffer time out on com.example.client_side/com.example.client_side.MainActivity, count=1, avg=18 ms, max=18 ms.
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
V/PhoneWindow: DecorView setVisiblity: visibility = 0, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
V/PhoneWindow: DecorView setVisiblity: visibility = 4, Parent = android.view.ViewRootImpl@d9579d1, this = DecorView@c68bc36[MainActivity]
I/GED: ged_boost_gpu_freq, level 100, eOrigin 2, final_idx 31, oppidx_max 31, oppidx_min 0

As you see again connecting text is wroten but connected not.

While server side is anroid 7, client side is android 11

the permissions are same both app and like below:


    <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
    <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
    <uses-permission android:name="android.permission.BLUETOOTH"/>
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
    <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.LOCAL_MAC_ADDRESS"
        tools:ignore="ProtectedPermissions" />
    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文