How can I get active apn name?

by mbaroukh » Sat, 09 May 2009 01:30:28 GMT


Sponsored Links
 yes.

I need to do this to retrieve current apn proxy.
Her is how I did it :

Cursor mCursor = getContentResolver().query(Uri.parse("content://
telephony/carriers"), new String[] {"name"}, "current=1", null, null);
                                if (mCursor!=null) {
                                        try {
                                        if (mCursor.moveToFirst()) {
                                            String name = mCursor.getString(0);
                                            .. do what ever you wan't with it 
...
                                            }
                                        }
                                        } finally {
                                                mCursor.close();
                                        }
                                }

So, as you see, it's where clause "current=1" that select the current
apn.
Fields you can retrieve can be found in
com.android.providers.telephony.TelephonyProvider :

db.execSQL("CREATE TABLE " + CARRIERS_TABLE +
                "(_id INTEGER PRIMARY KEY," +
                    "name TEXT," +
                    "numeric TEXT," +
                    "mcc TEXT," +
                    "mnc TEXT," +
                    "apn TEXT," +
                    "user TEXT," +
                    "server TEXT," +
                    "password TEXT," +
                    "proxy TEXT," +
                    "port TEXT," +
                    "mmsproxy TEXT," +
                    "mmsport TEXT," +
                    "mmsc TEXT," +
                    "type TEXT," +
                    "current INTEGER);");





--~--~---------~--~----~------------~-------~--~----~



How can I get active apn name?

by biAji » Tue, 12 May 2009 16:16:45 GMT


 Thanks a lot !!

That's exactly what I want to know .  You are so great!




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Avoid non-static inner classes in an activity?

While my inner classes could be wrong, I have a bigger suspect.

It seems one of my custom views has a background thread that waits for
work requests and communicates back through a handler. When the
activity ends and restarts, the thread is still alive, waiting for a
work request. Since that thread references a Handler, which references
a View which has a context, so the activity stays alive even as a new
one is created.

I believe what I should do is in MyActvity.OnDestroy, propagate the
message down the chain such that the worker thread exists gracefully.

I suppose I should also make it a daemon thread - since it is one, but
that will only help when the process exits and not when there are
other activities or services running.

Nathan




-- 

2. what is problem with my library project

Hi all,

I have created a library project. When I use the library project in
other project, it compiles. How ever, when I run the application, it
always get the error "The application has stopped unexpectly.".

Have anyone has the same experinece?

Thanks!

Cindy

-- 

3. Accessibility program

4. Motorola Devou

5. Debug Keystore Password Wrong? HELP!!!

6. GpsStatusListener: no satellites used in fix although status is GpsStatus.GPS_EVENT_FIRST_FIX

7. Uploading files on servlet