hi everyone, developing android application related club based.in start project built target(google api) , completed application.the final module client need map in application.after deep analyse found google updated google map version become 1.2.to use can set built target(android 4.2) only.so have no idea this..can suggest me how implement google map in application built target google api either how change built target android 4.2??????
//add follwing manifest <uses-sdk android:minsdkversion="12" android:targetsdkversion="17" /> <permission android:name="yourpackagename.permission.maps_receive" android:protectionlevel="signature" /> <uses-feature android:glesversion="0x00020000" android:required="true" /> <uses-permission android:name="yourpackagename.permission.maps_receive" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" /> //add following manifest below activity tag <meta-data android:name="com.google.android.maps.v2.api_key" android:value="your_apikey" /> //your activity should this
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); googlemap map = ((mapfragment) getfragmentmanager().findfragmentbyid(r.id.yourmapid)) .getmap(); } //your xml should
<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" tools:context=".mainactivity" > <fragment android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" class="com.google.android.gms.maps.mapfragment" /> </relativelayout> note: must import fragmentactivity class , add google-playservices-lib project reference library
Comments
Post a Comment