Request location by clicking on a badge

How do I make it such that by clicking on a badge (say my gps tracker badge), a script is triggered to request location from an iPhone device?