Pregunta

The issue is that I need to install an apk(non market app) and for this, the user need to activate the unknown source setting, so i send him (if he didn't have it activated) to the settings so he can turn on the option, the issue is that i tested it in different phones and in samsung that option is on applications while in htcs phones is on security. i want send the user to that option but i don't know how to do it

I read about this and no one knows exactly how to do it

this is my code

    int canInstallFromOtherSources = Settings.Secure.getInt(ctx2,Settings.Secure.INSTALL_NON_MARKET_APPS);
    if(canInstallFromOtherSources == 0)
    {
        Intent intentSettings = new Intent();                         
        intentSettings.setAction(android.provider.Settings.ACTION_APPLICATION_SETTINGS);       
        startActivity(intentSettings);              
    }
¿Fue útil?

Solución

You can do it with the following line (changing to the corresponding action):

startActivityForResult(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS), REQUEST_CODE_ENABLE_LOCATION_PROVIDERS);

Check Android Settings documentation.

I think you should use ACTION_SECURITY_SETTINGS and one of ACTION_APPLICATION_SETTINGS or ACTION_APPLICATION_DEVELOPMENT_SETTINGS.

And here (line 304), you've got a working example of one of my apps: Tureame

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top