Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using a custom APN for a connection

Tags:

android

apn

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?

like image 708
Frxstrem Avatar asked Nov 14 '22 18:11

Frxstrem


1 Answers

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.

like image 118
EdoDodo Avatar answered Jan 02 '23 14:01

EdoDodo