我尝试使用Android开发者网站上的Android蓝牙聊天示例连接两台设备.它仅从其中一个设备连接,当我尝试从另一个设备连接时,它没有连接并弹出消息"无法连接:[此处的设备名称]"
我想知道我是否在两个设备上使用相同的代码,为什么只从一方进行连接,而另一方拒绝连接?
我有2个设备 - 1个运行版本2.2和1个运行v2.3.3.我的请求总是从运行2.3.3的Galaxy Y发送到运行Android 2.2的Galaxy fit-v,但反之亦然.任何人都可以帮助我,或根据下面的代码给我建议...
@Override
public void onActivityResult(int requestCode, int resultCode, final Intent data) {
switch (requestCode) {
case REQUEST_CONNECT_DEVICE:
// When DeviceListActivity returns with a device to connect
if (resultCode == Activity.RESULT_OK) {
FaceCardList.requestConnection = true;
FaceCardList.deviceSelected = false;
address = data.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
device = FaceCardList.mBluetoothAdapter.getRemoteDevice(address);
// Attempt to connect to the device
FaceCardList.mChatService.connect(device);
// Get the device MAC address
}
break;
case REQUEST_ENABLE_BT:
// When the request to enable Bluetooth returns
if (resultCode == Activity.RESULT_OK) …Run Code Online (Sandbox Code Playgroud) 我正在尝试在Web Api中启用OData..我创建了一个appanyment类OData路由,以及一个继承自ODataController的控制器,我想在控制器中调用我的Get方法.
码:
public class Appointment : IMongoEntity
{
public ObjectId Id { get; set; }
public Company Company { get; set; }
public DateTime Time { get; set; }
public DateTime LastModified { get; set; }
public string Remark { get; set; }
}
public class AppointmentController : ODataController
{
private readonly MongoCrud<Appointment> _mongoCrud;
public AppointmentController()
{
_mongoCrud = new MongoCrud<Appointment>();
}
[EnableQuery]
public IQueryable<Appointment> GetAppointment()
{
return _mongoCrud.GetAllEntities();
}
}
Run Code Online (Sandbox Code Playgroud)
路由:
public static void Register(HttpConfiguration config)
{
// …Run Code Online (Sandbox Code Playgroud)