تابستون داره تموم میشه ها، فرصت‌ها محدودن کلی آفر جذاب در کمپین تابستون🔥👇
۰ ثانیه
۰ دقیقه
۰ ساعت
۱ پوریا شفیعی
(آموزشی)share کردن فایل APK اپلیکیشن
جامعه جاوا (اندروید) ایجاد شده در ۰۸ آبان ۱۳۹۹

با استفاده از متد زیر میتونید فایل apk اپلیکیشنتون رو share کنید :

public static boolean shareApp(Context context, String packageName, String title) {
    try {
        StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
        StrictMode.setVmPolicy(builder.build());
        PackageManager pm = context.getPackageManager();
        ApplicationInfo ai = pm.getApplicationInfo(packageName, 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));
        context.startActivity(Intent.createChooser(share, title));
        return true;
    } catch (Exception e) {
        return false;
    }
}

 

درود پوریان جان

 

این کار کجا بدرد میخوره و نحوه پیاده سازیش درون بدنه برنامه چگونه هست؟

پژمان آزاد ۲۳ بهمن ۱۳۹۹، ۱۰:۱۶