Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8579641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:39:07+00:00 2026-06-11T20:39:07+00:00

I have problems installing an APK saved in Android internal Cache. There are no

  • 0

I have problems installing an APK saved in Android internal Cache.
There are no issues saving the file in External Storage or on External Cache using context.getExternalCacheDir().

But if I try to use context.getCacheDir(), the log returns

/data/data/com.my.package/cache/update.apk: open failed: EACCES (Permission denied)

                File file = context.getCacheDir();

                File outputFile = new File(file, "update.apk");
                if(outputFile.exists()){
                    outputFile.delete();
                }

                FileOutputStream fos = new FileOutputStream(outputFile);


                InputStream is = c.getInputStream();

                byte[] buffer = new byte[1024];
                int len1 = 0;
                while ((len1 = is.read(buffer)) != -1) {
                    fos.write(buffer, 0, len1);
                }
                fos.close();
                is.close();

                Intent intent = new Intent(Intent.ACTION_VIEW);

                //SAVE IN CACHE
                intent.setDataAndType(Uri.fromFile(outputFile), "application/vnd.android.package-archive");

                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // without this flag android returned a intent error!
                context.startActivity(intent);

It looks like internal cache doesn’t allow the APK to be correctly read.

The fact is, if the file is saved on the External Storage or external Cache the APK will be available to the user, and I don’t want that.

What can it be don to save the file in internal Cache?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:39:09+00:00Added an answer on June 11, 2026 at 8:39 pm

    It looks like internal cache doesn’t allow the APK to be correctly read.

    That is because the installer app has no rights to read your file.

    The fact is, if the file is saved on the External Storage or external Cache the APK will be available to the user, and I don’t want that.

    Then do not install it on the user’s device. Any user can copy any APK off their device at any time after installation, so the only way to prevent the user from accessing the APK is to not have it on the device in the first place.

    What can it be don to save the file in internal Cache?

    Probably nothing. If you switch to openFileOutput(), you can see if MODE_WORLD_READABLE will be sufficient for the installer to proceed. Again, this will not stop the user from being able to access the APK file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

all, I have some problem installing my apk file in code. Wondering if anyone
I have two problems with android SDK.The first is that after installing sdk manager
I have problems dealing with ProGuard and Android. I searched on the web for
I have problems trying to load png file into my application. It seems to
after months of tweaking my vimrc file and installing plugins, I have this little
Does any one is having problems installing QT creator in snow leopard? I have
I have been having problems installing VB6 on Windows 7. I realize it is
Good Morning, I have problems installing ruby with rvm on an Amazon EC2 instance.
I just wanted to install the bundler gem. I have no problems installing it.
I have problems installing PHPUnit 3.4.6 via PEAR 1.9.0 . After I discover channel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.