Google Maps ile Android Uygulamaları Giriş
1- Android Studio kurmalısınız :)
2- Android SDK manager kullanarak Google Play Services yüklemelisiniz.
3- https://hacerkubra.blogspot.com/2018/12/google-maps-andorid-uygulamalar-1.html linkindeki kodları yazmalısın.
4- Google Developer Console giriş yaparak Google Maps Androdi Apı etkinleştirmeli ve API key almalısınız.
5- SHA almak
1- Blank Activity oluştur.
2- Build.gradle düzenle
3- androidManifest Düzenle
* Google Serrvices meta
* API Key meta
* kullanıcı izinleri
*OpenGl meta
4- activity_main.xml düzenle
5- MainActivity.java düzenle
Kaynak : https://developers.google.com/maps/documentation/android-sdk/start#getting_the_google_maps_android_api_v2
2- Android SDK manager kullanarak Google Play Services yüklemelisiniz.
3- https://hacerkubra.blogspot.com/2018/12/google-maps-andorid-uygulamalar-1.html linkindeki kodları yazmalısın.
4- Google Developer Console giriş yaparak Google Maps Androdi Apı etkinleştirmeli ve API key almalısınız.
5- SHA almak
1- Blank Activity oluştur.
2- Build.gradle düzenle
3- androidManifest Düzenle
* Google Serrvices meta
* API Key meta
* kullanıcı izinleri
*OpenGl meta
4- activity_main.xml düzenle
<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.MapFragment"/>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:name="com.google.android.gms.maps.MapFragment"
map:cameraBearing="112.5"
map:cameraTargetLat="40.7484"
map:cameraTargetLng="-73.9857"
map:cameraTilt="65"
map:cameraZoom="17"
/>
</RelativeLayout>
5- MainActivity.java düzenle
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
private GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
// Add a marker in Sydney, Australia, and move the camera.
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
}
}
Kaynak : https://developers.google.com/maps/documentation/android-sdk/start#getting_the_google_maps_android_api_v2
Yorumlar
Yorum Gönder