android / codelab-android-dynamic-features

Apache License 2.0
121 stars 47 forks source link

Can we do on/off Dynamic delivery based on Api level #25

Closed g5-amit closed 3 years ago

g5-amit commented 4 years ago

Can we implement the attribute ( dist:onDemand) like: <dist:module dist:onDemand="@bool/isLessThanApi24" dist:title="@string/module_mapqr">

</dist:module>

Where boolean will decide for which Api level we want Dynamic Delivery.

I am asking this question since Dynamic delivery does not perform as stable delivery for Marshmallow and Below and we face crashes for it many times on Firebase

Once i do handle it using boolean variables like mentioned above , I always get the error:

Attribute 'onDemand' expected to have type 'boolean' but found: namespace_uri: "http://schemas.android.com/apk/distribution" name: "onDemand" value: "@bool/isLessThanApi24" source { line_number: 15 } compiled_item { ref { id: 2114060289 name: "bool/isLessThanApi24" } }

ivincetti commented 3 years ago

Yes, you can

Docs - Configure conditional delivery

<dist:module
        dist:title="@string/module_mapqr">
        <dist:delivery>
            <dist:on-demand />
            <dist:install-time>
                <dist:conditions>
                    <dist:min-sdk dist:value="21" />
                    <dist:max-sdk dist:value="24" />
                </dist:conditions>
            </dist:install-time>
        </dist:delivery>
        <dist:fusing dist:include="true" />
</dist:module>
g5-amit commented 3 years ago

Thank you.