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 8477797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:33:53+00:00 2026-06-10T18:33:53+00:00

I have a bunch of Android devices which are to be flashed with custom

  • 0

I have a bunch of Android devices which are to be flashed with custom ROMs and given out to clients. As part of that ROM will be a ‘support’ app, which is tied to the device. It can’t be published to Google Play. I need to be able to offer users the opportunity to download and install updated versions of the software. I have checking, download and install code already implemented however it relies on the devices being configured to enable installation of apps from unknown sources. I need the device to be able to download and install this particular apk, whilst still not allowing any other apps from unknown sources to be installed.

Is this possible?

(edit: to clarify how the chosen answer finally worked)

The code added to the activity was this:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory() +"/update.apk")), "application/vnd.android.package-archive");
intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
intent.putExtra(Intent.EXTRA_ALLOW_REPLACE, true);

startActivityForResult(intent, 0);

To the android manifest, the following code was added:

<uses-permission android:name="android.permission.INSTALL_PACKAGES" />

After installing the app, I used a root file explorer to move the apk from /user/apps to /system/apps then after resetting the phone the app was able to install itself, over the top of itself, without being prompted for the user to enable untrusted sources. The install prompt, listing the permissions the app requires and giving the user the choice to install or not still appears, but that is fine.

  • 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-10T18:33:54+00:00Added an answer on June 10, 2026 at 6:33 pm

    This method only works for system apps (source)

    Try installing the apk by adding and extra field.

    intent.putExtra(Intent.EXTRA_NOT_UNKNOWN_SOURCE, true);
    

    Have never tried this. The doc says you need to call startActivityforResult for this to work. But this requires API level 14. Also try

    intent.putExtra(Intent.EXTRA_ALLOW_REPLACE, true);
    

    Edit:
    On second thought, if you have custom ROM, then add shareduserid system to your installer app and directly call
    whatever PackageInstallerActivity is calling to install the app

    Edit2:

    Check this code. OnClick is used to install app, so copy the whole code to your app and add

    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
    

    permission.

    And to App’s Android.mk add

     LOCAL_CERTIFICATE := platform
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an android app, which is basically an exam simulator, it will come
i have a bunch of actions that need to be executed in an android
I have an Android app that I'm distributing as a bunch of individual apps,
I have a bunch of gpx files that come from GPSLogger for Android app.
I have a bunch of EditTexts in my Android application, each with InputMethod set
I have bunch of strings, some of which are fairly long, like so: movie.titles
I have bunch of lists like this: out[3] [[3]] [1] forum=28&mid=11883 [2] forum=29&mid=11884 out[4]
We have bunch of Domain Entities which should be rendered to an html format,
I have a bunch of files in a folder checked out from a repository.
I have a bunch of html files that come with my app and are

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.