備忘的リンク集と地雷回避
■セットアップ
https://developers.google.com/maps/documentation/android/start
[ここでやること]
[はまりどころ]
旧API LevelをサポートするならMapFragmentではなくSupportMapFragmentになる
<?xml version="1.0" encoding="utf-8"?> <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.android.gms.maps.SupportMapFragment"/>
■ここを読め
https://developers.google.com/maps/documentation/android/
http://developer.android.com/intl/ja/training/location/index.html
■現在地の確認
http://developer.android.com/intl/ja/training/location/retrieve-current.html
Google Play Servicesの確認
- Location Services は Google Play services APKの一部である
- ユーザーの端末状態を予測するのは困難なのでLocationサービスを利用する前にAPKがインストールされていることをチェックすべし
- チェックにはGooglePlayServicesUtil.isGooglePlayServicesAvailable()を使え
- ConnectionResultの中から1つのコードを返してくるよ
http://developer.android.com/intl/ja/reference/com/google/android/gms/common/ConnectionResult.html - エラーコードが帰ってきたらユーザーが適切なアクションをするよう促す
ロケールダイアログを表示するためにGooglePlayServicesUtil.getErrorDialog() を実行しDialogFragment内にDialogを表示しろ。 - Dialogはユーザーに問題を修正することを許す場合があり、その場合Google Play ServicesはActivityに結果を返す。
- 結果を処理したかったらonActivityResult()をオーバーライドする