Search code examples
androidconfigurationapn

Current used APN?


I added two APN configurations and then scanned the APN database. I noticed that both APN entries are marked as "current=1".

how can I identify the currently active APN configuration programmatically?

thanks!


Solution

  • you probably are using:

    Cursor c = context.getContentResolver().query(Uri.parse("content://telephony/carriers/current"), null, null, null, null);
    

    This URI returns the entire list of APN. To return only selected APN use:

    Cursor c = context.getContentResolver().query(Uri.parse("content://telephony/carriers/preferapn"), null, null, null, null);