2
我正在開發一個使用Android的藍牙實現的Android應用程序。我想知道是否可以在Android模擬器中測試藍牙。用戶可以使用藍牙從Android模擬器發送文件嗎?在android中使用藍牙發送文件
我正在開發一個使用Android的藍牙實現的Android應用程序。我想知道是否可以在Android模擬器中測試藍牙。用戶可以使用藍牙從Android模擬器發送文件嗎?在android中使用藍牙發送文件
這些都是仿真器
模擬器限制的侷限性
* No support for placing or receiving actual phone calls. You can simulate phone calls (placed and received) through the emulator console, however.
* No support for USB connections
* No support for camera/video capture (input).
* No support for device-attached headphones
* No support for determining connected state
* No support for determining battery charge level and AC charging state
* No support for determining SD card insert/eject
* No support for Bluetooth
我在我的應用程序中使用這個....
try {
File myFile = new File("filepath");
MimeTypeMap mime = MimeTypeMap.getSingleton();
String ext=myFile.getName().substring(myFile.getName().lastIndexOf(".")+1);
String type = mime.getMimeTypeFromExtension(ext);
Intent sharingIntent = new Intent("android.intent.action.SEND");
sharingIntent.setType(type);
sharingIntent.putExtra("android.intent.extra.STREAM",Uri.fromFile(myFile));
startActivity(Intent.createChooser(sharingIntent,"Share using"));
}
catch(Exception e){
Toast.makeText(getBaseContext(), e.getMessage(),Toast.LENGTH_SHORT).show();
}