Saturday, June 01, 2013

Android Tip: Programmatically Displaying the Settings Page

Many a times, you need to programmatically redirect the user to the Settings page so that they can turn on certain features on the device before your application can work correctly For example, if your app uses Bluetooth and the Bluetooth radio is not turned on, you may want to programmatically display the Bluetooth settings page so that the user can turn it on.


To display the Settings page programmatically, you can use the startActivity() method together with an Intent object. The following shows some examples:

    //---display the main Settings page---
        new Intent(Settings.ACTION_SETTINGS));
    //---display the Location access settings page---
    startActivity(new Intent(
    //---display the Wireless & networks settings page---
    startActivity(new Intent(
    //---display the Bluetooth settings page---
    startActivity(new Intent(
        In general, you use the predefined constant Settings.ACTION__SETTINGS. The full list can be found here:

No comments: