I am trying to develop an app in which I need to connect to a specific APN programatically for network testing purposes.
As a user, I can do this by going to "Settings" -> "Wireless & networks" -> "Mobile Networks" (long press) -> "Access Point Names". It will even let me add a new one manually.
I want to know, is there a way an app can do that automatically? I have root permissions and everything you might need.
If anyone knows the android source, can you point me on where to look to study the behavior of this screen? I've tried to take a dive there but I'm kinda lost.
Best answer: APN is short of Access Point Name and provides a phone with the information needed to connect to wireless service. It can be changed by adding a new APN profile with information from the carrier in the phone's settings.
What Is an APN Setting? APN settings can be modified on your smartphone (both Android and iPhone). Changing these lets your phone interface with a network provider.
The XML Configuration Access Protocol (XCAP) is a protocol, that allows a user to read, write, and modify application configuration data stored in XML format on a server and unlocks devices.
I'm answering my own question in addition to what was pointed by 7383. Hope this helps someone.
Similar to ApnEditor, I was actually looking for ApnSettings (link to cyanogen). I supposed this screen was provided by android and didn't suspect that "Settings" was actually an app.
The apps can't be used with an IDE as we usually do, it should be either compiled with makefiles like android or edit it's source so it's "ide-compatible" as suggested here
Now, to add or edit APNs you can't just put that code in any app. You need android.permission.WRITE_APN_SETTINGS
which is a permission only available to system apps. The app won't be portable, but it appears this can be done using a rooted phone or a custom rom. More info here and here
I hope you are looking for this. The following links are from Android settings app source code.
add new apn
Set as default
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