मैं ज़ैमरिन एंड्रॉइड का उपयोग करता हूं। मेरे पास X12arin एंड्रॉइड से संपत्ति फ़ोल्डर में संग्रहीत एक पीडीएफ फ़ाइल है।एक्समरिन एंड्रॉइड: संपत्ति फ़ोल्डर से पीडीएफ फाइल कैसे साझा करें? व्हाट्सएप के माध्यम से मुझे संदेश मिलता है कि आपके द्वारा चुनी गई फ़ाइल दस्तावेज़ नहीं थी
मैं WhatsApp में इस फ़ाइल को साझा करना चाहते हैं, लेकिन मैं संदेश प्राप्त होता है:
फ़ाइल आपके द्वारा चुने गए एक दस्तावेज नहीं था।
मैं दो तरीकों की कोशिश की:
यह पहला रास्ता
var SendButton = FindViewById<Button>(Resource.Id.SendButton);
SendButton.Click += (s, e) =>
{
////Create a new file in the exteranl storage and copy the file from assets folder to external storage folder
Java.IO.File dstFile = new Java.IO.File(Environment.ExternalStorageDirectory.Path + "/my-pdf-File--2017.pdf");
dstFile.CreateNewFile();
var inputStream = new FileInputStream(Assets.OpenFd("my-pdf-File--2017.pdf").FileDescriptor);
var outputStream = new FileOutputStream(dstFile);
CopyFile(inputStream, outputStream);
//to let system scan the audio file and detect it
Intent intent = new Intent(Intent.ActionMediaScannerScanFile);
intent.SetData(Uri.FromFile(dstFile));
this.SendBroadcast(intent);
//share the Uri of the file
var sharingIntent = new Intent();
sharingIntent.SetAction(Intent.ActionSend);
sharingIntent.PutExtra(Intent.ExtraStream, Uri.FromFile(dstFile));
sharingIntent.SetType("application/pdf");
this.StartActivity(Intent.CreateChooser(sharingIntent, "@string/QuotationShare"));
};
यह दूसरा
//Other way
var SendButton2 = FindViewById<Button>(Resource.Id.SendButton2);
SendButton2.Click += (s, e) =>
{
Intent intent = new Intent(Intent.ActionSend);
intent.SetType("application/pdf");
Uri uri = Uri.Parse(Environment.ExternalStorageDirectory.Path + "/my-pdf-File--2017.pdf");
intent.PutExtra(Intent.ExtraStream, uri);
try
{
StartActivity(Intent.CreateChooser(intent, "Share PDF file"));
}
catch (System.Exception ex)
{
Toast.MakeText(this, "Error: Cannot open or share created PDF report. " + ex.Message, ToastLength.Short).Show();
}
};
है
अन्य तरह से, जब मैं ईमेल के माध्यम से साझा करते हैं, पीडीएफ फाइल खाली (भ्रष्ट फ़ाइल)
मैं क्या कर सकता भेज दिया जाता है?
मैं, ऐसा उदाहरण या कुछ और की जरूरत नहीं है जब तक यह करने के लिए है मेरे विशेष मामले को हल करें। – JotaPardo