DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Mobile Location Information

  • submit to reddit
import location
mcc, mnc, lac, cellid = location.gsm_location()
# lac, cellid can be used to guess your location

mcc = Mobile Country Code
mnc = Mobile Network Code
lac = Location Area Code
cellid = Cell Id

mcc and mnc is the same wherever you are.
Normally, you would collect some data of your location
and match it with lac/cellid. Then later you can guess
your location from current lac/cellid.