0
我在某些应用程序中看到了这一点,当我通过它发送应用程序时显示了一些选项,例如蓝牙,当我选择蓝牙时,它会将应用程序发送到其他设备。android - 如何通过蓝牙传输应用程序
它发送apk文件,以便其他用户能够安装它。我怎么能做出这样的事情?它如何发送apk文件?
我在某些应用程序中看到了这一点,当我通过它发送应用程序时显示了一些选项,例如蓝牙,当我选择蓝牙时,它会将应用程序发送到其他设备。android - 如何通过蓝牙传输应用程序
它发送apk文件,以便其他用户能够安装它。我怎么能做出这样的事情?它如何发送apk文件?
我希望这将帮助:
// 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's 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"));
你想知道如何通过蓝牙或如何发送APK发送数据? – prince
@王子,我想知道如何发送apk文件 –
所以你知道如何通过蓝牙发送文件? – prince