0

Can I from my application force android to reconnect to cellular network immediately? If yes how to do this?

Krzysztof
  • 1,861
  • 4
  • 22
  • 33

1 Answers1

0

Apparently the functionality as of Android 5 has been moved to system apps only. How to enable mobile data on/off programmatically

But you can still register a listener for network changes. https://developer.android.com/training/basics/network-ops/reading-network-state

When you get the onLost() event you can start a Wireless Setting Activity so the user can do it manually.

        //As seen in the link above.
        Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
        startActivity(intent);

This will be a common occurrence so get use to it. For example you can createBond() for a Bluetooth device, but you can't removeBond() anymore. Thus you have to send the user to the Bluetooth setting activity for the user to "forget" about the device.

avalerio
  • 2,072
  • 1
  • 12
  • 11