【问题标题】:Is there any possibility to change google map key dynamically in android是否有可能在android中动态更改谷歌地图键
【发布时间】:2021-09-24 12:25:08
【问题描述】:

如果有多个客户端,需要为每个客户端分配不同的 google map api key。所以为此我为每个客户做了单独的构建。 是否有可能通过代码动态更改google map api key?

【问题讨论】:

    标签: android google-maps key api-key


    【解决方案1】:

    如果您使用 productFlavors,您可以根据需要更改 resValue

    android {
        ...
    
        productFlavors {
            cli1 {
                resValue "string", "google_maps_api_key", "CLI1_API_KEY"
             }
    
            cli2 {
                resValue "string", "google_maps_api_key", "CLI2_API_KEY"
             }
        }
    }
    

    【讨论】:

    • 好的,谢谢,但是在 ios 中,他们有 gmsservice.providekey("") 通过这个动态更改 api 密钥同样我们有任何东西
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 2016-04-20
    • 1970-01-01
    相关资源
    最近更新 更多