Bluetooth not sending file to other device

前端 未结 4 1337
深忆病人
深忆病人 2021-02-14 12:41

It is already asked but i didn\'t find any solution. For bluetooth application i am using the bluetoothShare.class .

My source code for sending the file to

4条回答
  •  醉梦人生
    2021-02-14 13:05

    BluetoothShare class not supported android 4.1 and above. you can use the following intent coding to send file in android version 4.1 and above

    Intent intent = new Intent();
        intent.setAction(Intent.ACTION_SEND);
        intent.setComponent(new ComponentName(
            "com.android.bluetooth",
            "com.android.bluetooth.opp.BluetoothOppLauncherActivity"));
        intent.setType("image/jpeg");
        file = new File(filepath);
        intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
        startActivity(intent);
    

    and also some devices in Android v 2.2/2.3 not send the file via bluetoothShare class.

提交回复
热议问题