This list of APNs is stored in the shared content in the system and requires a ContentResolver to be used to access the data. The Uri to be used to access the APNs is “content://telephony/carriers/“. The columns available in the table are:
- _id
- name
- numeric
- mcc
- mnc
- apn
- user
- server
- password
- proxy
- port
- mmsproxy
- mmsport
- mmsprotocol – optional, not available in all phones/ROMs
- mmsc
- type
- current
- insert_by
For example, to retrieve a list of names of all APNs in code:
Uri contentUri = Uri.parse(“content://telephony/carriers/”);
Cursor cursor = null;
try
{
cursor = context.getContentResolver().query(contentUri, new String[]{“name”}, null, null, null);
if (cursor != null)
{
while (cursor.moveToNext())
{
String name = cursor.getString(0);
//do something with name
}
}
}
catch (Exception ex)
{
//Handle exceptions here
}
finally
{
if (cursor != null) cursor.close();
}














Comments