ORr-Acle
ORr-Acle

Reputation: 1

Is there a way to check if 'Unknown Sources' is enabled in Android via my website before I serve the APK from my CDN?

I am building an APK website similar to APKPure.com. The APKs will be served from my CDN. Is there a way to check if the device downloading the APK has 'Unknown Sources' enabled? Are there better methods to do this? I'd like to minimize friction from website visit to install.

Thanks.

Upvotes: 0

Views: 1430

Answers (1)

techfly
techfly

Reputation: 1866

Through your browser, you can't. If you access your website through an Android app, you can do the following:

  1. Check if device has unknown sources enabled:

boolean isNonPlayAppAllowed = Settings.Secure.getInt(getContentResolver(), Settings.Secure.INSTALL_NON_MARKET_APPS) == 1; (Source: https://stackoverflow.com/a/16675266/3673616)

  1. Send the boolean as a get parameter. For example: http://yoursite.com/somefile.apk/?unknown=true
  2. Depending on your parameter, decide what the server is going to do.

This is the only way I can think of - however, it is definitely not possible simply through the browser.

Upvotes: 1

Related Questions