is there a way to enable gps programmatically?
I hope not, as that would be a privacy flaw. AFAIK, all known holes that allowed malware to enable GPS programmatically have now been closed.
am trying to enable gps and send the location of the device to an email
The user controls whether GPS is enabled or not.