1

I am trying to open the Network Operator Settings view with the following code:

startActivity(new Intent(android.provider.Settings.ACTION_NETWORK_OPERATOR_SETTINGS));

It works correctly on all the devices I could test, but on one of them (Alcatel One Touch Pixi, with Android 5.1) the Network Operator Settings view opens and automatically closes after that. I tried to see if the resolveActivity with the packageManager of that Intent returns null, but it does not, it opens the activity of network operator settings and then (for some reason) it automatically finishes.

Anyone can help me to fix this issue that only happens with some specific mobiles?

user3429953
  • 352
  • 3
  • 19

3 Answers3

0

You cannot fix the issue. The other app has a bug. Only its developers can fix the bug.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Then do you recommend me some workaround like detecting if it returns in a small period of milliseconds to my app, launch instead the general settings intent? Or do you think its an super-isolated case and does not need to apply this workaround? – user3429953 Oct 09 '17 at 12:09
  • @user3429953: That's your decision to make -- I cannot make it for you. I worry that the "detecting if it returns..." code may prove unreliable (e.g., multi-window environments). – CommonsWare Oct 09 '17 at 12:24
  • True, thanks. I will apply the solution from W0rmH0le since its a very good approximation to what I wanted – user3429953 Oct 09 '17 at 14:11
0

wireless settings

startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)); 

Network Operator Settings

startActivity(new Intent(Settings.ACTION_NETWORK_OPERATOR_SETTINGS));
Akshay Chopde
  • 670
  • 4
  • 10
0

There's an alternative way to call the Network Settings menu:

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.phone", "com.android.phone.MobileNetworkSettings"));
startActivity(intent);

This method works with Samsung devices but not sure about devices that you mentioned (since I'm specifying the name of the package and the activity class name).

I think you can try and if works, you may add the proper conditions to use this code etc.

guipivoto
  • 18,327
  • 9
  • 60
  • 75
  • Thanks!! That is the more approximate view to the Network Operator Settings, and it works very well on (at least) all my testing devices. – user3429953 Oct 09 '17 at 14:10