Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Mobile network settings menu (Jelly Bean)

following code is not working for Jelly Bean (Android 4.1):

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

Instead to start setting , it doesn´t nothing, any idea how to solve it?

Here is solution:

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

Thank you guys : )

like image 431
Michalsx Avatar asked Jul 02 '12 09:07

Michalsx


1 Answers

try as:

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);
like image 139
ρяσѕρєя K Avatar answered Nov 14 '22 11:11

ρяσѕρєя K