Android 㧠Google Cloud Endpoint ã使ãæã®ãããã°çã¨ãªãªã¼ã¹çã® Client ID ãåãæ¿ããæ¹æ³
ãå ã«æ¸ãããGoogle Maps M2 API for Android ã§ã¯ããããã°çã¨ãªãªã¼ã¹çã§åä¸ã® API key ã使ããããã ãã©ãCloud Endpoint ã® Client ID ãè¨å®ããã¨ããã¯ãè¤æ°ã® SHA1 ãæ¸ããããã«ãªã£ã¦ãªãã®ã§ãå¥ã ã® Client ID ãçæãããããªãã
ããªã®ã§ãããã¯ã³ã¼ãä¸ã§åãæ¿ããããã«ããã
ãgen ãã©ã«ãã«èªåçã«çæããã BuildConfig ã¯ã©ã¹ã® DEBUG ãã£ã¼ã«ããåç §ãã¦ãstatic initializer 㧠Stringåã® finalå¤ãè¨å®ããã
public class Ids { pubilc static final String WEB_CLIENT_ID = "Client ID for web applications ã®å¤"; public static final String ANDROID_CLIENT_ID; static { if (BuildConfig.DEBUG) { ANDROID_CLIENT_ID = "ãããã°çã® Client ID for installed applications ã®å¤"; } else { ANDROID_CLIENT_ID = "ãªãªã¼ã¹çã® Client ID for installed applications ã®å¤"; } }