I have a Xamarin.Forms project, which contains an Android version of my app.
It has an AndroidManifest.xml file, which has to be populated with a meta-data tag containing a secret API key.
I use dotnet user-secrets
to store that secret API key on my machine.
The thing I want to inject looks like this:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="SECRET" />
This needs to go into manifest->application
node in the manifest.
How would I go about doing this?
I've tried prebuild events with a custom CLI tool written that outputs the needed tag into Properties/AndroidManifest.xml
, but that's not correct, because that updated manifest is being picked up by my version control, which I don't want.
Another option is to output my tag into an obj
folder which contains the final AnroidManifest
file which will be used by the android app after build.
But how do I access that file? PreLinkEvent
doesn't seem to work in my Xamarin.Android project.