1

i wish to find out the functionality for checking the default APN... i.e active APN on a handset .

Francescu
  • 16,974
  • 6
  • 49
  • 60
Gaurav Gupta
  • 41
  • 3
  • 5

2 Answers2

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);
  • 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).