Translate To Your Own Langauge
Showing Map
Now we are done with the basics for implementing the Google Map version 2 (v2) in the Android application. Now one last step of this is how to display the Map in the UI (User Interface). To do so just follow these simple steps given bellow. Before this, make sure that you have successfully generated the SHA1 key and Google API key.
Step 1:
Add the following permissions in the AndroidManifest.xml file
just above the <Application> tag
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"
/>
<permission
android:name="androidtutorial4u.permission.MAPS_RECEIVE"
android:protectionLevel="signature"
/>
<uses-permission android:name="android.permission.INTERNET"
/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
/>
<!--
The following two permissions are not
required to use
Google Maps Android API v2.
These two permissions will be used if
you want to trace current location
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
/>
|
Step 2:
Now add following <meta-data code into your
AndroidManifest.xml file just above the </application> tag.
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="Your_API_Key"
/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"
/>
|
Note: In the above code where I wrote Your_API_Key, instead
of that, you have to write the key you have generated from google API Console.
If you haven’t generated it till now, see this article to generate API key for your project.
Your final AndroidManifest.xml file will have the following
code.
AndroidManifest.xml
<?xml version="1.0"
encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.map1"
android:versionCode="1"
android:versionName="1.0"
>
<!--
For more Android tutorials, visit
www.androidtutorial4u.blogspot.in
-->
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18"
/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"
/>
<permission
android:name="info.androidhive.googlemapsv2.permission.MAPS_RECEIVE"
android:protectionLevel="signature"
/>
<uses-permission android:name="android.permission.INTERNET"
/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"
/>
<!--
The following two permissions are not
required to use
Google Maps Android API v2.
These two permissions will be used if
you want to trace current location
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"
/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
>
<activity
android:name="com.androidtutorial4u.map1.MainActivity"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"
/>
<category android:name="android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBL-mi9lC1s_edH1WgAMMs0BVe4EGBTeDI"
/>
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"
/>
</application>
</manifest>
|
Step 3:
Now your AndroidManifest.xml file is ready. It’s time to
work on Activity_main.xml file. Replace the code of your Activity_main.xml file
with following code.
Activity_main.xml
<!--
androidtutorial4u.blogspot.in -->
<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"/>
|
Your Map is
ready now. Run the project on your device.
If you have
any query, feel free to contact us or just comment your queries.
Subscribe to:
Post Comments (Atom)
You may be interested in:
- Registration Form in Android with Validation
- Login with Validation (Android Example)
- Implementing Tab Example in android using TabActivity
- Splash screen in Android using Thread
- Showing Map
- button in android example
- Spinner Android Example
- Change the Profile Mode Programmatically (Android Example)
- Login Example (Android)
- Generating Google APIs
32 Responses to “Showing Map”
5 April 2014 at 02:23
its better if u can merge all the steps in single tutorial.... Thanxx
30 August 2018 at 03:11
Thanks you for sharing this unique useful information content with us. Really awesome work. keep on blogging
Click here:
angularjs training in chennai
Click here:
angularjs2 training in chennai
Click here:
angularjs4 Training in Chennai
Click here:
angularjs5 Training in Chennai
Click here:
angularjs training in tambaram
30 August 2018 at 06:34
Hello I am so delighted I found your blog, I really found you by mistake, while I was looking on Yahoo for something else, anyways I am here now and would just like to say thanks for a tremendous post. Please do keep up the great work.
Click here:
Microsoft azure training in btm
Click here:
Microsoft azure training in rajajinagar
8 September 2018 at 04:11
Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.
Blueprism training in Chennai
Blueprism training in Bangalore
Blueprism training in Pune
Blueprism online training
Blueprism training in tambaram
14 September 2018 at 23:34
Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in Chennai
Devops Training in Bangalore
Devops Training in pune
11 October 2018 at 02:39
Great post! I am actually getting ready to across this information, It’s very helpful for this blog.Also great with all of the valuable information you have Keep up the good work you are doing well.
Data Science course in rajaji nagar | Data Science with Python course in chenni
Data Science course in electronic city | Data Science course in USA
Data science course in pune | Data science course in kalyan nagar
11 October 2018 at 22:52
This is most informative and also this post most user friendly and super navigation to all posts... Thank you so much for giving this information to me..
java training in annanagar | java training in chennai
java training in chennai | java training in electronic city
15 December 2018 at 04:04
I really like the way your article is being written. Keep sharing.
Tally Course in Chennai | Tally Classes in Chennai | Tally Training in Chennai | Tally Course | Learn Tally | Tally Institute in Chennai | Learn Tally ERP 9 | Tally Training | Tally Training Institute in Chennai
12 March 2019 at 01:09
Really very nice blog information for this one and more technical skills are improve,i like that kind of post.
Microsoft Azure online training
Selenium online training
Java online training
Python online training
uipath online training
27 January 2020 at 02:11
This content of information has
helped me a lot. It is very well explained and easy to understand.
seo training in chennai
seo training classes
seo training course
seo training institute in chennai
seo training institutes
seo course in chennai
seo courses in chennai
seo institute in chennai
seo institutes in chennai
seo training institute
seo classes in chennai
seo training center in chennai
seo courses
seo training
seo course
27 September 2023 at 15:13
Dereköy
Çamkule
Elmalı
Asartepe
Davutlar
2CVMO7
28 September 2023 at 18:27
Konya
Kayseri
Malatya
Elazığ
Tokat
TXDD
4 October 2023 at 04:35
kars
sinop
sakarya
ankara
çorum
V23QJ
8 October 2023 at 21:40
whatsapp görüntülü show
ücretli.show
8JFC
9 October 2023 at 02:17
görüntülü.show
whatsapp ücretli show
DGA88
19 October 2023 at 01:33
ankara parça eşya taşıma
takipçi satın al
antalya rent a car
antalya rent a car
ankara parça eşya taşıma
8M6HYF
22 October 2023 at 22:48
adana evden eve nakliyat
afyon evden eve nakliyat
istanbul evden eve nakliyat
burdur evden eve nakliyat
gümüşhane evden eve nakliyat
MWC8X7
9 November 2023 at 12:24
A992D
Isparta Şehirler Arası Nakliyat
Bolu Şehir İçi Nakliyat
Mardin Şehirler Arası Nakliyat
Erzurum Şehir İçi Nakliyat
Çerkezköy Organizasyon
Tunceli Parça Eşya Taşıma
Malatya Şehir İçi Nakliyat
Kastamonu Parça Eşya Taşıma
Çerkezköy Cam Balkon
10 November 2023 at 13:47
00190
Çerkezköy Yol Yardım
Ağrı Lojistik
Batman Lojistik
Ünye Boya Ustası
Kilis Şehirler Arası Nakliyat
Bitlis Lojistik
Aydın Parça Eşya Taşıma
Çankırı Evden Eve Nakliyat
Diyarbakır Şehirler Arası Nakliyat
10 November 2023 at 21:40
75C02
Giresun Lojistik
Iğdır Lojistik
Çankaya Boya Ustası
Kocaeli Parça Eşya Taşıma
Çerkezköy Oto Lastik
Bartın Şehirler Arası Nakliyat
Çerkezköy Bulaşık Makinesi Tamircisi
Antalya Parça Eşya Taşıma
Adıyaman Parça Eşya Taşıma
6 December 2023 at 19:36
D1D3C
binance %20 referans kodu
19 December 2023 at 15:29
8C92D
tekirdağ yabancı görüntülü sohbet siteleri
zonguldak en iyi görüntülü sohbet uygulamaları
bartın sohbet
zonguldak görüntülü sohbet odaları
sakarya sesli sohbet siteleri
gümüşhane ücretsiz sohbet uygulaması
canli sohbet bedava
eskişehir parasız sohbet
osmaniye rastgele sohbet uygulaması
22 December 2023 at 14:28
793F8
ısparta telefonda kızlarla sohbet
kars görüntülü sohbet
kütahya sesli sohbet sitesi
yozgat en iyi ücretsiz sohbet siteleri
afyon goruntulu sohbet
görüntülü sohbet siteleri
ücretsiz sohbet siteleri
yozgat sohbet chat
kilis ücretsiz sohbet uygulaması
22 December 2023 at 17:14
9A152
mardin canlı sohbet sitesi
isparta rastgele sohbet
kırklareli canlı sohbet siteleri
rastgele görüntülü sohbet uygulamaları
adana rastgele sohbet
istanbul yabancı görüntülü sohbet siteleri
çankırı ücretsiz sohbet siteleri
canli goruntulu sohbet siteleri
erzurum görüntülü sohbet sitesi
5 January 2024 at 03:45
8A7B2
aksaray en iyi ücretsiz sohbet siteleri
en iyi ücretsiz görüntülü sohbet siteleri
kırşehir mobil sohbet siteleri
kastamonu seslı sohbet sıtelerı
tunceli görüntülü sohbet uygulamaları ücretsiz
osmaniye seslı sohbet sıtelerı
ığdır Rastgele Sohbet Odaları
edirne rastgele görüntülü sohbet uygulaması
parasız sohbet siteleri
5 January 2024 at 09:44
D073E
bedava sohbet uygulamaları
van sohbet odaları
ücretsiz görüntülü sohbet uygulamaları
düzce görüntülü sohbet
muş mobil sohbet et
telefonda sohbet
Karabük Telefonda Sohbet
kadınlarla rastgele sohbet
sivas ücretsiz sohbet siteleri
18 January 2024 at 07:17
81882
Hamster Coin Hangi Borsada
Clubhouse Takipçi Hilesi
Binance Kimin
Onlyfans Takipçi Hilesi
Fuckelon Coin Hangi Borsada
Coin Nasıl Üretilir
Soundcloud Takipçi Satın Al
Coin Nasıl Alınır
Coin Madenciliği Nasıl Yapılır
18 January 2024 at 18:02
1A74F
Üsküdar
Otlukbeli
Han
Hemsin
Kofçaz
Yayladere
Bayramören
Nazimiye
Pertek
11 February 2024 at 18:35
9D255
shapeshift
spookyswap
thorchain
satoshivm
pancakeswap
dexview
avalaunch
debank
quickswap
27 August 2024 at 05:35
FCBNGN
شركة كشف تسربات المياه
3 November 2024 at 04:33
شركة رش مبيدات بالاحساء xZruftqNJI
25 November 2024 at 05:36
شركة مكافحة حشرات بالاحساء S3xN2KRe5j
Post a Comment
Comment your feedback for the post. You can also ask your queries regarding android.