How to send .apk file inside application using bluetooth

Is there a way to send the .apk file using bluetooth inside the application? (for example, we launch the application and then send the .apk file using the sharing icon inside the application)

+7
java android
source share
1 answer

Assuming you want to submit your own .apk application, it's pretty simple:

 // Get current ApplicationInfo to find .apk path ApplicationInfo app = getApplicationContext().getApplicationInfo(); String filePath = app.sourceDir; Intent intent = new Intent(Intent.ACTION_SEND); // MIME of .apk is "application/vnd.android.package-archive". // but Bluetooth does not accept this. Let use "*/*" instead. intent.setType("*/*"); // Only use Bluetooth to send .apk intent.setPackage("com.android.bluetooth"); // Append file and send Intent intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(filePath))); startActivity(Intent.createChooser(intent, "Share app")); 
+15
source share

All Articles