MapActivity: set APIKey programmatically

前端 未结 4 650
礼貌的吻别
礼貌的吻别 2020-12-16 11:54

I currently use a MapActivity in my application. I use it with 2 API Keys. One for debugging, and one for \"production\"

I am fed up with changing these values in th

4条回答
  •  情歌与酒
    2020-12-16 12:13

    This works for me.

    This variant of MapView constructor is documented here: https://developers.google.com/maps/documentation/android/reference/com/google/android/maps/MapView

    @Override
    protected void onCreate(Bundle arg0) {
        super.onCreate(arg0);
        String mapApiKey = 
        mMapView = new MapView(this, mapApiKey);
        setContentView(mMapView);
    

提交回复
热议问题