Reputation: 521
I've implemented google login and published App on Play Store. But after app published on play store Google Login doesn't work and I found solution for this problem i.e. copy SHA-1 key from Play Console and replace Google Api SHA-1 key with it. And after that app working fine but above mentioned Security Alert message is appears.
Complete Alert message :
Security alert
Your app contains exposed Google Cloud Platform (GCP) API keys. Please see this Google Help Center
article for details.
Vulnerable locations:
com.asdf.zxcv.AbcActivity-><init>
I am trying to resolve this warning since last 2 days but I can't. Can anyone please help me to resolve this problem. Thanks in Advance.
Upvotes: 0
Views: 1274
Reputation: 3785
The problem is how you declare and you the API key inside your code.
It's not advisable to use it as plain text hard-coded in Java code, however you could store it in strings.xml
resources.
Assuming that you store in it that way:
<string name="api_key">Your key</string>
Then in Java code get it like:
context.getResources().getString(R.string.api_key)
Upvotes: 1