2010-10-22 20 views
4

我添加了兩個APN配置,然後掃描了APN數據庫。 我注意到兩個APN條目都被標記爲「當前= 1」。當前使用的APN?

如何以編程方式識別當前活動的APN配置?

謝謝!

回答

6

你可能正在使用:

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

這個URI返回APN的完整列表。僅返回選定的APN使用:

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

太好了,謝謝! – 2red13 2011-11-23 12:41:07