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