Untitled

 avatar
unknown
plain_text
2 years ago
1.4 kB
4
Indexable
#!/usr/bin/env python3

import sys

def set_gps_location(latitude, longitude):
    subprocess.run(['settings', 'put', 'secure', 'location_providers_allowed', 'gps'])
    subprocess.run(['am', 'start', '-a', 'android.intent.action.VIEW', '-d', f'geo:{latitude},{longitude}'])

def main():
    if len(sys.argv) != 3:
        print("Usage: python gps_simulator_bluestacks.py <latitude> <longitude>")
        sys.exit(1)

    try:
        latitude = float(sys.argv[1])
        longitude = float(sys.argv[2])
    except ValueError:
        print("Invalid latitude or longitude value.")
        sys.exit(1)

    print("GPS Simulator for Bluestacks - Use commands: l (left), r (right), t (top), b (bottom), exit")
    set_gps_location(latitude, longitude)

    while True:
        command = input("Enter command (l/r/t/b/exit): ").lower()
        if command == 'l':
            longitude -= 0.0001
        elif command == 'r':
            longitude += 0.0001
        elif command == 't':
            latitude += 0.0001
        elif command == 'b':
            latitude -= 0.0001
        elif command == 'exit':
            print("Exiting GPS Simulator.")
            sys.exit(0)
        else:
            print("Invalid command. Please use l/r/t/b/exit.")

        set_gps_location(latitude, longitude)
        print(f"New GPS location: Latitude {latitude}, Longitude {longitude}")

if __name__ == "__main__":
    main()





Editor is loading...