I'm trying to figure out what is the best practice for adding the API's key into my Android application.
-Some people recommend to use meta-data
in the Manifest.xml
file - link. Which made me feel like, it is better that adding the key in the resources
files.
<meta-data android:value="key_value" android:name="api_key"></meta-data>
-Some people says, add it into the resources
- link
<string name="api_key">api_key_value</string">
-We can simple add it within the class code
api.configue("api_key_value");
-Some people says adding the keys in the Manifest.xml
and the resources
files will allow the other apps to read it - link.
<string name="foo">bar</string">
I'm not trying to find the best secure way, because for me I would save the Key in my server and retrieve it in the runtime.
I'm asking about the best approach to follow and the best practice for that.
Thanks in advance.