根据调试或发布版本自动改变地图的关键 [英] Automatically change map key based on debug or release version

查看:205
本文介绍了根据调试或发布版本自动改变地图的关键的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时我忘了,当我编译我的应用程序在从我的调试谷歌地图的关键改变。有没有办法把它自动更改,这样我就不必手动更改在清单每次和可能忘记再次更改它的发布版本?

Sometimes I forget to change over from my debug Google map key when I compile my app. Is there a way to have it change automatically so that I don't have to manually change it in the manifest everytime and possibly forget to change it for the release build again?

推荐答案

您可以做到这一点不会有改变它在所有的最好的事情。

The best thing you can do it not to have to change it at all.

首先,你可以在API_KEY查询到你的资料库,即使它是公共的。没有人可以使用密钥,无需调试或释放的密钥库(和密码)。

First of all, you can check in the API_KEY into your repository even if it is public. Nobody can use the key without having your debug or release keystore (and passwords).

其次,你可以指定一个单一的API密钥多个SHA-1;在对包谷歌的API控制台

Secondly, you can assign a single API key multiple SHA-1;package pairs in the Google APIs Console.

这篇关于根据调试或发布版本自动改变地图的关键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆