さまよえる、Android

Androidのプログラミングで便利なことや残しておきたいことを残しておく。もしオススメのライブラリがあったら教えてくださいね。

Androidで、GoogleMapと遊ぶ

https://console.developers.google.com/project?authuser=0

プロジェクト作成 : プロジェクト名は自分の場合、markmap

Google Maps Android APIを有効にする。

https://console.developers.google.com/project/markmap-1006/apiui/credential?authuser=0&pli=1

APIキーを取得する

cd /Users/yusukearai/.androidに移動

ターミナルでコマンド

keytool -list -v -keystore debug.keystore -alias androiddebugkey -storepass android -keypass android

SHA1: の後ろをコピー

SHA1の文字列;パッケージ名を入力。

APIキーを取得できた。

Add an activity to Mobile

Google Maps Activityを選択

google_maps_api.xml

<resources>
    <!--
    TODO: Before you run your application, you need a Google Maps API key.

    To get one, follow this link, follow the directions and press "Create" at the end:

https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=06:42:41:EB:38:DA:FC:5C:41:D0:89:9C:7C:FA:65:05:DE:D4:C5:33%3Bcom.sports_sensor.myapplication

    You can also add your credentials to an existing key, using this line:
    06:42:41:EB:38:DA:FC:5C:41:D0:89:9C:7C:FA:65:05:DE:D4:C5:33;com.sports_sensor.myapplication

    Once you have your key (it starts with "AIza"), replace the "google_maps_key"
    string in this file.
    -->
    <string name="google_maps_key" translatable="false" templateMergeStrategy="preserve">
        YOUR_KEY_HERE
    </string>
</resources>


YOUR_KEY_HEREに、先ほど取得した、APIキーを貼り付ける。

表示された!!!