Anyway, you can enable for your key some API with access via URL (Directions, Static maps etc.), e.g. for Places API:
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJN1t_tDeuEmsRUsoyG83frY4&fields=name,rating,formatted_phone_number&key=YOUR_API_KEY
and try to use it via HttpURLConnection
request. In HttpURLConnection
response you got what you need. In case of not valid API key something like:
{
"error_message" : "You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account",
"html_attributions" : [],
"status" : "REQUEST_DENIED"
}
Update:
Mobile Native Static Maps (a Google map object in a Maps SDK for Android or Maps SDK for iOS mobile application) has no usage limits, so is no need to check exceeding map usage limits. Other issues like no internet connection, no Google Play Services installed etc. you can test other ways. E.g. this for Internet connection test (also you can ping https://www.google.com/maps
), that for detecting installed Google Play Services and anyway you can detect "gray screen" before show it to user via, for example, set camera position to place with exactly known "non-gray" - color (sea, or forest) position and check screen pixel color. For getting bitmap of map in background you can use solution like that.