Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Is it possible to toggle the Unknown Source setting with Tasker? I couldn't find such a setting. I also tried the Secure Settings Plugin there is also no action for this.

What I want to achieve is to set this setting on when I start the Amazon AppStore and switch it off when I close it again.

Samsung Galaxy Note, Android 4.1.2 Jelly Bean

share|improve this question

3 Answers 3

up vote 2 down vote accepted

This can't be done in a totally automated fashion, as indicated by the accepted answer to this StackOverflow question. Basically, it's against the Android security model to allow Unknown Sources to be changed programmatically.

share|improve this answer

I think AutoShortcut can do the trick:

AutoShortcut is a plugin for Tasker or Locale that allows you to run any of your installed apps' shortcuts.

share|improve this answer
    
Wouldn't you need a shortcut to toggle Unknown Sources for that to work? I'm not aware of any such thing. –  Trebor Rude Apr 24 '13 at 12:43

The device seems rooted because Secure Settings is mentioned. I have v1.3.6 installed and it does allow toggling "Unknown sources".

All you have to do in Tasker is:

  1. Create App context profile and choose Amazon Appstore or your favorite app.
  2. To enable Unknown sources when Appstore is launched:

    • Create a task with action as Plugin → Secure Settings:

      • Under Configuration, go to System+ Actions →Unknown Sources → On, and save it.
    • Alternatively, if Secure Settings still doesn't have such option then create an action as Code → Run Shell, and type:

      • Command: settings put global install_non_market_apps 1
      • Check Use Root

      Explanation:

      • settings would update settings.db database file (part of com.android.providers.settings).
      • global is the table which holds the key (install_non_market_apps) responsible for toggling Unknown Sources.
  3. To disable Unknown sources when Appstore is closed:

    More or less, once the Appstore is closed you'll come back to home screen (default Launcher). In that case:

    1. Create App context profile and choose your default launcher.
    2. Create a task with action as Plugin → Secure Settings:

      • Under Configuration, go to System+ Actions →Unknown Sources → Off, and save it.

      Or, alternatively, create an action as Code → Run Shell, and type:

      • Command: settings put global install_non_market_apps 0
      • Check Use Root

Your objective is now completed! Launch your Appstore and Unknown sources would get enabled. Come back to Launcher and Unknown sources would get disabled.

share|improve this answer
    
Ahh, forgot to mention that my solution is tested on Android 4.2.1 JB. –  Firelord 16 hours ago

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.