Android Map
Android Map
Android Map
net/publication/372643496
CITATIONS READS
0 117
1 author:
Bereket Haile
Mekelle University
4 PUBLICATIONS 47 CITATIONS
SEE PROFILE
All content following this page was uploaded by Bereket Haile on 26 July 2023.
MEKELLE
THESIS REPORT
NAME ID
Name Id
Name:
Signature:
ABSTRACT
This project campus map guide students, parents, visitors or generally for those who are not familiar
with campus to find the desired places in campus with more ease. Depending on its current location.
Well it consists of entire details of those locations or how to reach the location as well as other. This
project is mainly beneficial for those who have no idea about the places they want to visit. By
providing geographic based information system In this paper we are proposing a tour guide
application called Mobile Campus on android based mobile platform for Mekelle University main
campus. This tour guide application includes functionality such as locating current location of users,
showing university campus map, route direction of university shuttle and gives small description &
contact information of important places on campus and it have different map view types like normal,
hybrid, satellite and traffic view types .
ACKNOWLEDGMENT
We would like to thank all those people who have helped us in one or another way to finish this
project. We would like to thank Ins. Tekalay, our project advisor, for taking active interest in this
project. His suggestions and guidance has helped as accomplish this project. Lastly, we would like to
thank all the people who directly or indirectly support this project.
ABSTRACT ..................................................................................................................................... 1
ACKNOWLEDGMENT .................................................................................................................. 4
3.6 TESTING............................................................................................................................... 31
6. REFERENCES ........................................................................................................................... 36
APPENDIX .................................................................................................................................... 37
Figure 1 about android .................................................................................................................. 19
Campuses can be quite large and confusing. Visitors, new students, and staff can have a difficult time
getting around. Even when they are asking for directions, they often time cannot find the destination
because the directions involve knowing the surrounding buildings and landmarks of the campus. In
addition, the campus is growing fast, with new buildings and facilities being added. This can get quite
stressful, especially considering people are often on a schedule and need to get to a certain location on
time. Eliminating this stress and confusion would improve the overall atmosphere on campus. Since
smartphones are a ubiquitous technology nowadays, it makes sense to use them to facilitate campus
directions.
In Mekelle university every year More than 6000 Freshman Students are joining Mekelle University,
they face different problems to find a specific place .and it have different staff workers who are not
familiar with campus and new visitor every day so they always ask to find specific place on the
campus so this project will solve the basic problems.
1.3 OBJECTIVE
1.3.1 GENERAL OBJECTIVES
The main objective of the project is to help students and anyone unfamiliar with the campus, by
giving the current location using GIS based and find their way around the school campus more easily
and improve their knowledge of where things are located around campus
The app would include a GUI, a search button to search for specific place on the campus and modules
to implement the various functions of the app.it have different map views like satellite, normal, hybrid
and traffic and a function to determine what the shortest path to the user’s destination is. It would also
have a navigator to show the user their location on campus. And it only has information about the
main campus.
This application will help the students or to those who are not familiar to the campus to find the
desired location.it consists of entire details of those locations or how to reach the location as well as
other emergency facilities like hospital, bus stop etc. by providing a geographical based information.
CHAPTER 2 LITERATURE REVIEW
Android (operating system) is a mobile operating system (OS) currently developed by Google, based
on the Linux kernel and designed primarily for touchscreen mobile devices such as smartphones and
tablets. It has been the best-selling OS on tablets and on smartphones since 2013, and has the largest
installed base.
Android's user interface is mainly based on direct manipulation, using touch gestures that loosely
correspond to real-world actions, such as swiping, tapping and pinching, to manipulate on-screen
objects, along with a virtual keyboard for text input. The operating system's current design language is
Google's Material Design. Android's primary app store is Google Play, with over one million Android
applications published and 50 billion downloads as of July 2013. In addition to touchscreen devices,
Google has further developed Android for television, cars, and wristwatches, each with a specialized
yet similar interface. Variants and forked versions of Android are also used on notebooks, game
consoles, digital cameras, and other electronics.
Android was initially authored by Android, Inc., which Google bought in 2005, and unveiled it in
2007, along with the founding of the Open Handset Alliance – a consortium of hardware, software,
and telecommunication companies devoted to advancing open standards for mobile devices. A 2013
survey of mobile application developers found that 71% of developers create applications for Android
from April to May, and a 2015 survey found that 40% of full-time professional developer’s priority
sees Android as their target platform, compared to Apple's IOS on 37% with both platforms far above
others. In September 2015, Android had 1.4 billion monthly active users.
Android's source code is released by Google under open source licenses, although most Android
devices ultimately ship with both open source and proprietary software, including required proprietary
components for Google's services. It is popular with technology companies that require an optimized,
low-cost and customizable operating system for high-tech devices. Its open nature has encouraged a
large community of developers and enthusiasts to use the open-source code as a foundation for
community-driven projects, which add new features for advanced users or bring Android to devices
originally shipped with other operating systems. However, Android has no central update protocol
and most devices fail to receive security updates: 2015 research concluded that almost 90% of
Android phones in use had known but unpatched security vulnerabilities due to lack of updates and
support. The success of Android has made it a target for patent litigation as part of the so-called
"smartphone wars" between technology companies.
Features
Interface
Android's default user interface is mainly based on direct manipulation, using touch inputs that
loosely correspond to real-world actions, like swiping, tapping, pinching, and reverse pinching to
manipulate on-screen objects, along with a virtual keyboard. Game controllers and full-size physical
keyboards are supported via Bluetooth or USB. The response to user input is designed to be
immediate and provides a fluid touch interface, often using the vibration capabilities of the device to
provide haptic feedback to the user. Internal hardware, such as accelerometers, gyroscopes and
proximity sensors are used by some applications to respond to additional user actions, for example
adjusting the screen from portrait to landscape depending on how the device is oriented, or allowing
the user to steer a vehicle in a racing game by rotating the device, simulating control of a steering
wheel.
Android devices boot to the home screen, the primary navigation and information "hub" on Android
devices that is analogous to the desktop found on personal computers. (Android also runs on regular
personal computers, as described below). Android home screens are typically made up of app icons
and widgets; app icons launch the associated app, whereas widgets display live, auto-updating
content, such as the weather forecast, the user's email inbox, or a news ticker directly on the home
screen. A home screen may be made up of several pages, between which the user can swipe back and
forth, though Android's home screen interface is heavily customisable, allowing users to adjust the
look and feel of the devices to their tastes Third-party apps available on Google Play and other app
stores can extensively re-theme the home screen, and even mimic the look of other operating systems,
such as Windows Phone. Most manufacturers, and some wireless carriers, customise the look and feel
of their Android devices to differentiate themselves from their competitors. Applications that handle
interactions with the home screen are called "launchers" because they, among other purposes, launch
the applications installed on a device.
Along the top of the screen is a status bar, showing information about the device and its connectivity.
This status bar can be "pulled" down to reveal a notification screen where apps display important
information or updates, such as a newly received email or SMS text, in a way that does not
immediately interrupt or inconvenience the user Notifications are persistent until read by tapping it,
which opens the relevant app, or dismissed by sliding it off the screen. Beginning on Android 4.1,
"expanded notifications" can display expanded details or additional functionality; for instance, a
music player can display playback controls, and a "missed call" notification provides buttons for
calling back or sending the caller an SMS message.
Android provides the ability to run applications that change the default launcher, and hence the
appearance and externally visible behaviour of Android. These appearance changes include a multi-
page dock or no dock, and many more changes to fundamental features of the user interface.
Applications
Applications ("apps"), which extend the functionality of devices, are written using the Android
software development kit (SDK) and, often, the Java programming language that has complete access
to the Android APIs. Java may be combined with C/C++, together with a choice of non-default
runtimes that allow better C++ support; the Go programming language is also supported since its
version 1.4, which can also be used exclusively although with a restricted set of Android APIs. The
SDK includes a comprehensive set of development tools, including a debugger, software libraries, a
handset emulator based on QEMU, documentation, sample code, and tutorials. Initially, Google's
supported integrated development environment (IDE) was Eclipse using the Android Development
Tools (ADT) plugin; in December 2014, Google released Android Studio, based on IntelliJ IDEA, as
its primary IDE for Android application development. Other development tools are available,
including a native development kit (NDK) for applications or extensions in C or C++, Google App
Inventor, a visual environment for novice programmers, and various cross platform mobile web
applications frameworks. In January 2014, Google unveiled an framework based on Apache Cordova
for porting Chrome HTML 5 web applications to Android, wrapped in a native application shell.
Android has a growing selection of third-party applications, which can be acquired by users by
downloading and installing the application's APK (Android application package) file, or by
downloading them using an application store program that allows users to install, update, and remove
applications from their devices. Google Play Store is the primary application store installed on
Android devices that comply with Google's compatibility requirements and license the Google Mobile
Services software. Google Play Store allows users to browse, download and update applications
published by Google and third-party developers; as of July 2013, there are more than one million
applications available for Android in Play Store. As of July 2013, 50 billion applications have been
installed. Some carriers offer direct carrier billing for Google Play application purchases, where the
cost of the application is added to the user's monthly bill.
Memory management
Since Android devices are usually battery-powered, Android is designed to manage processes to keep
power consumption at a minimum. When an application is not in use the system suspends its
operation so that, while available for immediate use rather than closed, it does not use battery power
or CPU resources.
Android manages the applications stored in memory automatically: when memory is low, the system
will begin invisibly and automatically closing inactive processes, starting with those that have been
inactive for longest. Life hacker reported in 2011, that third-party task killers were doing more harm
than good.
Virtual Reality
At Google I/O on May 2016, Google announced Daydream, a virtual reality operating system, which
relies on a smartphone and provides VR capabilities with a virtual reality headset and controller
designed by Google itself. The operating system will be built into android starting with N,
differentiating from standalone support for VR capabilities.
The software is already released for developers, and will be released fully on Fall 2016.
Hardware
Google map is a desktop web mapping service developed by Google. It offers satellite imagery, street
maps, 360° panoramic views of streets (Street View), real-time traffic conditions (Google Traffic),
and route planning for traveling by foot, car, bicycle (in beta), or public transportation.
Google Maps began as a C++ desktop program designed by Lars and Jens Eilstrup Rasmussen at
Where 2 Technologies. In October 2004, the company was acquired by Google, which converted it
into a web application. After additional acquisitions of a geospatial data visualization company and a
real time traffic analyser, Google Maps was launched in February 2005. The service's front end
utilizes JavaScript, XML, and Ajax. Google Maps offers an API that allows maps to be embedded on
third-party websites, and offers a locator for urban businesses and other organizations in numerous
countries around the world. Google Map Maker allows users to collaboratively expand and update the
service's mapping worldwide.
Google Maps' satellite view is a "top-down" or "birds eye" view; most of the high-resolution imagery
of cities is aerial photography taken from aircraft flying at 800 to 1,500 feet (240 to 460 m), while
most other imagery is from satellites. Much of the available satellite imagery is no more than three
years old and is updated on a regular basis. Google Maps uses a close variant of the Mercator
projection, and therefore cannot accurately show areas around the poles.
The current redesigned version of the desktop application was made available in 2013, alongside the
"classic" (pre-2013) version. Google Maps for mobile was released in September 2008 and features
GPS turn-by-turn navigation. In August 2013, it was determined to be the world's most popular app
for smartphones, with over 54% of global smartphone owners using it at least once. In 2012, Google
reported having over 7,100 employees and contractors directly working in mapping.
There are many types of maps available within the Google Maps Android API. A map's type governs
the overall representation of the map. For example, an atlas usually contains political maps that focus
on showing boundaries, and road maps that show all of the roads for a city or region. The Google
Maps Android API offers four types of maps, as well as an option to have no map at all:
Normal Typical road map. Roads, some man-made features, and important natural features such as
rivers are shown. Road and feature labels are also visible.
Hybrid Satellite photograph data with road maps added. Road and feature labels are also visible.
Satellite Satellite photograph data. Road and feature labels are not visible.
Terrain Topographic data. The map includes colours, contour lines and labels, and perspective
shading. Some roads and labels are also visible.
None No tiles. The map will be rendered as an empty grid with no tiles loaded.
Application components are the essential building blocks of an Android application. These
components are loosely coupled by the application manifest file AndroidManifest.xml that describes
each component of the application and how they interact. There are following four main components
that can be used within an Android application:
Components Description
Activities They dictate the UI and handle the user interaction to the smart phone
screen
Activities
An activity represents a single screen with a user interface; in-short Activity performs actions on the
screen. For example, an email application might have one activity that shows a list of new emails,
another activity to compose an email, and another activity for reading emails. If an application has
more than one activity, then one of them should be marked as the activity that is presented when the
application is launched. An activity is implemented as a subclass of Activity class as follows −
A service is a component that runs in the background to perform long-running operations. For
example, a service might play music in the background while the user is in a different application, or
it might fetch data over the network without blocking user interaction with an activity.A service is
implemented as a subclass of Service class as follows
Broadcast Receivers
Broadcast Receivers simply respond to broadcast messages from other applications or from the
system. For example, applications can also initiate broadcasts to let other applications know that some
data has been downloaded to the device and is available for them to use, so this is broadcast receiver
who will intercept this communication and will initiate appropriate action.
Content Providers
A content provider component supplies data from one application to others on request. Such requests
are handled by the methods of the ContentResolver class. The data may be stored in the file system,
the database or somewhere else entirely.
We will go through these tags in detail while covering application components in individual chapters.
Additional Components There are additional components which will be used in the construction of
above mentioned entities, their logic, and wiring between them. These components are −
Components Description
Views UI elements that are drawn on-screen including buttons, lists forms etc.
Layouts View hierarchies that control screen format and appearance of the views.
Features of Android are a powerful operating system competing with Apple 4GS and supports great
features. Few of them are listed below:
Feature Description
Beautiful UI Android OS basic screen provides a beautiful and intuitive user interface.
Connectivity GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, NFC and
WiMAX.
Storage SQLite, a lightweight relational database, is used for data storage purposes.
Media support H.263, H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1, MP3,
MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP
Web browser Based on the open-source WebKit layout engine, coupled with Chrome's V8
JavaScript engine supporting HTML5 and CSS3.
Multi-touch Android has native support for multi-touch which was initially made available in
handsets such as the HTC Hero.
Multi-tasking User can jump from one task to another and same time various application can
run simultaneously.
Resizable Widgets are resizable, so users can expand them to show more content or shrink
widgets them to save space
GCM Google Cloud Messaging (GCM) is a service that lets developers send short
message data to their users on Android devices, without needing a proprietary
sync solution.
Wi-Fi Direct A technology that lets apps discover and pair directly, over a high-bandwidth
peer-to-peer connection.
Android Beam A popular NFC-based technology that lets users instantly share, just by touching
two NFC-enabled phones together.
Android operating system is a stack of software components which is roughly divided into five
sections and four main layers as shown below in the architecture diagram.
Linux kernel
At the bottom of the layers is Linux - Linux 3.6 with approximately 115 patches. This provides a level
of abstraction between the device hardware and it contains all the essential hardware drivers like
camera, keypad, display etc. Also, the kernel handles all the things that Linux is really good at such as
networking and a vast array of device drivers, which take the pain out of interfacing to peripheral
hardware.
Libraries
On top of Linux kernel there is a set of libraries including open-source Web browser engine WebKit,
well known library libc, SQLite database which is a useful repository for storage and sharing of
application data, libraries to play and record audio and video, SSL libraries responsible for Internet
security etc.
Android Libraries
This category encompasses those Java-based libraries that are specific to Android development.
Examples of libraries in this category include the application framework libraries in addition to those
that facilitate user interface building, graphics drawing and database access. A summary of some key
core Android libraries available to the Android developer is as follows −
android.app − Provides access to the application model and is the cornerstone of all Android
applications.
android.content − Facilitates content access, publishing and messaging between applications and
application components.
android.database − Used to access data published by content providers and includes SQLite database
management classes.
android.os − Provides applications with access to standard operating system services including
messages, system services and inter-process communication.
Having covered the Java-based core libraries in the Android runtime, it is now time to turn our
attention to the C/C++ based libraries contained in this layer of the Android software stack.
Android Runtime
This is the third section of the architecture and available on the second layer from the bottom. This
section provides a key component called Dalvik Virtual Machine which is a kind of Java Virtual
Machine specially designed and optimized for Android.
The Dalvik VM makes use of Linux core features like memory management and multi-threading,
which is intrinsic in the Java language. The Dalvik VM enables every Android application to run in its
own process, with its own instance of the Dalvik virtual machine.
The Android runtime also provides a set of core libraries which enable Android application
developers to write Android applications using standard Java programming language.
Application Framework
The Application Framework layer provides many higher-level services to applications in the form of
Java classes. Application developers are allowed to make use of these services in their applications.
Activity Manager − Controls all aspects of the application lifecycle and activity stack.
Content Providers − Allows applications to publish and share data with other applications.
Resource Manager − Provides access to non-code embedded resources such as strings, color settings
and user interface layouts.
Notifications Manager − Allows applications to display alerts and notifications to the user.
View System − An extensible set of views used to create application user interfaces.
Applications
You will find all the Android application at the top layer. You will write your application to be
installed on this layer only. Examples of such applications are Contacts Books, Browser, Games etc.
Recent technological advancements have gain popularity finding many applications in everyday
activities. There are many devices and different applications that focus on directing the user to desired
locations. Today’s drivers are well equipped for travel thanks to the GPS units many have in their
cars. GPS applications allow users to enter a destination and based on their current coordinates
display the fastest way to the destination. Additional features have evolved over time, such as
displaying congested routes, which allow users to make smart driving decisions and improve driving
safety. This saves time and stress when going to unfamiliar places or taking long trips. Google Maps
and GPS systems have become indispensable in recent years, with vast amounts of users relying on
them for directions, but their capabilities have not yet been fully applied to university campuses.
Directions within campuses are not available using the Google maps application.
CHAPTER 3 METHODOLOGY
In order to get familiar with android we start by reading related books and YouTube tutorials, then we
start developing sample android applications after that we gat some information’s about android
programing and android studio
3.2 METHODS
3.5 IMPLEMENTATION
Java
xml
Step 1- download and install Google map play service and Google Respiratory it should be up to date
To install Go to SDK manager than in the SDK Tools Manu select the android Google play service
Google Respiratory it should be up to date
Figure 4 installing play service
Step 2- Enable android Google Maps API and get the api key to use Google map in our application go
to Google API Console (http://console.developers.google.com/apis)
Creating a Project, To create a new project, click on the my project menu then the click Create Project
button.name it what you like we name it mu-map
Figure 6 creating project
After creating the project Enable the GOOGLE MAP ANDROID API
After enabling the Google Maps API, click on the Credentials item under APIs in the side navigation
to get a key to access the Maps API in your application. When you are presented with the Credentials
dialog, press the blue Add Credentials button and select API Key.
Figure 8 getting the api key
Give it a name what you like we name it Android Key 1 than add the package name and the
fingerprint we got it from our project the fingerprint can be find on the android studio Google map
api.xml file or it can be generated using the command line (keytool -list -v -keystore
c:\Users\Administrator\.android\debug.keystore -alias androiddebugkey -storepass android -keypass
android}
Figure 10 getting the SHA1 inCMD
After saving the inputs data’s then we got the Api Key
Figure 13 saving the api key
Than copy and past it in the Google map Api .xml file
After adding the above information’s we start developing the layout of the app using the xml codes
3.6 TESTING
To test the application we use android phone with minimum android version of 4.3 and up dated
android Google play service
Figure 16 output
CHAPTER 4 RESULT AND DISCUSSION
After completing the development of the campus map android app and prototype of the project, we
installed it on android phone to test its functionality. Some of the results are as flow
Figure 17 Map
Change map view type
Figure 19 searching
CHAPTER 5. CONCLUSION AND RECOMMENDATION
5.1 CONCLUSION
In this paper, we presented the design and implementation of a mobile application called MOBILE-
CAMPUS, with which mobile users can get valuable information on different landmarks of a
university campus and guide students/parents/visitors to find the desired places in campus with more
ease anytime and anywhere. By Mobile-campus, users can get an detailed information about
important landmarks in text and pictures A campus is a complex infrastructure. Especially new
students and people who are on it for the first time have a hard time to orientate themselves and find
places. The campus occupies more than two square kilometres and thus is even larger than that. The
campus has many different buildings. Even if there are maps at some points on the campus, users do
not have continuous help to get to their destination. In this paper we presented a campus map
application developed on an Android platform. The application provides
5.2 RECOMMENDATION
A person who wants to do more on this topic can refer some materials and with enough skill make the
application to work with databases. The project has some functionality. We believe this is the first
step to build complex application for our university, having more features and running on smart
phones and tablets. The system can further be advanced by adding some features such as notification
for new events, campus wide emergency alerts, navigation services for users, class, exam and other
event schedules.
6. REFERENCES
1. Android Development Tutorial by Lars Vogel Version 11.2
2. An introduction to android development by Alejandro Troccoli
3. Walter Savitch Absolute Java 2nd edition
4. Introduction to android programming lecture note by Randeep Bhatia
5. Android application development fundamentals from Lynda.com
6. http://www.tutorialpoint.com date march 10 2016
APPENDIX
Xml code
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:background="@color/blue"
android:orientation="vertical">
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.ebook.system.mu_map.MapsActivity"
tools:layout="@layout/abc_action_bar_title_item"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_below="@+id/button5" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/search"
android:id="@+id/button5"
android:onClick="geoLocate"
android:background="@color/darkred"
android:layout_below="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<Button
android:background="@color/darkred"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/change"
android:id="@+id/but"
android:onClick="change"
android:layout_alignTop="@+id/editText2"
android:layout_alignRight="@+id/map"
android:layout_alignEnd="@+id/map" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/editText2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/but"
android:layout_toStartOf="@+id/but" />
</RelativeLayout>
Android code
package com.ebook.system.mu_map;
import android.Manifest;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.graphics.Color;
import android.location.Address;
import android.location.Geocoder;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.Toast;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.maps.CameraUpdate;
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.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
import java.io.IOException;
import java.util.List;
,canlat=13.482155,canlng=39483850,arclat=13.481295,arclng=39.484487,technolat=13.48
0035,technolng=39.483292,
gedamlat=13.481714,gedamlng=39.487153,agrilat=13.479711,agrilng=39.485479,entlat=13
.476160,entlng=39.483864;
private static final float dzoom = 100;
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to
be used.
Toast.makeText(MapsActivity.this, "WELCOME TO MK",
Toast.LENGTH_SHORT).show();
SupportMapFragment mapFragment = (SupportMapFragment)
getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[]
permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the
documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
mMap.setMyLocationEnabled(true);
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera.
In this case,
* we just add a marker near Sydney, Australia.
* If Google Play services is not installed on the device, the user will be
prompted to install
* it inside the SupportMapFragment. This method will only be triggered once
the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
if (ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &&
ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
// TODO: Consider calling
// ActivityCompat#requestPermissions
// here to request the missing permissions, and then overriding
// public void onRequestPermissionsResult(int requestCode, String[]
permissions,
// int[] grantResults)
// to handle the case where the user grants the permission. See the
documentation
// for ActivityCompat#requestPermissions for more details.
return;
}
LatLng sydney = new LatLng(-34, 151);
mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in
Sydney"));
mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney));
mMap.addMarker(new MarkerOptions().position(new LatLng(entlat,entlng)).
title("Entrance Gate
").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
mMap.addMarker(new MarkerOptions().position(new LatLng(reglat,reglng)).
title("Registra").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactor
y.HUE_AZURE)));
mMap.addMarker(new MarkerOptions().position(new LatLng(ladlat,ladlng)).
title("Female Student
Dorm").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new
LatLng(boysaholat,boysaholng)).
title("Ashegoda Male student
Dorm").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new LatLng(loclat,loclng)).
title("Lucy Male student
Dorm").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new
LatLng(africalat,africalng)).
title("Africa Male student
Dorm").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new LatLng(canlat,canlng)).
title("Kennan Male Student
Dorm").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new LatLng(arclat,arclng)).
title("Architecture
Building").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_A
ZURE)));
mMap.addMarker(new MarkerOptions().position(new LatLng(gedamlat,gedamlng)).
title("Gedam Male Student
Dorm").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new LatLng(agrilat,agrilng)).
title("Agriculture
Library").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZ
URE)));
mMap.addMarker(new MarkerOptions().position(new LatLng(latasho,lngasho)).
title("Ashogoda Class
Rooms").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZUR
E)));
mMap.addMarker(new MarkerOptions().position(new
LatLng(hidasilat,hidasilng)).
title("Hidasi
Cafe").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE
)));
mMap.addMarker(new MarkerOptions().position(new
LatLng(comoroslat,comoroslng)).
title("Comoros").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory
.HUE_AZURE)));
mMap.addMarker(new MarkerOptions().position(new
LatLng(techerslat,techerslng))
.title("Techers Gust
Houes").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZUR
E)));
mMap.addMarker(new MarkerOptions().position(new
LatLng(13.476680,39.484469)).
title("Doctor
Meteku").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZU
RE)));
mMap.getUiSettings().setZoomControlsEnabled(true);
mMap.setMyLocationEnabled(true);
showMapTypeSelectorDialog();
}
private void showMapTypeSelectorDialog() {
// Prepare the dialog by setting up a Builder.
final String fDialogTitle = "Select Map Type";
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(fDialogTitle);
// Find the current map type to pre-check the item representing the current
state.
int checkItem = mMap.getMapType() - 1;
InputMethodManager
imm=(InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(v.getWindowToken(),0);
}
public void onStart() {
super.onStart();
CameraUpdate update=CameraUpdateFactory.newLatLng(ll);
mMap.moveCamera(update);
@Override
public void onStop() {
super.onStop();
String
<resources>
<string name="app_name">MU-map</string>
<string name="title_activity_maps">MuMap</string>
<string name="map">Map</string>
<string name="seta">Satellite</string>
<string name="hyb">Hybrid</string>
<string name="tra">Terrain</string>
<string name="search">Search</string>
<string name="change">Setting</string>
<item name="blue" type="color">#33b5e5</item>
<item name="purple" type="color">#FFAA66CC</item>
<item name="green" type="color">#083508</item>
<item name="orange" type="color">#e60f0f10</item>
<item name="red" type="color">#bd635a64</item>
<item name="darkblue" type="color">#282b27</item>
<item name="darkpurple" type="color">#6e6971</item>
<item name="darkgreen" type="color">#FF669900</item>
<item name="darkorange" type="color">#6f453e37</item>
<item name="darkred" type="color">#864343</item>
<integer-array name="androidcolors">
<item>@color/blue</item>
<item>@color/purple</item>
<item>@color/green</item>
<item>@color/orange</item>
<item>@color/red</item>
<item>@color/darkblue</item>
<item>@color/darkpurple</item>
<item>@color/darkgreen</item>
<item>@color/darkorange</item>
<item>@color/darkred</item>
</integer-array>
</resources>