叫我Aso 2013-08-27 07:54 采纳率: 0%
浏览 3075

有关第三方应用启动蓝牙的入口BluetoothOppLauncherActivity问题

我们在实现共享功能的时候,通常使用的是Intent intent = new Intent(Intent.ACTION_SEND)这样的代码,这种情况会弹出一个共享功能的选择界面,比如通过微博、蓝牙、邮件等等很多途径,现在我要实现的是跳过这个选择界面,直接选用蓝牙途径进行共享文件,代码如下
/** 蓝牙功能包名 /
private final String mBluetoothPackageName = "com.android.bluetooth";
/
* 蓝牙功能操作类名 */
private final String mBluetoothClassName = "com.android.bluetooth.opp.BluetoothOppLauncherActivity";

mSelfApkPath = getSelfAPKPath(mSelfApkPackage);
File file = new File(mSelfApkPath);
Intent intent = new Intent();
try {
intent.setAction(android.content.Intent.ACTION_SEND);
intent.setType("*/*");
// 以下此行代码功能为直接指向系统蓝牙搜索设备界面,去掉即跳转至客户端选择分享途径
intent.setClassName(mBluetoothPackageName, mBluetoothClassName);
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
} catch (Exception e) {
Toast.makeText(this, "该设备可能不支持蓝牙功能...",Toast.LENGTH_SHORT).show();
}
在实现过程中,手中的测试机器在执行到startActivity(intent)时并不会抛异常,而后面无意中却发现有的手机在这句程序居然抛出了异常,异常信息如下:
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.android.bluetooth/com.android.bluetooth.opp.BluetoothOppLauncherActivity}; have you declared this activity in your AndroidManifest.xml?

不知道哪位高手能指点这个错的原因(除了厂家改动到改文件);
或者指点如何实现我需要实现的功能:比如,点击一个按钮,能直接跳到蓝牙共享功能进行文件共享

  • 写回答

1条回答

  • chunjuan0126 2014-06-25 03:34
    关注

    错误信息很明显,在 AndroidManifest.xml 里面没有注册 BluetoothOppLauncherActivity。

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog