google / secrets-gradle-plugin

A Gradle plugin for providing your secrets to your Android project.
Apache License 2.0
1.16k stars 105 forks source link

Updating .properties file in run time #18

Closed hubWalile closed 3 years ago

hubWalile commented 3 years ago

Hi, I am trying to use the plugin but an error is blocking me from moving forward. Before I go further, I would like to understand if it is possible to achieve this:

  1. Follow the steps in "Example Usage" to use the plugin.
  2. Create a temp.properties file in the project level folder and enter MAP_KEY=this_is_map_key in the file.
  3. In the manifest file, add
    <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="${MAP_KEY}" />
  4. In runtime, trigger a network call and the response has the real map API key.
  5. Update the entry created in step 2 with the real map API key. The activities that need the map API key will use the real map API key provided via the meta-data added in step 3.

I am not sure if updating the value in temp.properties (step 5) in runtime will change the value in the meta-data. Please advise.

arriolac commented 3 years ago

Hi @hubWalile, the approach you mention is not currently possible since the [real] API key needs to be provided via manifest file. This would not be the case if the Maps SDK supported initialization programmatically. Let me know if you have any further questions.