I have used Intent-SEND to share the files via bluetooth.I have add my code here.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setComponent(new ComponentName("com.android.bluetooth",
"com.android.bluetooth.opp.BluetoothOppLauncherActivity"));
intent.setType("text/plain");
File file = new File(Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/Sample.txt");
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
startActivity(intent);
This code is not working in android version 4.2.2. While running this code in android verison 4.2.2 , getting Exception:
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?
But this code working fine in below android 4.2.X. why this code is not working in android 4.2.2?.
You can share the file by bluetooth like this:
Try setting the packageName instead of the component