On 27 juil, 23:27, junker37 <[email protected]> wrote:
> Is there a way to determine which carrier the phone is using.  T-
> Mobile, Spring, AT&T, etc?

You have to extend PhoneStateListener. I don't know if there's a
better way, but it works:

private class DummyPhoneStateListener extends PhoneStateListener
{
        public void onServiceStateChanged(ServiceState serviceState)
        {
                // look here 
http://developer.android.com/intl/fr/reference/android/telephony/ServiceState.html
                String operatorAlphaLong = serviceState.getOperatorAlphaLong();
                String operatorAlphaShort = 
serviceState.getOperatorAlphaShort();
        }
}


And then in onCreate():

DummyPhoneStateListener myDummyPhoneStateListener = new
DummyPhoneStateListener();
TelephonyManager manager=(TelephonyManager) this.getSystemService
(Context.TELEPHONY_SERVICE);
manager.listen
(myDummyPhoneStateListener,PhoneStateListener.LISTEN_SERVICE_STATE);

Hope that will help you.

Stephane

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to