I am developing an application where I need to make a connection to a server which is only accessible through a special APN. Therefore, I want to know, is it possible to specify an APN to use for a single connection (or application) only, and use that, possibly even if wifi is active?
Firstly, your application will probably need the WRITE_APN_SETTINGS permission in order to be able to make APN changes. You can bring up a UI interface to have the user configure the APN with this code:
Intent intent = new Intent(Settings.ACTION_APN_SETTINGS);
startActivity(intent);
Changing the settings programatically, on the other hand, is a bit more difficult. I recommend you take a look at the answers to this similar question for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With