i wish to find out the functionality for checking the default APN... i.e active APN on a handset .
Asked
Active
Viewed 5,128 times
2 Answers
1
To return only selected APN use:
Cursor c = context.getContentResolver().query(Uri.parse("content://telephony/carriers/preferapn"), null, null, null, null);
To return the entire list of APN use:
Cursor c = context.getContentResolver().query(Uri.parse("content://telephony/carriers/current"), null, null, null, null);

Paulo Henrique Nonaka
- 794
- 7
- 13
-
Then i try to query this content provider it returns this error `java.lang.SecurityException: No permission to write APN settings: Neither user 10928 nor current process has android.permission.WRITE_APN_SETTINGS.` – Etienne Lawlor Feb 16 '14 at 17:39
-1
This seems to work:
http://osdir.com/ml/AndroidDevelopers/2009-05/msg03754.html
At least, it worked on my rooted G1 (T-Mobile US) and in the emulator (TelKila).