I'm looking for a way to determine whether a valid Google maps API key is being used. Using an invalid key, we receive an error stating that the google API has been disabled. I'd like to capture that return, and determine whether or not to do our geocoding functions based on that return.
As it stands, when we save a record, we look to see if the address has been changed. If it has, we get the geocode of that address, and after the success/failure message has been passed back, we continue on with our processing before we save the record.
When the API is disabled, the code simply stops. Nothing is returned - no success or failure. At this point, our code stops as well as we rely on the return so we know where to go from there. We are not looking for a way to get around licensing, simply a way to determine whether the API is disabled at runtime. Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…