Professional Documents
Culture Documents
This is to certify that Report entitled Android Google Maps App which is submitted by me
in partial fulfillment of the requirement for the award of degree B.Tech. in Computer Science
and Engineering to DAV University, Jalandhar ( Pb.) comprises only my work and due
acknowledgement has been made in the text to all other material used.
Avnesh Sharma
Btech.CSE
11300424
ACKNOWLEDGEMENT
I express my sincere gratitude to my concerned teacher and guide Er.Harpreet Singh,
Assistant Professor, Department of CSE, for his valuable and inspiring guidance towards the
progress on the topic Android Google Maps App and providing valuable information for
the development of my report.
Last but not the least I express my sincere and hearty thanks to all those who have directly or
indirectly helped me in completing this seminar presentation and report successfully.
ii
ABSTRACT
This is a project report on Android Google Maps Application. During the developing of
this project we exploit, new ideas and functionality behind the working of a Android
Studio.Android Studio is an Official tool for developing Android apps.
This project is the output of our planning, schedule, programming skill and the hard work,
and this report reflects our steps taken at various levels of programming skill, planning and
schedule. We have leant a lot during this project and liked the improvement in our testing
skills and deep concept related to these kinds of projects.
Android Google Maps Application is a mobile based Android application which helps to
find certain locations.
iii
TABLE OF CONTENTS
TITLE
PAGE NO.
Candidate's Declaration................................................................................................................................i
Acknowledgement........................................................................................................................................ii
Abstract........................................................................................................................................................iii
Table of Contents.........................................................................................................................................iv
List of Figures...............................................................................................................................................v
Chapter 1
1. INTRODUCTION .................................................................................................................... 1
Chapter 2
iv
LIST OF FIGURES
FIGURE 1: Architecture of Android OS................................................................................................3
FIGURE 2: Conversion from .java to .dex file.......................................................................................5
FIGURE 3: Android Activity Life Cycle...............................................................................................9
Chapter 1
1. INTRODUCTION
Android is the first complete, open, and free mobile platform. Developers enjoy a comprehensive software
development kit, with ample tools for developing powerful, feature-rich applications. The platform is open
source, relying on tried-and-true open standards developers will be familiar with. And best of all, there are no
costly barriers to entry for developers: no required fees. (A modest fee is required to publish on third-party
distribution mechanisms such as the Android Market.) Android developers have numerous options for
distributing and commercializing their applications.
In 2008, the Open Handset Alliance announced the Android platform and launched a beta program for
developers. Android went through the typical revisions of a new platform. Several prerelease revisions of the
Android Software Development Kit (SDK) were released. The first Android handset (the T-Mobile G1) began
shipping in late 2008. Throughout 2009, more Android handsets and diverse types of devices powered by
Android reached world markets. As of this writing, there are more than 36 Android phones available from
carriers around the world. This number does not include the numerous Android tablet and e-book readers also
available, nor the dozens of upcoming devices already announced, nor the consumer electronics running Android.
The rate of new Android devices reaching the world markets has continued to increase. In the United States, all
major carriers now include Android phones in their product lines.
Google has been a contributing member of the Open Handset Alliance from the beginning. The company hosts
the Android open source project as well as the Android developer program at http://developer.android.com. This
developer website is your go-to site for downloading the Android SDK, getting the latest platform
documentation, and browsing the Android developer forums. Google also runs the most popular service for
selling Android applications to end users: the Android Market.
Android applications.The Android SDK and tools are freely available on the Android developer
website,http://developer.android.com.
Chapter 2
2. Features of Android OS
Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL
ES 1.0 specification (hardware acceleration optional)
Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC,
AMR, JPG, PNG, GIF)
Rich development environment including a device emulator, tools for debugging, memory and
performance profiling, and a plugin for the Eclipse IDE
Chapter 3
3.1 Android Architecture
A rich and extensible set of Views that can be used to build an application, including lists,
grids, text boxes, buttons, and even an embeddable web browser
Content Providers that enable applications to access data from other applications (such as
Contacts), or to share their own data
A Notification Manager that enables all applications to display custom alerts in the status bar
An Activity Manager that manages the life cycle of applications and provides a common
navigation backstack
Android includes a set of core libraries that provides most of the functionality available in the core
libraries of the Java programming language. Every Android application runs in its own process, with its
own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs
efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for
minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language
compiler that have been transformed into the .dex format by the included "dx" tool. The Dalvik VM relies
on the Linux kernel for underlying functionality such as threading and low-level memory management.
At the same level there is Android Runtime, where the main component Dalvik Virtual Machine is located.
It was designed specifically for Android running in limited environment, where the limited battery, CPU,
memory and data storage are the main issues. Android gives an integrated tool dx, which converts
generated byte code from .jar to .dex file, after this byte code becomes much more efficient to run on the
small processors.
As the result, it is possible to have multiple instances of Dalvik virtual machine running on the
single device at the same time. The Core libraries are written in Java language and contains of the
collection classes, the utilities, IO and other tools.
Android Architecture is based on Linux 2.6 kernel. It helps to manage security, memory management,
process management, network stack and other important issues. Therefore, the user should bring Linux in his
mobile device as the main operating system and install all the drivers required in order to run it. Android provides
the support for the Qualcomm MSM7K chipset family. For instance, the current kernel tree supports Qualcomm
MSM 7200A chipsets, but in the second half of 2008 we should see mobile devices with stable version
Qualcomm MSM 7200, which includes major features:
Chapter 4
A foreground process is one holding an Activity at the top of the screen that the user is interacting
with (its onResume () method has been called) or an IntentReceiver that is currently running (its onReceiveIntent
() method is executing). There will only ever be a few such processes in the system, and these will only be killed
as a last resort if memory is so low that not even these processes can continue to run. Generally at this point the
device has reached a memory paging state, so this action is required in order to keep the user interface responsive.
2.
A visible process is one holding an Activity that is visible to the user on-screen but not in the
foreground (its onPause() method has been called). This may occur, for example, if the foreground activity has
been displayed with a dialog appearance that allows the previous activity to be seen behind it. Such a process is
considered extremely important and will not be killed unless doing so is required to keep all foreground processes
running.
3.
A service process is one holding a Service that has been started with the startService() method.
Though these processes are not directly visible to the user, they are generally doing things that the user cares
about (such as background mp3 playback or background network data upload or download), so the system will
always keep such processes running unless there is not enough memory to retain all foreground and visible
process.
4.
A background process is one holding an Activity that is not currently visible to the user (its onStop()
method has been called). These processes have no direct impact on the user experience. Provided they implement
their activity life cycle correctly (see Activity for more details), the system can kill such processes at any time to
reclaim memory for one of the three previous processes types. Usually there are many of these processes running,
so they are kept in an LRU list to ensure the process that was most recently seen by the user is the last to be killed
when running low on memory.
5.
An empty process is one that doesn't hold any active application components. The only reason to
keep such a process around is as a cache to improve startup time the next time a component of its application
needs to run. As such, the system will often kill these processes in order to balance overall system resources
between these empty cached processes and the underlying kernel caches.
When deciding how to classify a process, the system picks the most important level of all the components
currently active in the process.
Android is a multi-process system, where each application (and parts of the system) runs in its own
process. Most security between applications and the system is enforced at the process level through standard
Linux facilities, such as user and group IDs that are assigned to applications. Additional finer-grained security
features are provided through a "permission" mechanism that enforces restrictions on the specific operations that
a particular process can perform.
Android mobile phone platform is going to be more secure than Apples iPhone or any other device in the
long run. There are several solutions nowadays to protect Google phone from various attacks. One of them is
security vendor McAfee, a member of Linux Mobile (LiMo) Foundation. This foundation joins particular
companies to develop an open mobile-device software platform. Many of the companies listed in the LiMo
Foundation have also become members of the Open Handset Alliance (OHA).
As a result, Linux secure coding practice should successfully be built into the Android development
process. However, open platform has its own disadvantages, such as source code vulnerability for black-hat
hackers. In parallel with great opportunities for mobile application developers, there is an expectation for
exploitation and harm. Stealthy Trojans hidden in animated images, particular viruses passed from friend to
friend, used for spying and identity theft, all these threats will be active for a long run.
Another solution for such attacks is SMobile Systems mobile package. Security Shield an integrated
application that includes anti-virus, anti-spam, firewall and other mobile protection is up and ready to run on the
Android operating system. Currently, the main problem is availability for viruses to pose as an application and do
things like dial phone numbers, send text messages or multi-media messages or make connections to the Internet
during normal device use. It is possible for somebody to use the GPS feature to track a persons location without
their knowledge. Hence SMobile Systems is ready to notify and block these secure alerts. But the truth is that it is
not possible to secure r mobile device or personal computer completely, as it connects to the internet. And neither
the Android phone nor other devices will prove to be the exception.
10
Android Emulator
A virtual mobile device that runs on computer use the emulator to design, debug, and test r applications in an
actual Android run-time environment.
Android Studio
Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. Otop of the
capabilities you expect from IntelliJ, Android Studio offers:
Rich layout editor with support for drag and drop theme editing
The adb tool lets install application's .apk files on an emulator or device and access the emulator or device from a
command line. can also use it to link a standard debugger to application code running on an Android emulator or
device.
The aapt tool lets create .apk files containing the binaries and resources of Android applications.
11
Aidl Lets generate code for an interprocess interface, such as what a service might use.
SQLITE
Included as a convenience, this tool lets access the SQLite data files created and used by Android applications.
Trace view
This tool produces graphical analysis views of trace log data that can generate from r Android application.
mksdcard
Helps create a disk image that can use with the emulator, to simulate the presence of an external storage card
(such as an SD card).
dx
The dx tool rewrites .class bytecode into Android bytecode (stored in .dex files.)
activityCreator
A script that generates Ant build files that can use to compile r Android applications. If are developing on
Eclipse with the ADT plugin, won't need to use this script.
12
Chapter 5
5.1 ABOUT PROJECT
13
14
Enable/Disable zoom
You
can
also
enable
or
disable
the
zoom
gestures
in
the
map
by
thesetZoomControlsEnabled(boolean) method.
googleMap.getUiSettings().setZoomGesturesEnabled(true);
15
calling
You
will
use
Android
studio
to
create
an
Android
application
under
package
com.example.sairamkrishna.myapplication. While creating this project, make sure you Target SDK and Compile
With at the latest version of Android SDK to use higher levels of APIs.
3
Run the application and choose a running android device and install the application on it and verify the
results
16
Log.i("Places", places.toString());
arrayAdapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, places);
listView.setAdapter(arrayAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent i = new Intent(getApplicationContext(), MapsActivity.class);
i.putExtra("locationInfo", position);
startActivity(i);
}
});
17
MapsActivity.java
} catch (IOException e) {
e.printStackTrace();
}
MainActivity.places.add(label);
MainActivity.locations.add(point);
mMap.addMarker(new MarkerOptions()
.position(point)
.title(label)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
18
setContentView(R.layout.activity_maps);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
provider = locationManager.getBestProvider(new Criteria(), false);
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
Intent i = getIntent();
location = i.getIntExtra("locationInfo", 1);
setUpMapIfNeeded();
client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}
@Override
protected void onPause() {
super.onPause();
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
{
return;
}
locationManager.removeUpdates(this);
}
private void setUpMapIfNeeded() {
if (mMap == null) {
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map))
.getMap();
mMap.setOnMapLongClickListener(this);.
if (mMap != null) {
setUpMap();
}
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
19
case android.R.id.home:
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
}
locationManager.removeUpdates(this);
this.finish();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
Activity_maps.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
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.tvengers.tarun.maps.MapsActivity" />
20
CONCLUSION
Android is a truly open, free development platform based on Linux and open source. Handset makers can use
and customize the platform without paying a royalty.
A component-based architecture inspired by Internet mash-ups. Parts of one application can be used in another
in ways not originally envisioned by the developer can even replace built-in components with own improved
versions. This will unleash a new round of creativity in the mobile space.
21
REFERENCES
1. White paper for A Spectrum White Paper: Thoughts on Google Android from Spectrum data
Technology. http://www.spectrumdt.com
2. http://code.google.com/android/ - Google Android official webpage
3. http://www.openhandsetalliance.com/ - Open Handset Alliance webpage
4. http://en.wikipedia.org/wiki/Android_(mobile_phone_platform)Wikipedia information
5. http://googleblog.blogspot.com/ - Official Google Blog
22