اشتراک گذاری یا Share کردن متن و عکس همزمان
سلام عزیزان.
تو برنامهم یک دکمه گذاشتم واسه اشتراک گذاری برنامه ، میخوام که با کلیک کردن روش لیستی از برنامه هایی که این امکان را دارن بیان بالا و برنامه مورد نظرتو که انتخاب کردی لینک دانلود یا صفحه دانلود برنامه و همراه با چند کلمه توضیحات واسه طرف ارسال بشه، مشابهش که فراوانه ، اما تو انجمن که گشتم اصلا پیدا نکردم و فقط ارسال فایل APK را دیدم ، اما من ارسال لینک رو میخوام،
با تشکر از دوستان...
دوستان من روش ارسال لینک دادن رو پیدا کردم
اما چطوری میتونم توی دوخط متنم رو ارسال کنم؟ سطر اول توضیحات و سطر دوم لینک؟
public void shareData() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
String my_string = "https://cafebazaar.ir/app/ir.amingames.ball.escape";
intent.putExtra(Intent.EXTRA_TEXT, my_string);
startActivity(intent);
}
دوستان لطفا راهنمایی کنید؟
کد :
String my_string ="line1 \n https://cafebazaar.ir/app/ir.amingames.ball.escape";
البته می تونی بجای لینک از طریق زیر خود برنامه رو ارسال کنی:
public static void sendAppItself(Activity paramActivity, String paramStringToastMsg) throws IOException {
Toast.makeText(paramActivity, paramStringToastMsg, Toast.LENGTH_LONG).show();
PackageManager pm = paramActivity.getPackageManager();
ApplicationInfo appInfo;
try {
appInfo = pm.getApplicationInfo(paramActivity.getPackageName(),
PackageManager.GET_META_DATA);
Intent sendBt = new Intent(Intent.ACTION_SEND);
// NOT THIS! sendBt.setType("application/vnd.android.package-archive");
sendBt.setType("*/*");
sendBt.putExtra(Intent.EXTRA_STREAM,
Uri.parse("file://" + appInfo.publicSourceDir));
// Log.v("PACKAGEDIR: ", appInfo.publicSourceDir);
paramActivity.startActivity(Intent.createChooser(sendBt, "ارسال برنامه با ..."));
// paramActivity.startActivity(sendBt);
}
catch (NameNotFoundException e1) {
e1.printStackTrace();
}
}
حالا همینطور که میشه خود برنامه رو ارسال کرد؟ آیا میشه آیکون برنامه رو هم ارسال کرد؟
من روش ارسال کردن متن و عکس رو یاد گرفتم
برای متن:
public void shareData() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
String my_string = "line1 \n line2 \n https://cafebazaar.ir/app/ir.amingames.ball.escape";
intent.putExtra(Intent.EXTRA_TEXT, my_string);
startActivity(intent);
}
برای عکس:
public void shareDataPic() {
File file = new File(Environment.getExternalStorageDirectory().toString() + "/AminGames/PicTest.jpg");
Uri outputFileUri = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_SEND);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setType("image/jpeg");
intent.putExtra(Intent.EXTRA_STREAM, outputFileUri);
startActivity(intent);
}
کد عکس که یه عکس از تو حافظه میگیره و میفرسته، حالا آیا چطوری میتونیم آیکون برنامه رو بگیریم؟
این یه سوال و بعد آیا اینکه میشه هم عکس و هم نوشته رو با هم ادغام کردو ارسال کرد؟
پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .