import phonenumbers
from phonenumbers import geocoder
from geopy.geocoders import Nominatim
def track_android_phone_location(phone_number):
# Parse the phone number
parsed_number = phonenumbers.parse(phone_number, "US")
# Check if the phone number is valid and belongs to an Android device
if phonenumbers.is_valid_number(parsed_number) and
phonenumbers.carrier.name_for_number(parsed_number, "en") == "Android":
# Get the latitude and longitude coordinates
latitude = parsed_number.latitude
longitude = parsed_number.longitude
# Reverse geocode the coordinates to get the location
geolocator = Nominatim(user_agent="android_phone_tracker")
location = geolocator.reverse(f"{latitude}, {longitude}")
# Print the location information
print(f"Location: {location.address}")
else:
print("Invalid phone number or not an Android device.")
# Example usage
android_phone_number = "5714217839" # Replace with the actual Android phone
number
track_android_phone_location(android_phone_number)