Make communication between 2 android phones over B

2020-03-28 02:35发布

问题:

I have two android smartphones (Xperia Z and Xperia Z1) and both have BLE capability.

Can I connect to one of them as a peripheral over BLE? In my application I can see and conenct a BLE as peripheral (CC2541 device) and I can see all sevices and characteristics. But same application can not see one of my phones??

Is there a way to achice that??

回答1:

As of Android 4.4 there is no support for peripheral mod in the Android BLE apis. You would need this to be able to make two phones talk over BLE setting one up as a peripheral and the other as central.

There is a feature request for the feature you may want to take notice of.

If you just want to be able to get the two phones connecting there is nothing stopping you from using classic Bluetooth which should be perfectly workable.



回答2:

Android does not support peripheral mode till version 5.0(latest version) therefore you can not communicate with two smartphone over BLE.

You can communicate over BLE with sensor device and smart phone here smartphone app works as client and senser device as a server.

and if you want to communicate between two smartphone you have to use classic bluetooth.