Mobile Devices Programming 2019
Mobile Devices Programming 2019
consultations:
on every Wednesday at 4:45 pm
how to complette the course
final result will be based on:
laboratory lecture
lab task or project challenges
(more then 50% completed) (2 of 3 completed )
presentation :
max 15 minuts on lecture or laboratory
max 5 slides
reasons for choosing a android application
functionality
popularity
your inspirations base on this application
android inspiration - exapmle
external presentation …
final exam, test and project terms
laboratory – final tests
the last laboratory, Nowember, 2019
project presentation deadline:
the last laboratory, November, 2019
lecture – final oral exam
the next to last lecture, January, 2020
final oral exam rules
3 questions
result:
1 correct answer - 3
2 correct answers -4
3correct answers -5
results and makeup exams terms
laboratory
during the exam session, January/February,2020
lecture
the last lecture, January, 2020
textbook - en
Satya Komatineni, Dave MacLean, Sayed Hashimi: Pro Android 3 –
Android 3 platform SDK techniques for developing smartphone and table apps,
Apress, 2011
--------------------------------------------------------------------------------------------------------------------
Ian F. Darwin, Android Cookbook:
Problems and Solutions for Android Developers
O’REILLY, 2017
----------------------------------------------
Dawn Griffiths, David Griffiths, Android. Programowanie aplikacji. Helion 2015
useful tools - web sites
http://developer.android.com
excellent training platform for android developers
method
name parameter, atributes list
class MyClass
{
…
private int MyMethod(int num1, int num2)
{
int minValue = num1 < num2 ? num1 : num2;
return minValue;
}
…
}
Java - create and use an Object
in Java, an object is created from a class
when we had already created the class named MyClass,
so now we can use this to create objects.
to create an object of MyClass, specify the class name, followed by the object name, and use
the keyword new:
public class MyClass {
int x = 5;
the return type of a method indicates the type of value that the method sends back to the
calling location
a method that does not return a value has a void return type
<root>
<child attributeName= "attributeValue">
<subchild>.....</subchild>
</child>
<!-- This is a comment -->
</root>
https://developer.android.com/sdk
IDE - configuration
JAVA – optional - only if needed
if we get a error message about the lack of path to JDK we need to add it to the
environment variables JAVA_PATH for jdk java:
EN
Start menu > Computer > System Properties > Advanced System Properties. Then
open Advanced tab > Environment Variables and add a new system variable
JAVA_HOME that points to your JDK folder, for example C:\Program
Files\Java\jdk1.7.0_21.
PL
Start\Ten Komputer\Właściwości\Zaawansowane ustawienia systemu\Zmienne
środowiskowe\ po średniku, dodać ścieżkę do katalogu z \JAVA\SDK\bin\ np.:
;d:\JAVA\SDK\bin\
android – your first application
1. create a new Android Studio project
NOTE – IMPORTANT !
PackageName – the package name serves as the application identifier and
must be unique. This identifier will also be used to identify the application
in GooglePlay. So you can't use names that someone has previously used or
reserved, e.g.. com.google, com.android, com.example.
CreateActivity - in the project creation window, you must also select the
CreateActivity activity and enter its name. By default, Android will launch
this activity first when you start the application, but you can change it in the
launch configuration.
first app - min SDK version
The next window for the application appears, we choose Phone and Tablet and the minimum SDK version of
Android
SDK directory
localisation→
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="7" />
manifest – the main application descriptor
The manifest also includes settings for the <activity
android:name=".MainActivity"
application, e.g.
android:label="@string/app_name" >
list of used windows <intent-filter>
main application window <action
android:name="android.intent.action.MAIN" />
used system components, e.g. SMS
<category
identifiers for Google Play android:name="android.intent.category.LAUNCHER" />
</intent-filter>
in the example on the left we can see two
</activity>
windows, two activity markers -->
<activity
android:name=".ListActivity"
android:label="@string/title_activity_list" >
</activity>
android – controls 1
Layout - group of controls for arrangement of elements on the window :
Widgets – basic user interface controls (buttons, bars, fields)
android – controls 2
Date & Time – date and time controls
Text Fields – text fields
Expert – specialized controls
Containers – containers, lists, views
android - notyfication
There are several ways to notify and display messages:
Toast Toast.makeText(this, “Notification text”, Toast.LENGTH_SHORT).show();
builder.setMessage(R.string….
Notification .setPositiveButton(...
.setNegativeButton(...
android – button handling
We add a button, we give it a button1 identifier.
In MainActivity.java we add a method, e.g. ShowMessageButton.
Now in the newly created method we create a reference to our object.
Button btn1 = (Button) findViewById (R.id.button1);
Note: in the case of a declaration of a class object for which we do not have an
imported package to import the missing package
just select the object and use Alt + Enter ----->
The most important when handling events is to listen - Listener, so you also need to
create an Listener (listener) of events, e.g. clicking on the button.
btn1.setOnClickListener(new View.OnClickListener()
android – button - example
the whole method will look like this:
ShowMessageButton();
}
android - menu
there are two type menus on Android:
- the main application menu, available under the menu button
- context menu, accessible after pressing an application element, e.g. window, fields.
the main methods:
onCreateOptionsMenu
onOptionsItemSelected
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/menuGroup_Main">
<item android:id="@+id/menu_start"
android:orderInCategory="10"
android:title="Start" />
<item android:id="@+id/menu_message" NOTE:
android:orderInCategory="20" It is worth numbering the menu not every one so that you
android:title= " message from menu" /> can sometime add items between the originally created
<item android:id="@+id/menu_exit"
order without renumbering the entire menu.
android:orderInCategory="30"
android: orderInCategory = "10"
android:title="Wyjście" />
</group>
</menu>
android - menu - java
We define support for menu buttons in the file ... \app\src\main\java\ ...
\MyActivityMenu.java
First, in the OnCreateOptionMenu method you need to load, associate with the program
the menu from the menu.xml file that we just created.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu, menu); // linking the menu with an xml file
return true;
}
NOTE: For the menu to be shown, the onCreateOptionsMenu method must return True.
R.menu.menu
R.string.value
android – menu – menu items added
programmatically
1. We add a menu variable in the main project class.
public class MainActivity extends ActionBarActivity {
Menu appMenu = null;
2. In the onCreateOptionsMenu method, we add a method for creating a program menu
this.appMenu = menu;
AddRegularMenuItem(menu);
…
3. And in the AddRegularMenuItem method we add an item to the menu
private void AddRegularMenuItem(Menu menu) {
int base=Menu.FIRST;
menu.add(base,base,base," new program-added item ");
menu.add(base,100,100," new program-added item at the end of the list ");
}
Android – menu – event handling
In the onOptionsItemSelected method, we support click events on given
menu buttons.
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_start) {
return true;
}else if (id == R.id.menu_message) {
TextView tv = new TextView(this); tv.setText("Message from Android App"); setContentView(tv);
}else if (id == R.id.menu_exit) {
finish();
}else if (id == 100) {
Toast.makeText(MainActivity.this, " You pressed the program-added menu item ",
Toast.LENGTH_LONG).show();
}
return super.onOptionsItemSelected(item);
}
android – context menu
the context menu is launched in the context of an contrlos (button, view, text field, etc.)
NOTE: is necessary by holding your finger on a given element for longer.
the context menu does not support submenus.
<TextView
android:id=“@+id/componentName” Table Layout
android:layout_width=“fill_parent”
android:layout_height=“wrap_content”
android:text=“Text that will be displayed.”
/>
</LinearLayout>
android – activity lifecycle
• Open
• Create
• Start\Restart
• Resume
• Running
• Pouse
• Stop\Kill
• Destroy
• Shut Down
android – intent
intent is Intention to do something
the intention is an abstract description of the actions or actions to be carried out
the intention allows you to decide for which component (Activity, Service, Recipient of
content) trigger what action or share what data.
Intentions enable communication between controls
- send messages and packets - bundle
- receiving messages
Example:
the intention to launch another window from the level of the window in which we are
currently located:
Important methods:
Intent intent = new Intent(this, GaleryActivity.class);
startActivity(intent)
android – additional activities - fragments
we add new windows in the application
through the context menu on the app
project -> New -> Android Activity and
select TabbedActivity, let's call it
Main2Activity.
let's choose the Swipe View (ViewPager)
Navigation Style, i.e. the window with a
finger gesture with the fragment name
as the parent class - HerarchicalParent let's
not set anything, we will change later.
android – additional activities - fragments
In the Main2Activity.java file, let's change that our class inherits from Activity and not
ActionBarActivity.
Now let's call this window from the context menu, we change the name of the context
menu element:
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
menu.add(200, 200, 200, "fragment window");
}
android – additional activities - fragments
transferring data between activities
we also transfer data to the second window using the intent.
in the window from which we want to transfer data, we use the puntExtra method,
after creating the intention and before calling the window to which we transfer data:
Intent i = getIntent();
Bundle b = i.getExtras();
String pt = b.getString("tekst");
@Override
public boolean onContextItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == 200) {
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.SEND_SMS"/>
also in the Manifest, in the <application> section we add SMS receiving actions
<receiver android:name="com.innovatio.pb
android:enabled="true">
.smskeeper.SMSListener"
<intent-filter android:priority=”123">
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
android – hardware –SMS - example
Next, we add the SendMessageButton () SMS sending method after the OnCreate method.
while the SendMessageButton () method is called in the OnCreate method :
} catch (Exception e) {
Toast.makeText(getApplicationContext()," Failed to send SMS ",Toast.LENGTH_LONG).show();
e.printStackTrace();
}
}
}); }
android – hardware –SMS - example
receiving SMS is a bit more difficult and based on the BroadcastReceiver class - the message receiver:
public class SMSListener extends BroadcastReceiver {
public void onReceive(Context context, Intent intent) {
final Bundle bundle = intent.getExtras();
try {
if (bundle != null) {
final Object[] pdusObj = (Object[]) bundle.get("pdus");
for (int i = 0; i < pdusObj.length; i++) {
SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]);
String phoneNumber = currentMessage.getDisplayOriginatingAddress();
String message = currentMessage.getDisplayMessageBody();
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, "Sender: "+ phoneNumber + ", Message: " + message , duration);
toast.show(); // <--- displaing the received message on the screen
}
}
} catch (Exception e) { Log.e("SmsReceiver", "Exception smsReceiver" +e); }
}
}
android – hardware –SMS
but this is not enough, you must add a local variable of the SMSListener class in the
MainActivity main class:
it basically starts the listening session and when any message arrives, the onReceive
method from the SMSReceiver class will be started.
android – hardware - telephone
to make a program call, you must add permission to make calls and listen to the
phone status:
b1=(Button)findViewById(R.id.button);
iv=(ImageView)findViewById(R.id.imageView);
b1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(intent, 0);
}
});
android-hardware-photo camera-example
we are still creating a camera operation method - displaying the photo taken:
let's not forget to add a button and a control displaying ImageView in the main class
variables:
Button b1;
ImageView iv;
android-hardware-photo camera-example
We create a new method for video recording:
private void recordVideo() {
Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
fileUri = getOutputMediaFileUri(MEDIA_TYPE_VIDEO);
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);
videoPreview.setVisibility(View.VISIBLE);
videoPreview.setVideoPath(fileUri.getPath());
// start recording
videoPreview.start();
} catch (Exception e) {
e.printStackTrace();
}
}
android –hardware - WIFI
To enable communication via a WIFI wireless network, it is necessary to set in the manifest permission
to access the network and read the network status:
WifiManager :
addNetwork (WifiConfiguration config) - adds a new WIFI network
createWifiLock (String tag) - methods for connecting to a WIFI network
disconnect () - disconnect the connection to the WIFI network
getWifiState () - get the WIFI network status
isWifiEnabled () - checking the availability of the WIFI network
android – databases
SQLite - native database
MS SQL – SQL server database
FireBase - cloud base
android – native database - SQLite
the SQLite database is a native part of the system
XML database
we don't need JDBC or ODBC drivers to connect to the android database SQLite
important methods:
MyDatabase - constructor
onCreate - creating a database
executeSQL - execute any SQL command
Cursor - cursor on records read from the database
android – database SQLite
/* creating a database object */ import android.database.Cursor;
MyDatabase mydb = new MyDatabase(this);
/* reading data from the database to the cursor */
db.execSQL(
/* necessary packages */ "create table students("
import android.database.sqlite.SQLiteDatabase; + "StudentId integer primary key autoincrement"
+ ", Name text"
import android.database.sqlite.SQLiteOpenHelper; + ", Surname text"
import android.content.Context; + ", IndexNumber text"
+");"
);
/*constructor*/
public MyDatabase (Contex context){ … and we should create the onUpgrade method to change the database
super(context, "students.db", null, 1); version:
} @Override
public void onUpgrade(SQLiteDatabase db, int oldVerion, int newVersion){
}
android – create a new methods
then we add a method to the record to the database to the MyDatabase class:
public void AddStudent(String Name, String Surname, String IndexNumber){
SQLiteDatabase db = getWritableDatabase(); //handle to the database for writing ContentValues
student = new ContentValues();
student.put("Name", Name);
student.put("Surname", Surname);
student.put("IndexNumber",IndexNumber);
//db.insertOrThrow("students", null, student);
db.insert("students", null, student);
}
and we still lack the method to read the record from the database, which we also add to the MyDatabase class:
public Cursor getStudents(){
String[] collumns = {"StudentId", "Name", "Surname", "IndexNumber"};
SQLiteDatabase db = getReadableDatabase(); // handle to the database for reading
Cursor records = db.query("students", collumns, null, null, null, null, null );
return records;
}
android – database – use - writing
It's time to use our class to operate the database in the main class MainActivity.
At the class level, we declare a global variable:
MyDatabase mydb = new MyDatabase(this);
We add a button, EditText controls to enter the data we want to insert into the database.
In the onClick event, under the button we add support for saving a record from EditText
controls to our database.
tv.setMovementMethod(ScrollingMovementMethod.getInstance());
In this way, we have realised the recording and reading of data from the database.
android – database - from another side
Data can also be added to the database directly using the SQL INSERT command using the execSQL
method.
mydb.execSQL ("INSERT INTO student (number, name) VALUES ('" + strNumber + "', '" + strName + "');");
The AddStudent and getStudents methods use constructor methods to return handles to the
getWritableDatabase () and getReadableDatabase () databases. Wherein getWritableDatabase () returns
points to an open database for writing records. However, if you only needed to read data from the
database, just use the getReadableDatabase () method.
It is also worth paying attention to the query method available for the SQLiteDatabase db object. This
method provides all the options of the select command from SQL, where we can use such derectives as
distinct, group by, order by, having etc.
There is also a rawQuery method that lets you execute SELECT commands in the form of a query:
android – database - from another side
There is also a rawQuery method that lets you execute SELECT commands in the form of a
query:
SQLiteDatabase db = this.getWritableDatabase();
String selectQuery = " select department_id,count(1),min(salary) from hr.employees ";
Cursor c= db.rawQuery(selectQuery, null);
and reading data from the cursor is the same as for the query command:
while (c.moveToNext()){
tv.append("\n" + c.getString(0) + " " + c.getString(1) + " " + c.getString(2) + " " + c.getString(3) );
}
android – MS SQL database
connection class to connect to MS SQL Server:
ConnectionClass.java
public class ConnectionClass {
String ip = "192.168.0.100";
String classs = "net.sourceforge.jtds.jdbc.Driver";
String db = "Andro";
String un = "hitesh";
String password = "789";
}
ip - database server IP address
classs - class name with database driver
db - database name
un- user
NOTE: jdbc driver is required
android – database - from another side
The MyDatabase class created in this form is sufficient for basic database operation.
But let's add one more universal netoda that will allow us to perform any SQL command on
our basis:
public void executeSQL(String query ){
SQLiteDatabase db = getWritableDatabase();
db.execSQL( query );
}
We can add one record using the executeSQL method, which allows any SQL query to be
performed on our database:
mydb.executeSQL(
"insert into students(Name, Surname, IndexNumber) values('John','Smith','GB23432');"
);
android – MS SQL database - example
connection class - communication with the MS SQL
database:
@SuppressLint("NewApi")
public Connection CONN() { try {
StrictMode.ThreadPolicy policy = new Class.forName(classs);
StrictMode.ThreadPolicy.Builder() ConnURL = "jdbc:jtds:sqlserver://" + ip + ";"
.permitAll().build(); + "databaseName=" + db + ";user=" + un + ";password="
StrictMode.setThreadPolicy(policy); + password + ";";
Connection conn = null; conn = DriverManager.getConnection(ConnURL);
} catch (SQLException se) {
String ConnURL = null;
Log.e("ERRO", se.getMessage());
try } catch (ClassNotFoundException e) {
catch { Log.e("ERRO", e.getMessage());
... } catch (Exception e) {
} Log.e("ERRO", e.getMessage());
return conn; }
}
android – MS SQL – database - login
using the connection class:
plus packages:
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
android – Firebase - cloud database
writing the value to the database:
myRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String value = dataSnapshot.getValue(String.class);
Toast.makeText(MainActivity.this,"Value is: " + value,Toast.LENGTH_LONG).show();
@Override
public void onCancelled(DatabaseError error) {
Toast.makeText(MainActivity.this,"Failed to read value, error " +
error.toException(),Toast.LENGTH_LONG).show();
}
});
android – Firebase - cloud database
Database address: https://console.firebase.google.com/project/gpsdatabase-7e754/database/data/
operating on binary files still requires setting a file format or compression method:
but you can also read data directly from the stream :
InputStream is = this.getResource().openRawResource(R.raw.some_raw_file);
android – sensors
accelerometer
gyroscope
magnetic field
light
proximity
gesture sensor
temperature
barometer
android – sensors
necessary packages to support the sensors:
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
list of all sensors used:
getSensorList()
control class, sensor support:
SensorManager
mSens = mSensorManager.getDefaultSensor (Sensor.TYPE _...);
important methods:
onSensorChanged ()
onAccuracyChanged () <- method required
onResume ()
OnPause ()
android – accelerometer
type:
TYPE_ACCELEROMETER
return values:
values[3] – acceleration in x, y axes, z in square meters per second
constant:
GRAVITY_EARTH, GRAVITY_JUPITER,
GRAVITY_MARS, GRAVITY_MERCURY,
GRAVITY_MOON, GRAVITY_NEPTUNE
android - gyroscope
type:
Sensor. TYPE_GYROSCOPE
return values:
values[] = matrix of device rotation in radians
constant:
without
pressure:
type:
Sensor.TYPE_PRESSURE
return value:
values[0] = pressure in pascal (Pa)
android – magnetic field sensor
type:
Sensor.TYPE_MAGNETIC_FIELD
return value:
values[3] = magnetic field in X, Y and Z axes measured in uT
constants:
MAGNETIC_FIELD_EARTH_MAX: 60.0
MAGNETIC_FIELD_EARTH_MIN: 30.0
android –accelerometer – use - example
accelerometer use should start by adding the appropriate permissions to the manifest in the main
element:
the activity element should also block screen rotation, as this may cause an application error:
and add the service supporting the sensor in the OnCreate method, in our case the
accelerator type:
mSensorManager = (SensorManager) getSystemService (Context.SENSOR_SERVICE);
mAccelerometer = mSensorManager.getDefaultSensor (Sensor.TYPE_ACCELEROMETER);
android –accelerometer – use - example
then we add two methods:
onAccuracyChanged - responding to changes in sensor accuracy
onSensorChanged - reacting to the change of the measured value
NOTE: The first onAccuracyChanged method may be empty but must appear
@Override
public final void onAccuracyChanged (Sensor sensor, int accuracy)
{
// this method may be empty but must appear
}
android –accelerometer – use - example
The onSensorChanged method responds to the change of the measured value:
@Override
public final void onSensorChanged(SensorEvent event)
{
float x = event.values[0];
float y = event.values[1];
float z = event.values[2];
@Override
protected void onResume ()
{
super.onResume ();
mSensorManager.registerListener (this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause () {
super.onPause ();
mSensorManager.unregisterListener (this);
}
NOTE: SENSOR_DELAY_NORMA sensor reading frequency may turn out to be too fast for a given eye,
then you need to change to SENSOR_DELAY_UI
android –sensors list - example
to get a list of all sensors from your smartphone we need
to do:
1 - import packages:
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.ArrayAdapter;
import android.widget.ListView;
android –sensors list - example
2- in the main activity class we declare variables:
SensorManager smm;
List <Sensor> sensor;
ListView lv;
we drag and drop the ListView control onto the window and we call it listView1
and linking with variable lv on the method onCreate :
lv = (ListView) findViewById (R.id.listView1);
android –sensors list - example
in addition in the onCreate method we add:
if we want to display only the names and type of sensors, we must add:
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key" />
android – google maps – use
With Google Maps Activity selected, a method supporting onMapReady maps is automatically created.
By default, this method sets the map position for Sydney, Australia.
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
and in MainActivity.java we add a method with the current GPS position collector - LOCATION_SERVICE:
Finally, you only have to add the showCurrentLocationOnMap method to set our current GPS
position on the map
android – gogle maps – current location
private void showCurrentLocationOnMap(Location location){
mMap.clear();
LatLng currentPosition = new LatLng(location.getLatitude(),location.getLongitude());
mMap.addMarker(new MarkerOptions()
.position(currentPosition)
.snippet( location.getLatitude() + "'N " + location.getLongitude()+"'E")
.flat(true)
.title(„My current location"));
// zoom z dokładnością co do budynku
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(currentPosition, 18));
}
android – google maps – view control
camera view settings: build - constructor
target - target, location
zoom scale: an example view definition will look like
1: the whole world this:
5: continents static final CameraPosition LUBLIN =
new CameraPosition.Builder()
10: cities
.target(lublin)
15: streets .zoom(20)
20: buildings .bearing(90)
bearing - orientation, map rotation .tilt(60)
.build();
tilt - angle of view
android – google maps – view control
we can activate controls on our map: we declare a variable
control lights, such as: private UiSettings mUiSettings;
zoom ...
compass
current position we set the visibility of controls on the map in
moving the map (by gestures) any method with map support:
zooming the map (by gestures) mUiSettings = mMap.getUiSettings();
angle adjustment (with gestures) mUiSettings.setZoomControlsEnabled(true);
rotating map (with gestures) mUiSettings.setCompassEnabled(true);
mUiSettings.setMyLocationButtonEnabled(true);
mUiSettings.setScrollGesturesEnabled(true);
to do this, we need to import the package: mUiSettings.setZoomGesturesEnabled(true);
import com.google.android.gms.maps.UiSettings; mUiSettings.setTiltGesturesEnabled(true);
mUiSettings.setRotateGesturesEnabled(true);
android – google maps types
Google Maps provides us with 4 types of maps:
MAP_TYPE_NORMAL – road map
MAP_TYPE_SATELLITE – satellite map
MAP_TYPE_HYBRID - hybrid, road + satellite map
MAP_TYPE_TERRAIN – terrain map
the map type is set by the method: setMapType
mMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);