我正在开发一个使用Android蓝牙实现的Android应用程序。我想知道是否可以在Android模拟器中测试蓝牙。用户可以使用蓝牙从Android模拟器发送文件吗?
答案 0 :(得分:2)
这些是模拟器的限制
模拟器限制
* 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
答案 1 :(得分:0)
我在我的应用程序中使用了这个....
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();
}