0

I have an app that does a check if data services is turned on and if it is not turned let display and alert dialog demanding the user to turn the app on clicking ok. This is my code that is supposed to show the settings of the android phone

final  Intent intent=new Intent(Settings.ACTION_DATA_ROAMING_SETTINGS);
                          intent.addCategory(Intent.CATEGORY_LAUNCHER);
                           final ComponentName cn = new ComponentName("com.android.phone","com.android.phone.Settings");
                          intent.setComponent(cn);
                          intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                          startActivity(intent);

The above code does not display the option to turn on the wifi of the user

Please why the wifi data not turned on, on clicking the button

Blaze
  • 2,269
  • 11
  • 40
  • 82

1 Answers1

0

To enable the option to allow the user to turn on data services such wifi and others.

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);

Just call the generic Settings screen (ACTION_SETTINGS)

Reference link http://developer.android.com/reference/android/provider/Settings.html

That will do the trick

Blaze
  • 2,269
  • 11
  • 40
  • 82