Android programming to open Data Usage setting pag

2020-04-21 02:13发布

In Android 5.0 Mobile Data setting is available in Data Usage setting.
I want to open Data Usage setting page in android, but i do not find any Intent to open it. is there any why to open Data Usage setting page

2条回答
不美不萌又怎样
2楼-- · 2020-04-21 02:22

try using this

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

or this

Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.provider.Settings.ACTION_DATA_ROAMING_SETTINGS);
startActivity(intent);
查看更多
老娘就宠你
3楼-- · 2020-04-21 02:42

Have you tried this way?

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

Maybe in this way:

startActivityForResult(new Intent(android.provider.Settings.ACTION_NETWORK_OPERATOR_SETTINGS), 0);
查看更多
登录 后发表回答