How do Unlocked Phones Work?

Unlocked phones allow the consumer to use the phone in other networks and not just the one it originally was designed for. For example, an unlocked iPhone can be used on the T-Mobile network as well and not just AT&T.;