Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change meta-data value android Programmatically

how to change meta-data value Programmatically in manifest or string resource in string value

like image 976
Ahmed Wahdan Avatar asked Jun 27 '26 03:06

Ahmed Wahdan


1 Answers

Using Inject build variables into the manifest you can change metadata value programmatically

In build.gradle

defaultConfig {
        manifestPlaceholders = [ senderid:"12345"]
    }

buildTypes {
        release {
            manifestPlaceholders = [ senderid:"56789"]
        }
    }

In Manifest file

<meta-data
            android:name="SENDER_ID"
              android:value="${senderid}" />

Referance Link : https://developer.android.com/studio/build/manifest-build-variables.html

like image 91
Kirti Avatar answered Jun 29 '26 04:06

Kirti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!