這爲我工作:
public void shareApk(Context context) {
try {
PackageManager pm = context.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), 0);//context.getPackageName() is used for send my app's apk, you can give package name which you want to share
File srcFile = new File(ai.sourceDir);
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND);
share.setType("application/vnd.android.package-archive");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(srcFile));
share.setPackage("com.android.bluetooth");
context.startActivity(share);
//context.startActivity(Intent.createChooser(share, context.getString(R.string.share_using)));
} catch (Exception e) {
Log.e("ShareApp", e.getMessage());
}
}
那麼關於Android開發的網頁? https://developer.android.com/training/beam-files/send-files.html – Piwo
不幸的是我不能使用梁/ nfc –