共享(如WattsApp)来自URL的PDF文件

时间:2019-04-09 15:20:21

标签: android android-intent

我尝试过了。直接将URL传递到EXTRA_STREAM,但不起作用。

        pdflink="https://www.myserver.com/products/09-04-2019/product-1554810211-51751.pdf";

        PackageManager packageManager =getPackageManager();

        Intent sendIntent = new Intent("android.intent.action.MAIN");



        sendIntent.putExtra(Intent.EXTRA_TEXT, message);
        sendIntent.putExtra(android.content.Intent.EXTRA_STREAM, pdflink);
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.setPackage("com.whatsapp");
        sendIntent.setType("application/pdf");
        context.startActivity(sendIntent);

0 个答案:

没有答案