Play console says leaked API Key even though using recommended way

Viewed 1710

I am using the following way to access my API key; which seems to be the recommended way; but when I upload my app to Play Console, I get a critical error when the pre-launch report is ran. Its says "Leaked GCP API Keys". I can confirm that the app eventually get approved as my previous version had the same error and same code. Below is my code, what is the better way to write this.

private fun setupPlacesSearch()
{
    if(!Places.isInitialized()){
        Places.initialize(applicationContext, getString(R.string.google_maps_key))
    }
}

enter image description here

1 Answers

It seems it is just an alert, more than it is a warning. This resources says to ignore the warning if sufficient restrictions have been applied to the API Key so that it's use is restricted to a specific app(s).

Related