Android Service. Lecture 19

Size: px
Start display at page:

Download "Android Service. Lecture 19"

Transcription

1 Android Service Lecture 19

2 Services Service: A background task used by an app. Example: Google Play Music plays the music using a service Example: Web browser runs a downloader service to retrieve a file Example: Chat app listens for new messages to come in and alerts the user, even if the user is not actively using the chat app Useful for long-running tasks, and/or providing functionality that can be used by other applications Android has two kinds of services: intent services: For shorter jobs; app launches them via intents. standard services: For longer jobs; remains running after app closes. When/if the service is done doing work, it can broadcast this information to any receivers who are listening.

3 Services Services, like other application objects, run in the main thread of their hosting process. This means that, if your service is going to do any CPU intensive (such as MP3 playback) or blocking (such as networking) operations, it should spawn its own thread in which to do that work. Each service class must have a corresponding <service> declaration in its package's AndroidManifest.xml. Services can be started with Context.startService() and Context.bindService().

4 Services Multiple calls to Context.startService() do not nest (though they do result in multiple corresponding calls to the onstart() method of the Service class), so no matter how many times it is started a service will be stopped once Context.stopService() or stopself() is called. A service can be started and allowed to run until someone stops it or it stops itself. Only one stopservice() call is needed to stop the service, no matter how many times startservice() was called.

5 Services A service is started by an app's activity using an intent. Service operation modes: start: The service keeps running until it is manually stopped we'll use this one bind: The service keeps running until no "bound" apps are left Service has similar methods to activities for lifecycle events - oncreate, ondestroy

6

7 Service Life Cycle Like an activity, a service has lifecycle methods that you can implement to monitor changes in its state. But they are fewer than the activity methods only three and they are public, not protected: void oncreate () void onstart (Intent intent) void ondestroy ()

8 Service Life Cycle The entire lifetime of a service happens between the time oncreate() is called and the time ondestroy() returns. Like an activity, a service does its initial setup in oncreate(), and releases all remaining resources in ondestroy(). For example, a music playback service could create the thread where the music will be played in oncreate(), and then stop the thread in ondestroy().

9 Adding a service in Android Studio right-click your project's Java package click New Service Service

10 Service Class Template public class ServiceClassName extends Service { /* this method handles a single incoming request public int onstartcommand(intent intent, int flags, int id) { // unpack any parameters that were passed to us String value1 = intent.getstringextra("key1"); String value2 = intent.getstringextra("key2"); // do the work that the service needs to do... return START_STICKY; // stay running (stay live), always this public IBinder onbind(intent intent) { // if you need to bound service return null; // disable binding

11 AndroidManifest.xml To allow your app to use the service, add the following to your app's AndroidManifest.xml configuration: (Android Studio does this for you if you use the New Service option) The exported attribute signifies whether other apps are also allowed to use the service (true=yes, false=no)

12 AndroidManifest.xml <application...> <service android:name=".serviceclassname" android:enabled="true" android:exported="false" />

13 Starting a Service In your Activity class: Intent intent = new Intent(this, ServiceClassName.class); intent.putextra("key1", "value1"); intent.putextra("key2", "value2"); startservice(intent); // not startactivity! or if the same code is launched from a fragment: Intent intent = new Intent(getActivity(), ServiceClassName.class);...

14 Intent actions Often a service has several "actions" or commands it can perform Example: A chat service can send, receive,... Example: A music player service can play, stop, pause,... Android implements this with set/getaction methods in Intent In your Activity class: Intent intent = new Intent(this, ServiceClassName.class); intent.setaction("some constant string"); intent.putextra("key1", "value1"); startservice(intent); In your Service class: String action = intent.getaction(); if (action == "some constant string ) {... else {...

15 Broadcasting a result When a service has completed a task, it can notify the app by "sending a broadcast" which the app can listen for: As before, set an action in the intent to distinguish different kinds of results public class ServiceClassName extends Service public int onstartcommand(intent tent, int flags, int id) { // do the work that the service needs to do // broadcast that the work is done Intent done = new Intent(); done.setaction("action"); done.putextra("key1", value1);... sendbroadcast(done); return START_STICKY; // stay running

16 Broadcast Receiver Lifecycle A Broadcast Receiver is an application class that listens for Intents that are broadcast, rather than being sent to a single target application/activity. The system delivers a broadcast Intent to all interested broadcast receivers, which handle the Intent sequentially.

17 Broadcast Receiver

18 Registering a Broadcast Receiver You can either dynamically register an instance of this class with Context.registerReceiver() or statically publish an implementation through the <receiver> tag in your AndroidManifest.xml.

19 Listening for Broadcasts Set up your activity to be notified when certain broadcast actions occur. You must pass an intentfilter specifying the action(s)of interest public class ActivityClassName extends protected void oncreate(bundle savedinstancestate) {... IntentFilter filter = new IntentFilter(); filter.addaction("action"); registerreceiver(new ReceiverClassName(), filter); Note: the action need to match the broadcast s action.

20 Broadcast Receiver Lifecycle A broadcast receiver has a single callback method: void onreceive (Context curcontext, Intent broadcastmsg) When a broadcast message arrives for the receiver, Android calls its onreceive() method and passes it the Intent object containing the message The broadcast receiver is considered to be active only while it is executing this method. When onreceive() returns, it is inactive.

21 Receiving a broadcast Your activity can hear broadcasts using a BroadcastReceiver Any extra parameters in the message come from the service's intent Extend BroadcastReceiver with the code to handle the message public class ActivityClassName extends Activity {... private class ReceiverClassName extends BroadcastReceiver public void onreceive(context context, Intent intent) { // handle the received broadcast message...

22 AndroidManifest The manifest of applications using Android Services must include: A <service> entry for each service used in the application. If the application defines a BroadcastReceiver as an independent class, it must include a <receiver> clause identifying the component. In addition an <intent-filter> entry is needed to declare the actual filter the service and the receiver use.

23 <manifest...> <application <activity android:name=".myservicedriver2 > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <service android:name=.myservice2" /> <receiver android:name=.mybroadcastreceiver"> <intent-filter> <action android:name = "maozheng.action.goservice2" /> </intent-filter> </receiver> </application> </manifest>

24 Type of Broadcasts There are two major classes of broadcasts that can be received: Normal broadcasts (sent with Context.sendBroadcast) are completely asynchronous. All receivers of the broadcast are run in an undefined order, often at the same time. Ordered broadcasts (sent with Context.sendOrderedBroadcast) are delivered to one receiver at a time. As each receiver executes in turn, it can propagate a result to the next receiver, or it can completely abort the broadcast so that it won't be passed to other receivers. The order receivers run in can be controlled with the android:priority attribute of the matching intent-filter; receivers with the same priority will be run in an arbitrary order.

25 Summary Assume main activity wants to interact with a service called MyService3. The main activity is responsible for the following tasks: 1. Start the service called MyService3 Intent intentmyservice = new Intent(this, MyService3.class); Service myservice = startservice(intentmyservice); 2. Define corresponding receiver s filter and register local receiver IntentFilter mainfilter = new IntentFilter( maozheng.action.goservice3"); BroadcastReceiver receiver = new MyMainLocalReceiver(); registerreceiver(receiver, mainfilter); 3. Implement local receiver and override its main method public void onreceive(context localcontext, Intent callerintent)

26 Service methods Assume main activity wants to interact with a service called MyService3. The Service uses its onstart method to do the following: 1. Create an Intent with the appropriate broadcast filter (any number of receivers could match it) Intent myfilteredresponse = new Intent( maozheng.action.goservice3"); 2. Prepare the extra data ( myservicedata ) to be sent with the intent to the receiver(s) Object msg = some user data goes here; myfilteredresponse.putextra("myservicedata", msg); 3. Release the intent to all receivers matching the filter sendbroadcast(myfilteredresponse);

27 Cleaning up Assume main activity wants to interact with a service called MyService3. The main activity is responsible for cleanly terminating the service. Do the following 1. Assume intentmyservice is the original Intent used to start the service. Calling the termination of the service is accomplished by the method stopservice(new Intent(intentMyService) ); 2. Use the service s ondestroy method to assure that all of its running threads are terminated and the receiver is unregistered. unregisterreceiver(receiver);

28 Example 1 A very simple service ServiceExample1: The main application starts a service. The service prints lines on the LogCat until the main activity stops the service.

29 ServiceExample1 public class MainActivity extends AppCompatActivity { TextView txtmsg; Button btnstopservice; ComponentName service; Intent intentmyservice; txtmsg = (TextView) findviewbyid(r.id.txtmsg); intentmyservice = new Intent(this, MyService1.class); service = startservice(intentmyservice); btnstopservice = (Button) findviewbyid(r.id.btnstopservice); btnstopservice.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { try { stopservice((intentmyservice)); txtmsg.settext("after stopping Service: \n" + service.getclassname()); catch (Exception e) { Toast.makeText(getApplicationContext(), e.getmessage(), Toast.LENGTH_LONG).show(); protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); Toolbar toolbar = (Toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar);

30 public class MyService1 extends Service { public MyService1() public IBinder onbind(intent intent) { // TODO: Return the communication channel to the service. //throw new UnsupportedOperationException("Not yet implemented"); return public void oncreate() { super.oncreate(); Log.i( <MyService1-onCreate>", "I am public void onstart(intent intent, int startid) { super.onstart(intent, startid); Log.i ( <MyService1-onStart>", "I did something very public void ondestroy() { super.ondestroy(); Log.i ("<MyService1-onDestroy>", "I am dead-1");

31 <manifest > <application > <activity android:name=".mainactivity" <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <service android:name=".myservice1" android:enabled="true" android:exported="true"> </service> </application> </manifest> AndroidManifest.xml

32 LogCat <MyService1-onCreate>: I am alive-1! <MyService1-onStart>: I did something very quickly <MyService1-onDestroy>: I am dead-1

33 Another Example ServiceExample2 The main activity starts the service and registers a receiver. The service is slow, therefore it runs in a parallel thread its time consuming task. When done with a computing cycle, the service adds a message to an intent. The intent is broadcasted using the filter: maozheng.action.goservice3. A BroadcastReceiver (defined inside the main Activity) uses the previous filter and catches the message (displays the contents on the main UI ). At some point the main activity stops the service and finishes executing.

34 Layout <LinearLayout > <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:textsize="12sp"> </EditText> <Button android:layout_width="151dp" android:layout_height="wrap_content" android:text="stop Service"> </Button> </LinearLayout>

35 </manifest> AndroidManifest.xml <manifest xmlns:android=" package="com.example.maozheng.serviceexample2"> <application android:allowbackup="true" android:supportsrtl="true" <activity android:name=".mainactivity" <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <service android:name=".myservice3" android:enabled="true" android:exported="true"></service> </application>

36 MainActivity.java public class MainActivity extends AppCompatActivity { TextView txtmsg; Button btnstopservice; ComponentName service; Intent intentmyservice; BroadcastReceiver receiver;

37 protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); Toolbar toolbar = (Toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); txtmsg = (TextView) findviewbyid(r.id.txtmsg); intentmyservice = new Intent(this, MyService3.class); service = startservice(intentmyservice); txtmsg.settext("myservice3 started - (see DDMS Log)"); btnstopservice = (Button) findviewbyid(r.id.btnstopservice); btnstopservice.setonclicklistener(new View.OnClickListener() { public void onclick(view v) { try { stopservice(new Intent(intentMyService)); txtmsg.settext("after stopping Service: \n" + service.getclassname()); catch (Exception e) { e.printstacktrace(); );

38 oncreate // register & define filter for local listener IntentFilter mainfilter = new IntentFilter("maozheng.action.GOSERVICE3"); receiver = new MyMainLocalReceiver(); registerreceiver(receiver, mainfilter);

39 unregister in protected void ondestroy() { super.ondestroy(); try { stopservice(intentmyservice); unregisterreceiver(receiver); catch (Exception e) { Log.e("MAIN3-DESTROY>>>", e.getmessage()); Log.e ("MAIN3-DESTROY>>>", "Adios" ); //ondestroy

40 Local Receiver Class inside the MainActivity // local (embedded) RECEIVER public class MyMainLocalReceiver extends BroadcastReceiver public void onreceive(context localcontext, Intent callerintent) { String servicedata = callerintent.getstringextra("servicedata"); Log.e ("MAIN>>>", servicedata + " -receiving data " + SystemClock.elapsedRealtime() ); String now = "\n" + servicedata + " --- " + new Date().toLocaleString(); txtmsg.append(now); //MyMainLocalReceiver

41 public void onstart(intent intent, int startid) { super.onstart(intent, startid); Log.e("<<MyService3-onStart>>", "I am alive-3!"); // we place the slow work of the service in its own thread // so the caller is not hung up waiting for us Thread triggerservice = new Thread (new Runnable(){ long startingtime = System.currentTimeMillis(); long tics = 0; public void run() { for(int i=0; (i< 120) & isrunning; i++) { //at most 10 minutes try { //fake that you are very busy here tics = System.currentTimeMillis() - startingtime; Intent myfilteredresponse = new Intent("maozheng.action.GOSERVICE3"); String msg = i + " value: " + tics; myfilteredresponse.putextra("servicedata", msg); sendbroadcast(myfilteredresponse); Thread.sleep(1000); //five seconds catch (Exception e){ e.printstacktrace(); //for //run ); triggerservice.start(); //onstart

42 public void ondestroy() { super.ondestroy(); Log.e ("<MyService3-onDestroy>", "I am dead-3"); isrunning = false; //Stop thread //ondestroy

43 Log.e ("MAIN>>>", servicedata + receiving data " + SystemClock.elapsedRealtime () ); E/MAIN>>>: 22 value: receiving data E/MAIN>>>: 23 value: receiving data E/MAIN>>>: 24 value: receiving data E/MAIN>>>: 25 value: receiving data E/MAIN>>>: 26 value: receiving data Screenshots

44 Service Example -- 3 DownLoad App Has an EditText and a Button, you can type things in the EditText area any time. The UI is available always When click the button, the app goes to a website to download a file and show it in the UI Uses an intent to start a background service so as not to disturb the UI FileService is a service After downloading file, send a broadcast The MainActivity has a broadcast receiver, will put the downloaded file content to the UI

45 MainActivity.java public class MainActivity extends AppCompatActivity { EditText protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); downloadededittext = (EditText) findviewbyid(r.id.downloadededittext); // Allows user to track when an intent with the id TRANSACTION_DONE is executed // We can call for an intent to execute something and then tell user when it finishes IntentFilter intentfilter = new IntentFilter(); intentfilter.addaction(fileservice.transaction_done); // Prepare the main thread to receive a broadcast and act on it registerreceiver(downloadreceiver, intentfilter); // oncreate

46 BroadcastReceiver // BroadcastReceiver : Acts when a specific broadcast is made // Is alerted when the IntentService broadcasts TRANSACTION_DONE private BroadcastReceiver downloadreceiver = new BroadcastReceiver() { // Called when the broadcast is public void onreceive(context context, Intent intent) { Log.e("FileService", "Service Received"); showfilecontents(); ;

47 // Will read our local file and put the text in the EditText public void showfilecontents(){ // Will build the String from the local file StringBuilder sb; try { // Opens a stream so we can read from our local file FileInputStream fis = this.openfileinput("myfile"); // Gets an input stream for reading data InputStreamReader isr = new InputStreamReader(fis, "UTF-8"); // Used to read the data in small bytes to minimize system load BufferedReader bufferedreader = new BufferedReader(isr); // Read the data in bytes until nothing is left to read sb = new StringBuilder(); String line; while ((line = bufferedreader.readline())!= null) { sb.append(line).append("\n"); // Put downloaded text into the EditText downloadededittext.settext(sb.tostring()); catch (FileNotFoundException e) { e.printstacktrace(); catch (UnsupportedEncodingException e) { e.printstacktrace(); catch (IOException e) { e.printstacktrace();

48 public void startfileservice(view view) { // Create an intent to run the IntentService in the background Intent intent = new Intent(this, FileService.class); // Pass the URL that the IntentService will download from intent.putextra("url", CS518Spring18/madlib1.txt ); // Start the intent service protected void onstop() { super.onstop(); unregisterreceiver(downloadreceiver);

49 layout <RelativeLayout > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="download File" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:onclick="startfileservice"/> <EditText android:layout_width="match_parent" android:layout_height="350dp" android:inputtype="textmultiline" android:ems="10" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_margintop="41dp" /> </RelativeLayout>

50 FileService.java // We use an IntentService to handle long running processes off the UI thread // Any new requests will wait for the 1st to end and it can't be interrupted public class FileService extends IntentService { // Used to identify when the IntentService finishes public static final String TRANSACTION_DONE = protected void onhandleintent(intent intent) { Log.e("FileService", "Service Started"); // Get the URL for the file to download String passedurl = intent.getstringextra("url"); downloadfile(passedurl); Log.e("FileService", "Service Stopped"); // Broadcast an intent back to MainActivity when file is downloaded Intent i = new Intent(TRANSACTION_DONE); FileService.this.sendBroadcast(i);

51 protected void downloadfile(string theurl) { // The name for the file we will save data to String filename = "myfile"; try{ // Create an output stream to write data to a file (private to everyone except our app) FileOutputStream outputstream = openfileoutput(filename, Context.MODE_PRIVATE); // Get File URL fileurl = new URL(theURL); // Create a connection we can use to read data from a url HttpURLConnection urlconnection = (HttpURLConnection) fileurl.openconnection(); // We are using the GET method urlconnection.setrequestmethod("get"); // Set that we want to allow output for this connection urlconnection.setdooutput(true); // Connect to the url urlconnection.connect(); // Gets an input stream for reading data InputStream inputstream = urlconnection.getinputstream(); // Define the size of the buffer byte[] buffer = new byte[1024]; int bufferlength = 0; // read reads a byte of data from the stream until there is nothing more while ( (bufferlength = inputstream.read(buffer)) > 0 ){ // Write the data received to our file outputstream.write(buffer, 0, bufferlength); // Close our connection to our file outputstream.close(); catch (FileNotFoundException e) { e.printstacktrace(); catch (IOException e) { e.printstacktrace();

52 Services and threading By default, a service lives in the same process and thread as the app that created it. This is not ideal for long-running tasks. If the service is busy, the app's UI will freeze up. To make the service and app more independent and responsive, the service should handle tasks in threads.

53 Android thread helper classes job (or message) queue: Common pattern in Android services. New jobs come in to the service via the app's intents. Jobs are "queued up in some kind of structure to be processed. The thread(s) process jobs in the order they came in. As jobs finish, results are broadcast back to the app

54 Android thread helper classes Android provides several classes to help implement multi-threaded job/message queues: Looper, Handler, HandlerThread, AsyncTask, Loader, CursorLoader,... advantages: easier to submit/finish jobs; easier synchronization; able to be canceled; support for thread pooling; better handling of Android lifecycle issues;...

55 HandlerThread HandlerThread : just a thread that has some internal data representing a queue of jobs to perform. Looper : Lives inside a handler thread and performs a long-running while loop that waits for jobs and processes them You can give new jobs to the handler thread to process via its looper HandlerThread hthread = new HandlerThread("name"); hthread.start(); Looper looper = hthread.getlooper();...

56 Handler Handler : Represents a single piece of code to handle one job in the job queue. When you construct a handler, pass the Looper of the handler thread in which the job should be executed. Submit a job to the handler by calling its post method, passing a Runnable object indicating the code to run Handler handler = new Handler(looper); handler.post(new Runnable() { public void run() { // the code to process the job... );

57 IntentService Android provides a class called IntentService (subclass of Service) that runs all of its tasks in a single extra thread. Great for a queue of long-running tasks to do one-ata-time Instead of overriding onstartcommand, use onhandleintent Creating an IntentService public class Name extends IntentService protected void onhandleintent(intent intent) {

Android Services. Victor Matos Cleveland State University. Services

Android Services. Victor Matos Cleveland State University. Services 22 Android Victor Matos Cleveland State University Notes are based on: Android Developers http://developer.android.com/index.html 22. Android Android A Service is an application component that runs in

More information

Services. service: A background task used by an app.

Services. service: A background task used by an app. CS 193A Services This document is copyright (C) Marty Stepp and Stanford Computer Science. Licensed under Creative Commons Attribution 2.5 License. All rights reserved. Services service: A background task

More information

App Development for Smart Devices. Lec #4: Services and Broadcast Receivers

App Development for Smart Devices. Lec #4: Services and Broadcast Receivers App Development for Smart Devices CS 495/595 - Fall 2012 Lec #4: Services and Broadcast Receivers Tamer Nadeem Dept. of Computer Science Objective Working in Background Services AsyncTask Student Presentations

More information

EMBEDDED SYSTEMS PROGRAMMING Android Services

EMBEDDED SYSTEMS PROGRAMMING Android Services EMBEDDED SYSTEMS PROGRAMMING 2016-17 Android Services APP COMPONENTS Activity: a single screen with a user interface Broadcast receiver: responds to system-wide broadcast events. No user interface Service:

More information

MOBILE APPLICATION DEVELOPMENT LECTURE 10 SERVICES IMRAN IHSAN ASSISTANT PROFESSOR

MOBILE APPLICATION DEVELOPMENT LECTURE 10 SERVICES IMRAN IHSAN ASSISTANT PROFESSOR MOBILE APPLICATION DEVELOPMENT LECTURE 10 SERVICES IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM Android Component A Service is an application component that runs in the background, not interacting

More information

Services. Marco Ronchetti Università degli Studi di Trento

Services. Marco Ronchetti Università degli Studi di Trento 1 Services Marco Ronchetti Università degli Studi di Trento Service An application component that can perform longrunning operations in the background and does not provide a user interface. So, what s

More information

Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5

Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5 1 Mobile Programming Practice Background processing AsynTask Service Broadcast receiver Lab #5 Prof. Hwansoo Han T.A. Sung-in Hong T.A. Minseop Jeong 2 Background processing Every Android app has a main

More information

Android. Broadcasts Services Notifications

Android. Broadcasts Services Notifications Android Broadcasts Services Notifications Broadcast receivers Application components that can receive intents from other applications Broadcast receivers must be declared in the manifest They have an associated

More information

Services. Background operating component without a visual interface Running in the background indefinitely

Services. Background operating component without a visual interface Running in the background indefinitely Services Background operating component without a visual interface Running in the background indefinitely Differently from Activity, Service in Android runs in background, they don t have an interface

More information

IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application.

IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application. Learning Unit Exam Project IPN-ESCOM Application Development for Mobile Devices. Extraordinary. A Web service, invoking the SOAP protocol, in an Android application. The delivery of this project is essential

More information

shared objects monitors run() Runnable start()

shared objects monitors run() Runnable start() Thread Lecture 18 Threads A thread is a smallest unit of execution Each thread has its own call stack for methods being invoked, their arguments and local variables. Each virtual machine instance has at

More information

Software Practice 3 Today s lecture Today s Task

Software Practice 3 Today s lecture Today s Task 1 Software Practice 3 Today s lecture Today s Task Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 MULTITHREAD IN ANDROID 3 Activity and Service before midterm after midterm 4 Java Thread Thread is an execution

More information

Thread. A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables.

Thread. A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables. 1 Thread A Thread is a concurrent unit of execution. The thread has its own call stack for methods being invoked, their arguments and local variables. Each virtual machine instance has at least one main

More information

Multiple Activities. Many apps have multiple activities

Multiple Activities. Many apps have multiple activities Intents Lecture 7 Multiple Activities Many apps have multiple activities An activity A can launch another activity B in response to an event The activity A can pass data to B The second activity B can

More information

Services. Marco Ronchetti Università degli Studi di Trento

Services. Marco Ronchetti Università degli Studi di Trento 1 Services Marco Ronchetti Università degli Studi di Trento Service An application component that can perform longrunning operations in the background and does not provide a user interface. So, what s

More information

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml

Understand applications and their components. activity service broadcast receiver content provider intent AndroidManifest.xml Understand applications and their components activity service broadcast receiver content provider intent AndroidManifest.xml Android Application Written in Java (it s possible to write native code) Good

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Entire Lifetime An activity begins its lifecycle when entering the oncreate() state If not interrupted

More information

INTRODUCTION TO ANDROID

INTRODUCTION TO ANDROID INTRODUCTION TO ANDROID 1 Niv Voskoboynik Ben-Gurion University Electrical and Computer Engineering Advanced computer lab 2015 2 Contents Introduction Prior learning Download and install Thread Android

More information

Broadcast receivers. Marco Ronchetti Università degli Studi di Trento

Broadcast receivers. Marco Ronchetti Università degli Studi di Trento 1 Broadcast receivers Marco Ronchetti Università degli Studi di Trento Bradcast receiver a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system for

More information

Introduction to Android Development

Introduction to Android Development Introduction to Android Development What is Android? Android is the customizable, easy to use operating system that powers more than a billion devices across the globe - from phones and tablets to watches,

More information

Android Fundamentals - Part 1

Android Fundamentals - Part 1 Android Fundamentals - Part 1 Alexander Nelson September 1, 2017 University of Arkansas - Department of Computer Science and Computer Engineering Reminders Projects Project 1 due Wednesday, September 13th

More information

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I)

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL I) Lecture 3: Android Life Cycle and Permission Android Lifecycle An activity begins its lifecycle when entering the oncreate() state If not

More information

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE)

PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE) PENGEMBANGAN APLIKASI PERANGKAT BERGERAK (MOBILE) Network Connection Web Service K Candra Brata andra.course@gmail.com Mobille App Lab 2015-2016 Network Connection http://developer.android.com/training/basics/network-ops/connecting.html

More information

Android UI Development

Android UI Development Android UI Development Android UI Studio Widget Layout Android UI 1 Building Applications A typical application will include: Activities - MainActivity as your entry point - Possibly other activities (corresponding

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 9 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs

EMBEDDED SYSTEMS PROGRAMMING Application Tip: Switching UIs EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Tip: Switching UIs THE PROBLEM How to switch from one UI to another Each UI is associated with a distinct class that controls it Solution shown: two UIs,

More information

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering

Getting Started. Dr. Miguel A. Labrador Department of Computer Science & Engineering Getting Started Dr. Miguel A. Labrador Department of Computer Science & Engineering labrador@csee.usf.edu http://www.csee.usf.edu/~labrador 1 Goals Setting up your development environment Android Framework

More information

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L

CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L CS 370 Android Basics D R. M I C H A E L J. R E A L E F A L L 2 0 1 5 Activity Basics Manifest File AndroidManifest.xml Central configuration of Android application Defines: Name of application Icon for

More information

Diving into Android. By Jeroen Tietema. Jeroen Tietema,

Diving into Android. By Jeroen Tietema. Jeroen Tietema, Diving into Android By Jeroen Tietema Jeroen Tietema, 2015 1 Requirements 4 Android SDK 1 4 Android Studio (or your IDE / editor of choice) 4 Emulator (Genymotion) or a real device. 1 See https://developer.android.com

More information

Services & Interprocess Communication (IPC) CS 282 Principles of Operating Systems II Systems Programming for Android

Services & Interprocess Communication (IPC) CS 282 Principles of Operating Systems II Systems Programming for Android Services & Interprocess Communication (IPC) CS 282 Principles of Operating Systems II Systems Programming for Android A Service is an application component that can perform longrunning operations in the

More information

Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26

Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26 Upcoming Assignments Quiz Friday? Lab 5 due today Alpha Version due Friday, February 26 Inject one subtle defect (fault seeding) To be reviewed by a few class members Usability study by CPE 484 students

More information

Services are software components designed specifically to perform long background operations.

Services are software components designed specifically to perform long background operations. SERVICES Service Services are software components designed specifically to perform long background operations. such as downloading a file over an internet connection or streaming music to the user, but

More information

Notification mechanism

Notification mechanism Notification mechanism Adaptation of materials: dr Tomasz Xięski. Based on presentations made available by Victor Matos, Cleveland State University. Portions of this page are reproduced from work created

More information

CS378 -Mobile Computing. Services and Broadcast Receivers

CS378 -Mobile Computing. Services and Broadcast Receivers CS378 -Mobile Computing Services and Broadcast Receivers Services One of the four primary application components: activities content providers services broadcast receivers 2 Services Application component

More information

EMBEDDED SYSTEMS PROGRAMMING Application Basics

EMBEDDED SYSTEMS PROGRAMMING Application Basics EMBEDDED SYSTEMS PROGRAMMING 2015-16 Application Basics APPLICATIONS Application components (e.g., UI elements) are objects instantiated from the platform s frameworks Applications are event driven ( there

More information

COMP61242: Task /04/18

COMP61242: Task /04/18 COMP61242: Task 2 1 16/04/18 1. Introduction University of Manchester School of Computer Science COMP61242: Mobile Communications Semester 2: 2017-18 Laboratory Task 2 Messaging with Android Smartphones

More information

An Overview of the Android Programming

An Overview of the Android Programming ID2212 Network Programming with Java Lecture 14 An Overview of the Android Programming Hooman Peiro Sajjad KTH/ICT/SCS HT 2016 References http://developer.android.com/training/index.html Developing Android

More information

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server.

CSE 660 Lab 7. Submitted by: Arumugam Thendramil Pavai. 1)Simple Remote Calculator. Server is created using ServerSocket class of java. Server. CSE 660 Lab 7 Submitted by: Arumugam Thendramil Pavai 1)Simple Remote Calculator Server is created using ServerSocket class of java Server.java import java.io.ioexception; import java.net.serversocket;

More information

LECTURE 12 BROADCAST RECEIVERS

LECTURE 12 BROADCAST RECEIVERS MOBILE APPLICATION DEVELOPMENT LECTURE 12 BROADCAST RECEIVERS IMRAN IHSAN ASSISTANT PROFESSOR WWW.IMRANIHSAN.COM Application Building Blocks Android Component Activity UI Component Typically Corresponding

More information

Tabel mysql. Kode di PHP. Config.php. Service.php

Tabel mysql. Kode di PHP. Config.php. Service.php Tabel mysql Kode di PHP Config.php Service.php Layout Kode di Main Activity package com.example.mini.webandroid; import android.app.progressdialog; import android.os.asynctask; import android.support.v7.app.appcompatactivity;

More information

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB)

Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB) Applied Cognitive Computing Fall 2016 Android Application + IBM Bluemix (Cloudant NoSQL DB) In this exercise, we will create a simple Android application that uses IBM Bluemix Cloudant NoSQL DB. The application

More information

Mobile and Ubiquitous Computing: Android Programming (part 3)

Mobile and Ubiquitous Computing: Android Programming (part 3) Mobile and Ubiquitous Computing: Android Programming (part 3) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Based on Programming Handheld Systems, Adam Porter, University

More information

Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza. Data persistence

Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza. Data persistence Eng. Jaffer M. El-Agha Android Programing Discussion Islamic University of Gaza Data persistence Shared preferences A method to store primitive data in android as key-value pairs, these saved data will

More information

UNDERSTANDING ACTIVITIES

UNDERSTANDING ACTIVITIES Activities Activity is a window that contains the user interface of your application. An Android activity is both a unit of user interaction - typically filling the whole screen of an Android mobile device

More information

Lesson 9. Android's Concurrency. Android's Concurrency Mechanisms... 3

Lesson 9. Android's Concurrency. Android's Concurrency Mechanisms... 3 Lesson 9. Android's Concurrency Android's Concurrency Mechanisms... 3 Android's Concurrency Mechanisms Lesson 9 Goals Handler AsyncTask The importance of multitasking. Multitasking: Pros and Cons Tools

More information

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters

Mobile Programming Lecture 5. Composite Views, Activities, Intents and Filters Mobile Programming Lecture 5 Composite Views, Activities, Intents and Filters Lecture 4 Review How do you get the value of a string in the strings.xml file? What are the steps to populate a Spinner or

More information

Software Practice 3 Before we start Today s lecture Today s Task Team organization

Software Practice 3 Before we start Today s lecture Today s Task Team organization 1 Software Practice 3 Before we start Today s lecture Today s Task Team organization Prof. Hwansoo Han T.A. Jeonghwan Park 43 2 Lecture Schedule Spring 2017 (Monday) This schedule can be changed M A R

More information

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 3. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 3 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MainActivity.java File package com.example.tutorialspoint; import android.manifest;

More information

Embedded Systems Programming - PA8001

Embedded Systems Programming - PA8001 Embedded Systems Programming - PA8001 http://goo.gl/ydeczu Lecture 8 Mohammad Mousavi m.r.mousavi@hh.se Center for Research on Embedded Systems School of Information Science, Computer and Electrical Engineering

More information

Import the code in the top level sdl_android folder as a module in Android Studio:

Import the code in the top level sdl_android folder as a module in Android Studio: Guides Android Documentation Document current as of 12/22/2017 10:31 AM. Installation SOURCE Download the latest release from GitHub Extract the source code from the archive Import the code in the top

More information

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs

MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Overview MVC Apps Basic Widget Lifecycle Logging Debugging Dialogs Lecture: MVC Model View Controller What is an App? Android Activity Lifecycle Android Debugging Fixing Rotations & Landscape Layouts Localization

More information

Android Activities. Akhilesh Tyagi

Android Activities. Akhilesh Tyagi Android Activities Akhilesh Tyagi Apps, memory, and storage storage: Your device has apps and files installed andstoredonitsinternaldisk,sdcard,etc. Settings Storage memory: Some subset of apps might be

More information

Real-Time Embedded Systems

Real-Time Embedded Systems Real-Time Embedded Systems DT8025, Fall 2016 http://goo.gl/azfc9l Lecture 8 Masoumeh Taromirad m.taromirad@hh.se Center for Research on Embedded Systems School of Information Technology 1 / 51 Smart phones

More information

Data Persistence. Chapter 10

Data Persistence. Chapter 10 Chapter 10 Data Persistence When applications create or capture data from user inputs, those data will only be available during the lifetime of the application. You only have access to that data as long

More information

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial

Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial Wireless Vehicle Bus Adapter (WVA) Android Library Tutorial Revision history 90001431-13 Revision Date Description A October 2014 Original release. B October 2017 Rebranded the document. Edited the document.

More information

Vienos veiklos būsena. Theory

Vienos veiklos būsena. Theory Vienos veiklos būsena Theory While application is running, we create new Activities and close old ones, hide the application and open it again and so on, and Activity can process all these events. It is

More information

Fragment Example Create the following files and test the application on emulator or device.

Fragment Example Create the following files and test the application on emulator or device. Fragment Example Create the following files and test the application on emulator or device. File: AndroidManifest.xml

More information

LifeStreet Media Android Publisher SDK Integration Guide

LifeStreet Media Android Publisher SDK Integration Guide LifeStreet Media Android Publisher SDK Integration Guide Version 1.12.0 Copyright 2015 Lifestreet Corporation Contents Introduction... 3 Downloading the SDK... 3 Choose type of SDK... 3 Adding the LSM

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Mobile Software Development for Android - I397

Mobile Software Development for Android - I397 1 Mobile Software Development for Android - I397 IT COLLEGE, ANDRES KÄVER, 2015-2016 EMAIL: AKAVER@ITCOLLEGE.EE WEB: HTTP://ENOS.ITCOLLEGE.EE/~AKAVER/2015-2016/DISTANCE/ANDROID SKYPE: AKAVER Timetable

More information

Android Basics. Android UI Architecture. Android UI 1

Android Basics. Android UI Architecture. Android UI 1 Android Basics Android UI Architecture Android UI 1 Android Design Constraints Limited resources like memory, processing, battery à Android stops your app when not in use Primarily touch interaction à

More information

Overview of Activities

Overview of Activities d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA CS 282 Principles of Operating Systems II Systems Programming

More information

Getting Started With Android Feature Flags

Getting Started With Android Feature Flags Guide Getting Started With Android Feature Flags INTRO When it comes to getting started with feature flags (Android feature flags or just in general), you have to understand that there are degrees of feature

More information

Outline. Admin. Example: TipCalc. Android: Event Handler Blocking, Android Inter-Thread, Process Communications. Recap: Android UI App Basic Concepts

Outline. Admin. Example: TipCalc. Android: Event Handler Blocking, Android Inter-Thread, Process Communications. Recap: Android UI App Basic Concepts Outline Android: Event Handler Blocking, Android Inter-Thread, Process Communications 10/11/2012 Admin Android Basic concepts Activity, View, External Resources, Listener Inter-thread communications Handler,

More information

Minds-on: Android. Session 2

Minds-on: Android. Session 2 Minds-on: Android Session 2 Paulo Baltarejo Sousa Instituto Superior de Engenharia do Porto 2016 Outline Activities UI Events Intents Practice Assignment 1 / 33 2 / 33 Activities Activity An activity provides

More information

Notifications and Services. Landon Cox March 28, 2017

Notifications and Services. Landon Cox March 28, 2017 Notifications and Services Landon Cox March 28, 2017 Networking so far Volley (retrieve quiz stored at URL) User starts app Check with server for new quiz Say you re building a messaging app How else might

More information

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device

Software Practice 3 Today s lecture Today s Task Porting Android App. in real device 1 Software Practice 3 Today s lecture Today s Task Porting Android App. in real device Prof. Hwansoo Han T.A. Jeonghwan Park 43 INTENT 2 3 Android Intent An abstract description of a message Request actions

More information

Solving an Android Threading Problem

Solving an Android Threading Problem Home Java News Brief Archive OCI Educational Services Solving an Android Threading Problem Introduction by Eric M. Burke, Principal Software Engineer Object Computing, Inc. (OCI) By now, you probably know

More information

<uses-permission android:name="android.permission.internet"/>

<uses-permission android:name=android.permission.internet/> Chapter 11 Playing Video 11.1 Introduction We have discussed how to play audio in Chapter 9 using the class MediaPlayer. This class can also play video clips. In fact, the Android multimedia framework

More information

Android Ecosystem and. Revised v4presenter. What s New

Android Ecosystem and. Revised v4presenter. What s New Android Ecosystem and Revised v4presenter What s New Why Mobile? 5B 4B 3B 2B 1B Landlines PCs TVs Bank users Mobiles 225M AOL 180M 135M 90M 45M 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Quarters

More information

Android Application Development. By : Shibaji Debnath

Android Application Development. By : Shibaji Debnath Android Application Development By : Shibaji Debnath About Me I have over 10 years experience in IT Industry. I have started my career as Java Software Developer. I worked in various multinational company.

More information

Android permissions Defining and using permissions Component permissions and related APIs

Android permissions Defining and using permissions Component permissions and related APIs Android permissions Defining and using permissions Component permissions and related APIs Permissions protects resources and data For instance, they limit access to: User information e.g, Contacts Cost-sensitive

More information

Android Services & Local IPC: The Command Processor Pattern (Part 1)

Android Services & Local IPC: The Command Processor Pattern (Part 1) : The Command Processor Pattern (Part 1) d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,

More information

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr.

Android Application Model I. CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Android Application Model I CSE 5236: Mobile Application Development Instructor: Adam C. Champion, Ph.D. Course Coordinator: Dr. Rajiv Ramnath 1 Framework Support (e.g. Android) 2 Framework Capabilities

More information

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar

Produced by. Mobile Application Development. Higher Diploma in Science in Computer Science. Eamonn de Leastar Mobile Application Development Higher Diploma in Science in Computer Science Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology

More information

Android Services & Local IPC: Overview of Programming Bound Services

Android Services & Local IPC: Overview of Programming Bound Services : Overview of Programming Bound Services d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,

More information

Lecture 2 Android SDK

Lecture 2 Android SDK Lecture 2 Android SDK This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a

More information

Podstawowe komponenty aplikacji, wymiana międzyprocesowa

Podstawowe komponenty aplikacji, wymiana międzyprocesowa Podstawowe komponenty aplikacji, wymiana międzyprocesowa Intencje. Budowanie intencji, komunikacja z wykorzystaniem intencji pomiędzy aktywnościami i aplikacjami. Obsługa powiadomień za pomocą klasy BroadcastReceiver.

More information

App Development for Android. Prabhaker Matet

App Development for Android. Prabhaker Matet App Development for Android Prabhaker Matet Development Tools (Android) Java Java is the same. But, not all libs are included. Unused: Swing, AWT, SWT, lcdui Android Studio (includes Intellij IDEA) Android

More information

Statistics http://www.statista.com/topics/840/smartphones/ http://www.statista.com/topics/876/android/ http://www.statista.com/statistics/271774/share-of-android-platforms-on-mobile-devices-with-android-os/

More information

Table of Content Android Tutorial... 2 Audience... 2 Prerequisites... 2 Copyright & Disclaimer Notice... 2 Overview... 7

Table of Content Android Tutorial... 2 Audience... 2 Prerequisites... 2 Copyright & Disclaimer Notice... 2 Overview... 7 Android Tutorial Table of Content Android Tutorial... 2 Audience... 2 Prerequisites... 2 Copyright & Disclaimer Notice... 2 Overview... 7 Features of Android... 7 Android Applications... 8 Environment

More information

Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time

Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time Tablets have larger displays than phones do They can support multiple UI panes / user behaviors at the same time The 1 activity 1 thing the user can do heuristic may not make sense for larger devices Application

More information

CMSC436: Fall 2013 Week 3 Lab

CMSC436: Fall 2013 Week 3 Lab CMSC436: Fall 2013 Week 3 Lab Objectives: Familiarize yourself with the Activity class, the Activity lifecycle, and the Android reconfiguration process. Create and monitor a simple application to observe

More information

The Broadcast Class Registration Broadcast Processing

The Broadcast Class Registration Broadcast Processing The Broadcast Class Registration Broadcast Processing Base class for components that receive and react to events BroadcastReceivers register to receive events in which they are interested When Events occur

More information

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license

Android. Mobile operating system developed by Google A complete stack. Based on the Linux kernel Open source under the Apache 2 license Android Android Mobile operating system developed by Google A complete stack OS, framework A rich set of applications Email, calendar, browser, maps, text messaging, contacts, camera, dialer, music player,

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 2 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 1 -recap What is Android How to develop Android applications Run & debug the applications

More information

Programming in Android. Nick Bopp

Programming in Android. Nick Bopp Programming in Android Nick Bopp nbopp@usc.edu Types of Classes Activity This is the main Android class that you will be using. These are actively displayed on the screen and allow for user interaction.

More information

Android Application Development

Android Application Development Android Application Development Octav Chipara What is Android A free, open source mobile platform A Linux-based, multiprocess, multithreaded OS Android is not a device or a product It s not even limited

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 - recap Views and Layouts Events Basic application components Activities Intents 9/15/2014

More information

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept.

MAD ASSIGNMENT NO 2. Submitted by: Rehan Asghar BSSE AUGUST 25, SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. MAD ASSIGNMENT NO 2 Submitted by: Rehan Asghar BSSE 7 15126 AUGUST 25, 2017 SUBMITTED TO: SIR WAQAS ASGHAR Superior CS&IT Dept. Android Widgets There are given a lot of android widgets with simplified

More information

Android Tutorial: Part 3

Android Tutorial: Part 3 Android Tutorial: Part 3 Adding Client TCP/IP software to the Rapid Prototype GUI Project 5.2 1 Step 1: Copying the TCP/IP Client Source Code Quit Android Studio Copy the entire Android Studio project

More information

Understanding Intents and Intent Filters

Understanding Intents and Intent Filters 255 Chapter 11 Understanding Intents and Intent Filters This chapter will delve into intents, which are messaging objects that carry communications between the major components of your application your

More information

Services Broadcast Receivers Permissions

Services Broadcast Receivers Permissions Services Broadcast Receivers Permissions Runs in the background Extends Service Java class Not necessarily connected to the user s visual interface Music player working in foreground User wants read email

More information

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology

Android App Development. Mr. Michaud ICE Programs Georgia Institute of Technology Android App Development Mr. Michaud ICE Programs Georgia Institute of Technology Android Operating System Created by Android, Inc. Bought by Google in 2005. First Android Device released in 2008 Based

More information

Activities. https://developer.android.com/guide/components/activities.html Repo: https://github.com/karlmorris/basicactivities

Activities. https://developer.android.com/guide/components/activities.html Repo: https://github.com/karlmorris/basicactivities Activities https://developer.android.com/guide/components/activities.html Repo: https://github.com/karlmorris/basicactivities Overview What is an Activity Starting and stopping activities The Back Stack

More information

Mobile User Interfaces

Mobile User Interfaces Mobile User Interfaces CS 2046 Mobile Application Development Fall 2010 Announcements Next class = Lab session: Upson B7 Office Hours (starting 10/25): Me: MW 1:15-2:15 PM, Upson 360 Jae (TA): F 11:00

More information

Tutorial: Setup for Android Development

Tutorial: Setup for Android Development Tutorial: Setup for Android Development Adam C. Champion CSE 5236: Mobile Application Development Autumn 2017 Based on material from C. Horstmann [1], J. Bloch [2], C. Collins et al. [4], M.L. Sichitiu

More information

Fragments. Lecture 11

Fragments. Lecture 11 Fragments Lecture 11 Situational layouts Your app can use different layouts in different situations Different device type (tablet vs. phone vs. watch) Different screen size Different orientation (portrait

More information

Mobile Application Development Android

Mobile Application Development Android Mobile Application Development Android Lecture 3 MTAT.03.262 Satish Srirama satish.srirama@ut.ee Android Lecture 2 -recap Views and Layouts Events Basic application components Activities Intents BroadcastReceivers

More information

ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS

ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS ANDROID SERVICES, BROADCAST RECEIVER, APPLICATION RESOURCES AND PROCESS 1 Instructor: Mazhar Hussain Services A Service is an application component that can perform long-running operations in the background

More information