Forum Xamarin.Android

Remove pdf file cache

FotalFotal Member ✭✭✭

I have an URL with which I open the pdf file. The address does not change, but the pdf file can change. When the pdf file changes notification comes to the user opens the file again at the same URL, but the old file is opened. When I delete the application cache and reload this file, everything is fine. How can I remove this caching from creating URI or Intent or something else?

public void OpenPdfByUrl(string url)
        {
            if (string.IsNullOrEmpty(url))
            {
                return;
            }

            url = url.Replace(" ", "%20");
            var uri = Android.Net.Uri.Parse(url);
            var browserIntent = new Intent(Intent.ActionView, uri);

            try
            {
                context.StartActivity(browserIntent);
            }
            catch (ActivityNotFoundException e)
            {
                Console.WriteLine(e);
                Toast.MakeText(context, "Install pdf reader", ToastLength.Short);
            }

        }
Tagged:

Answers

  • FotalFotal Member ✭✭✭

    Fuck, when i click to open pdf my install pdf reader open it (google drive). And it store the old version of pdf file, until about 10 minutes pass. I can clear the cache of documents in Google Drive, sometimes it works, sometimes not. How can I be sure that the application will not save itself an old pdf file in the cache?

Sign In or Register to comment.