View Full Version : ارسال برنامه نصب شده از طریق بلوتوث
javadi3d
جمعه 22 فروردین 1393, 11:14 صبح
سلام
سرچ کردم ولی پیدا نکردم!
میخواستم تو برنامه ام یک button بزارم که وقتی کلیک شد برنامه را از طریق بلوتوث ارسال کنه،باید چی بنویسم؟
همین!
darkenerboy
جمعه 22 فروردین 1393, 12:26 عصر
این هم کد
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(getPackageName(), 0);
File srcFile = new File(ai.publicSourceDir);
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND);
share.setType("application/vnd.android.package-archive");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(srcFile));
startActivity(Intent.createChooser(share, "MyApp"));
} catch (Exception e) {
Log.e("ShareApp", e.getMessage());
}
کپی، پیست کن ! :افسرده:
javadi3d
جمعه 22 فروردین 1393, 12:38 عصر
این هم کد
try {
PackageManager pm = getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(getPackageName(), 0);
File srcFile = new File(ai.publicSourceDir);
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND);
share.setType("application/vnd.android.package-archive");
share.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(srcFile));
startActivity(Intent.createChooser(share, "MyApp"));
} catch (Exception e) {
Log.e("ShareApp", e.getMessage());
}
کپی، پیست کن ! :افسرده:
کارت درسته
به قول بچه هاthats right!!!!
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.