Android - Mobile network settings menu (Jelly Bean)
Asked Answered
B

2

8

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 : )

Bluegreen answered 2/7, 2012 at 9:56 Comment(1)
try after adding FLAG_ACTIVITY_NEW_TASK flagIndignant
P
5

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);
Pazice answered 2/7, 2012 at 10:1 Comment(2)
if this not work then easy way attach your device to debugger and launch ACTION_DATA_ROAMING_SETTINGS setting manually then see in log for package name and Activity Name launched by systemIndignant
check activity name in log sonething like com.android.phone/.Settings ??Indignant
D
0

The code below is much more simple and tested on Gingerbread (2.3.7) and JB (4.1.2)

    startActivityForResult(new Intent(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS), 0);
Dorren answered 13/4, 2013 at 9:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.