PROFILE MANAGER ANDROID APPLICATION. A Project. Presented to the faculty of the Department of Computer Science

Size: px
Start display at page:

Download "PROFILE MANAGER ANDROID APPLICATION. A Project. Presented to the faculty of the Department of Computer Science"

Transcription

1 PROFILE MANAGER ANDROID APPLICATION A Project Presented to the faculty of the Department of Computer Science California State University, Sacramento Submitted in partial satisfaction of the requirements for the degree of MASTER OF SCIENCE in Computer Science by Sujata Patel SPRING 2015

2 PROFILE MANAGER ANDROID APPLICATION A Project by Sujata Patel Approved by:, Committee Chair Dr. Jinsong Ouyang, Second Reader Dr. V. Scott Gordon Date ii

3 Student: - Sujata Patel I certify that this student has met the requirements for format contained in the University format manual, and that this project is suitable for shelving in the Library and credit is to be awarded for the project., Graduate Coordinator Dr. Jinsong Ouyang Date Department of Computer Science iii

4 Abstract of PROFILE MANAGER ANDROID APPLICATION by Sujata Patel Nowadays Mobility is hot cake in the market so most of the consumer products are increasingly geared towards mobility and Location Based Services. In today s fast pace world we often depend upon technology to perform our trivial tasks. As we forget to lower our ringer in work environment or at time, forget to set it to loud or normal when we are back at home. To avoid missing important messages or phone calls, we need automation that will switch between profiles preset by users. The user will set ringtone, ringer volume level for different scenario and this should be in effect if certain conditions are met. To answer this we have an android-based application where user can not only change their phone profiles manually, but can also base on location, calendar event and time based schedules to change them automatically. Meeting Profile can set your mobile to silent mode by event. Night Profile can set based on time for example between 11 p.m. to 6 a.m., you can switch off the Mobile data, Wi-Fi, GPS and Bluetooth to save battery power., Committee Chair Dr. Jinsong Ouyang Date iv

5 ACKNOWLEDGEMENTS I would like to thank Dr. Jinsong Ouyang, my advisor for providing me an opportunity to work on this project, which significantly broadened my knowledge on Android Development. I thank him for continuously providing the feedback, help and support to complete the project successfully. In addition, I would like to thank Dr. Scott Gordon for his willingness to serve on the committee. Lastly, I would like to thank the entire faculty and staff of the Department of Computer Science Engineering at California State University, Sacramento. v

6 TABLE OF CONTENTS Tables Page Acknowledgements...v List of Figures... viii Chapter 1. INTRODUCTION PROJECT REQUIREMENTS User Options Profile Location Rules ANDROID DEVELOPMENT BASICS Application components Activities Fragments Services Content providers Broadcast receivers Saving Data Download and setup ADT bundle Creating an Android Project that displays Hello World Android Application Files vi

7 3.4.1 Java Files Layout Files Manifest File Running the application On device On Emulator FEATURES IMPLEMENTATION Software Architecture Application Home Screen Location Google Map Profile Android Preference API Rules Gson Parser Async Task Future Work CONCLUSION...50 References...51 vii

8 LIST OF FIGURES Figures Page Figure 2.1 Application Use Case Diagram... 3 Figure 2.2 Profile Use Case Diagram... 5 Figure 2.3 Location Use Case Diagram... 6 Figure 2.4 Rules Use Case Diagram... 8 Figure 3.1 Activity Lifecycle [1] Figure 3.2 Service Lifecycle [1] Figure 3.3 Configure Project In Eclipse Figure 3.4 Configure Attributes In Eclipse Figure 3.5 Android Virtual Device Manager Figure 3.6 Android Virtual Device Edit Figure 4.1 Profile Manager Architecture Figure 4.2 Home Screen Figure 4.3 Add Location Figure 4.4 Add Location Using Google Maps Figure 4.5 Profile List Tab Figure 4.6 Edit Profile Page Figure 4.7 Rules List Tab Figure 4.8 Rule Edit Page viii

9 1 Chapter 1 INTRODUCTION Do you turn your cellphone to its silent sound profile each time you visit your office? Alternatively, perhaps you do not want to be disturbed at night and turn the phone to silent a set time every night. We all make some sort of necessary regular changes to our phone s sound profile. If you forget to change the sound profile then something regretful can happen: for example, your phone could ring in the middle of an important meeting. I like the "Profiles" feature, with which I can set ringtone volume, GPS ON/OFF, Wi-Fi ON/OFF, etc. for different scenarios (work, home, traveling, etc.). However, I would prefer that my phone just "know" when and how to change profiles. E.g. at certain times of day on certain days of the week, it should be Profile 1. If I am at location X, it should switch to Profile 2. Here to ensure that your phone intelligently changes its sound profile based on the time and your location, is a smartphone application called Location and Time based Profile Manager. There you can do everything according to automatically switching the audioprofile in one App. You can define weekly schedules to switch to a given profile. You can schedule multiple start and end times (i.e. when you go to sleep etc.). It also offers calendar integration, where you can choose to switch to a certain mode at a defined event. These events can be chosen according to their calendar and/or keyword

10 2 based - I think this is very useful i.e. I can mute the phone if the word "meeting" is in the title and mute at all events in my work-calendar.

11 3 Chapter 2 PROJECT REQUIREMENTS 2.1 User Options By Using Profile Manager, the user can have the following options. 1. User can create Profiles. 2. User can set Location co-ordinates. 3. User can create Rules by selecting predefined profiles and location and either user can choose calendar or time and days option to activate specific profile. Figure 2.1 shows the different operations performed by user. Figure 2.1 Application Use Case Diagram

12 4 2.2 Profile In Profile tab, user can view predefined as well as user created profile list. Profile contains information about device setting pertaining to Ringer, network or Location capabilities. User can modify already created profile or delete exiting profiles. We will discuss each of these operations in detail below. Create Profile: User can create their own profile by selecting their own preferences from Audio manager like sound i.e. Normal, Silent or Vibrate etc., set audio, notification or alarm volume and last but on the least different variant of ringtones for Ringer and Alarm. Settings for Network manager like WI-FI, mobile data etc., and Location manager like GPS. After making changes to the above-mentioned setting, they will be in effect to the system immediately and will be saved to the shared preferences under the given Profile Name given by the User. The newly created Profile will be visible in the Profile List. Details about working of shared preference mechanism is explained in detail in section Delete Profile: When User clicks on Profile Name in the list, they have an option to either delete or Edit the Profile. On Selecting Delete Option, the profile will permanently remove from the Profile List as well as shared preferences. Edit Profile: User can modify profile by selecting different preferences settings i.e. Audio manager, Location and Network manager. This information will be stored on the device as shared preferences.

13 5 Figure 2.2 shows the flow of Profile operations that is performed by the User. Figure 2.2 Profile Use Case Diagram 2.3 Location In Location tab, user can view the. Locations added by them. Location Tab hosts a List that contains information about Location in terms of Name and Address. User has privilege to add and delete these locations. We will discuss each of these operations in detail below Create Location: User can create location by two ways one is letting the app learning about the current location. Current location is fetched using device s GPS. Another way is using google map. Using google map user can pinpoint the location and that location address is fetched. The GPS will provide location in terms of Longitude and Latitude. The App stores this information under given Location Name by User.

14 6 Delete Location: User can delete the Location Information i.e. Name, Address and the locations coordinates from shared preferences and location list permanently. Figure 2.3 shows the flow of Location operations that is performed by the User. Figure 2.3 Location Use Case Diagram 2.4 Rules Under Rules Tab we have Rules List that will contain Rule information consisting of Rules Name, Rule Icon and Rule details like if rules contains any Location then location information will be shown or Time Rule will have time related information like start and end time and similarly for calendar rule. User can create a new Rule, modify an existing one, or delete a rule for good. Create Rule: User can create Rule by combination of location and calendar event or location and time, days. First user need to select profile from predefined profile list.

15 7 Based on Location and Calendar Event: User can create location-based rule by selecting predefined location that were present under Location Tab. User can create Calendar based rule by entering Keywords present in the Calendar Event Title. Based on Location and Time and Days: User can create location based rule as explained above. User can set Start Time and End Time along with days information. User can also have all of the three set individually. Edit Rule: User can also modify existing rule by selecting different options for location, profile and calendar and location. Delete Rule: User can delete the Rule by a long click on the Rule and the selecting Delete option. The Rule will be permanently deleted from the device.

16 8 Figure 2.4 shows the flow of Rules operations that is performed by the User. Figure 2.4 Rules Use Case Diagram

17 9 Chapter 3 ANDROID DEVELOPMENT BASICS Android is the world s most popular mobile platform. Android is designed primarily for touchscreen mobile devices such as smartphones and tablet computers, and wristwatches (Android Wear). To make things easier for developers, Google had made Android as open source and releases the code under the Apache License Android gives you an excellent platform for creating apps and games for Android users everywhere, as well as an open marketplace for distributing to them instantly. There are four different types of application components. Each type serves a distinct purpose and has a distinct lifecycle that defines how the component is created and destroyed. 3.1 Application components Activities Activity represents a single screen with a user interface. For example, in this lab inventory application there are many activities such as login activity, user activity, admin activity and so on. One activity in the application is specified as the "main" activity, which is presented to the user when launching the application for the first time. Each activity can then start another activity in order to perform different actions. Whenever a new activity starts, the previous activity is stopped, but the system preserves the activity in a stack (the "back stack")[1]. When a new activity starts, it is pushed onto the back

18 10 stack and takes user focus. This back stack follows LIFO(last in first out) stack mechanism, so, when the user is done with the current activity and presses the back button, it is popped from the stack (and destroyed) and the previous activity resumes. Activity must be declared in the manifest file to be accessible by the system. Declaring is as simple as adding an <activity> element as a child of the <application> element as Follows: <manifest... > <application... > <activity android:name=".exampleactivity" />... </application... >... </manifest > Intent filters can also be specified in the <activity> element to declare how other application components may activate it.

19 11 The activity automatically includes an intent filter that declares the activity responds to the "main" action and should be placed in the "launcher" category. The intent filter looks like this: <activity android:name=".exampleactivity" <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> The callback methods for activity are as follows which are shown in the diagram below: oncreate(): This is called when the activity is first created. This is always followed by onstart(). onstart(): This is called just before the activity becomes visible to the user. This is followed by onresume() if the activity comes to the foreground, or onstop() if it becomes hidden. OnResume(): This is called just before the activity starts interacting with the user. This is always followed by onpause(). onpause(): This is called when the system is about to start resuming another activity. And this is followed either by onresume() if the activity returns back to the front, or by onstop() if it becomes invisible to the user.

20 12 onstop(): This is called when the activity is no longer visible to the user. This is followed either by onrestart() if the activity is coming back to interact with the user, or by ondestroy() if this activity is going away onrestart(): This is called after the activity has been stopped, just prior to it being started again. This is always followed by onstart(). OnDestroy(): This is called before the activity is destroyed. This is followed by nothing.[1]

21 13 Figure 3.1 show the activity lifecycle as described in the above sections. Figure 3.1 Activity Lifecycle [1] Fragments Fragments as the name suggests is a modular approach to have a dynamic user interface for Android. A fragment resides in an activity and we can compare to Process and Thread

22 14 concept where a Fragment is Thread, which is part of Activity i.e Process. Fragment cannot resides by its own it needs to live under an Activity, where it can function independently. One can insert these Fragments on the fly or remove the same as required. An Activity can host multiple such kinds of Fragments to generate final User Interface. Another key point is that all these fragments have their own life cycle, so they are independent of each. In our Application, we have made use of Fragments in forms of Fixed Tabs, Dialog boxes and in Google Maps, which are explained in details in later part of the report. Another advantage of having Fragments are that depending on their layout, it could be represented different on device was different screen resolution. So we can program once and it will align itself on depending on the device whether it is a phone or Tablet. In order to add a Fragment we make use Fragment class and need to ensure that we implement all keys methods pertaining to its lifecycle. One of the mandatory method is oncreateview callback which define the layout i.e user interface for the fragment. Similar to Activity, Fragment also manages state so if an Activity received onresume or onstart state method a similar will be issue to all the Fragments hosted within the activity Services A service is a component, which would be running in background without direct interaction with the user. As the service has no user interface it is not bound to the lifecycle of an activity. Services are used mostly when there is a time consuming and

23 15 long task, like loading an Image, or a File, or download something for the Internet and asynchronous tasks in general. Service has two forms: 1. Started: When an activity starts startservice(), then a service is "started". A service can run in the background indefinitely once started, even if the component that started it is destroyed. For example, it might download a image over the network. When the download is completed, the service should stop itself. 2. Bound: When an application component calls bindservice(), a service is "bound". A bound service provides a client-server interface that allows components to interact with the service, send requests and get results.

24 16 Figure 3.2 shows the Service lifecycle as described above. Figure 3.2 Service Lifecycle [1] The callback methods are: onstartcommand(): This method is called when an activity requests for a service to be started by calling startservice(). onbind(): This method is called when an activity wants to bind with the service by calling bindservice().

25 17 oncreate(): This method is called when the service is first created to perform setup of the service before onstartcommand or onbind is called. ondestroy(): This method is called when service is no longer required and is to be destroyed. <manifest... >... <application... > <service android:name=".exampleservice" />... </application> </manifest> Similar to activity, service must be declared in the application s manifest file by adding a <service> element as a child of the <application> element. Figure 3.2 shows Flow of Service Life Cycle [1] Content providers Content providers are used to provide access to other applications to a shared set of application data i.e. content providers provide a mechanism through which the data stored by one Android application can be made accessible to other applications. The data is usually stored in file system or SQLite database, which the application can access and through content provider, other applications can query or modify the date depending on the settings of the content provider.

26 18 A content provider is implemented as a subclass of ContentProvider and an application accesses the data from a content provider with a ContentResolver client object. In order to insert data into provider, ContentResolver.insert() method is used. This method inserts a new row into the provider and returns a content URI for that row. In order to update a row or delete a row ContentResolver.update() and ContentResolver.delete() methods can be used respectively Broadcast receivers A broadcast receiver allows registering for system or application events. When any registered event occurs, receivers for an event will be notified by the Android runtime. System broadcast include screen turning off, the battery is low, or a picture was captured. Applications broadcast would include letting other applications know that some data has been downloaded to the device and is available for them to use. The implementing class for a receiver extends the BroadcastReceiver class. If the event for which the broadcast receiver has registered happens the onreceive() method of the receiver is called by the Android system[2] Saving Data Most Android apps need to save data, even if only to save information about the app state during onpause() so the user's progress is not lost. Most non-trivial apps also need to save user settings, and some apps must manage large amounts of information in files and databases. This class introduces you to the principal data storage options in Android, including:[1]

27 19 Saving key-value pairs of simple data types in a shared preferences file Saving arbitrary files in Android's file system Using databases managed by SQLite In our Application we are using Shared Preferences based Key-value saving. If one have a relatively small collection of key-values that they would like to save, SharedPreferences APIs is best way to go with. A SharedPreferences object points to a file containing key-value pairs and provides simple methods to read and write them. Each SharedPreferences file is managed by the framework and can be private or shared. To write to a shared preferences file, create a SharedPreferences.Editor by calling edit() on your SharedPreferences.Pass the keys and values you want to write with methods such as putint() and putstring(). Then call commit() to save the changes. SharedPreferences mprefs = context.getsharedpreferences(pref_locationmap, Context.MODE_PRIVATE); Editor prefseditor = mprefs.edit(); Gson gson = new Gson(); String json = gson.tojson(infolist); prefseditor.putstring(location_list, json); prefseditor.commit(); To retrieve values from a shared preferences file, call methods such as getint() and getstring(), providing the key for the value you want, and optionally a default value to return if the key isn't present.

28 20 SharedPreferences mprefs = context.getsharedpreferences(pref_locationmap, Context.MODE_PRIVATE); Type listtype = new TypeToken<List<LocationInfo>>() {}.gettype(); Gson gson = new Gson(); String json = mprefs.getstring(location_list, ""); return gson.fromjson(json, listtype); 3.2 Download and setup ADT bundle The first step in starting a project would be to download the Android ADT bundle. The bundle provides all features needed to develop the app and also includes a version of the Eclipse IDE with built in ADT(Android Developer Tools). Perform the following steps after downloading: 1. First need to unpack the ZIP file (named adt-bundle-<os_platform>.zip) and save it to an appropriate location, such as a "Development" directory in our home directory. 2. Then open the adt-bundle-<os_platform>/eclipse/ directory and launch eclipse. 3. In Eclipse, click on the SDK manager and download the latest SDK tools and platforms.

29 Creating an Android Project that displays Hello World The android project consists of all the code required for the android application. The SDK tools, which we downloaded, provide basic functionality for us to start coding our application. 1. First need to click New in the toolbar. 2. When the window appear appears, we need to open the Android folder, select Android Application Project, and then click on Next. In the android application box, we need to fill appropriate values as if the application name is the app name that appears to users, which is "MyHelloWorld" for this sample project. The project name is the name of our project directory and the name visible in Eclipse. The Package Name is the package namespace for our app, which is "com.example.myhelloworld for this sample project. The lowest version that this app supports is the minimum required SDK. If we want to support multiple devices, this needs to be set to lowest version available such that the application can perform its basic operations. The target SDK is the highest version of Android for this application. The platform version with which we compile this sample app is specified in the Compile With. Here while trying out sample project; this is just set to the latest version of android. The theme specifies the Android UI style to apply for your app.

30 22 On clicking next, the following screen appears as shown in the Figure 3.3: Figure 3.3 Configure project in eclipse

31 23 On clicking next, the next screen will create a launcher icon for this app as shown in the Figure 3.4. Figure 3.4 Configure Attributes in eclipse On clicking Next, for this sample project we select BlankActivity and click Next. The other details are left at default and click Finish. The app by default stores hello world code and we need to just run it. 3.4 Android Application Files Files can be broadly divided into three categories [1]. Java file

32 24 Layout file Manifest file Java Files These files are the files where all the processing of the events happens, and allows user to interact with the system. These files are the heart of the android application. This is the place where oncreate(), onstart(),onpause(), onstop() etc. methods are defined. This part is responsible for getting the user inputs and processes the activities accordingly. Through these files, the layouts can be added dynamically, the user entered values in the text boxes or other input canbe obtained and stored Layout Files A layout defines the visual structure for a user interface, such as the UI for any activity. These files are responsible for defining the user Input. The Android framework gives you the flexibility to use either or both of these methods for declaring and managing your application's UI. The user has the luxury of seeing how the designed layout will look like in the Graphical Mode and they have the option of selecting the device that they desire to view the layout. Multiple interfaces are possible in android. Few of them are enlisted below [1] Linear Layout Using this layout option, the developer can align all the components on the screen vertically or horizontally. This layout can be only in one direction. This layout is usually used when the position of the components are static and will not change during the course of the application,

33 25 Relative Layout Through this layout, the position of the components can be described in relation to other components. This is widely used as the position of the components may vary based on the screen resolution on different devices. This is recommended for the developers to ideally use for a large pool of devices due to varying screen size. List View When there are multiple items to be displayed on the screen and they may not fit the size of the screen, then the List View is used. The items in the list are filled in the adapter from various sources like Database query, array etc. Scroll View When the components are not fitting into physical display, then the scroll view layout is used to insert more components in the screen. A scroll view be can scrolled vertically only. If the developer wants to use the horizontal scroll, then there is another layout for android operating system HorizontalScrollVie It is not recommended to use the ListView with the scroll view as the List View takes care of scrolling on its own Manifest File It is the main part of the android application. This file contains all the information about the application what android operating system components are present in the application, what permissions are required by the application etc. For using any component, it has to be present in the manifest file otherwise that component or functionality will not be executed when the application is installed in the device. The manifest file defines what version of the Android Operating System, the application

34 26 is compatible with. It can defined as <uses-sdk android:minsdkversion="16" android:targetsdkversion="18" /> The developer can define all the activities, their theme etc. in the manifest files as <activity android:name=".mainactivity" > <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> The broadcast receivers also have to be declared in the manifest file for the Alarm and Calendar event regonition. They are declared in the manifest file as: <receiver android:name=".alarmreceiver"/> The permission that the application requires for the proper execution of the tasks/functionalities that are usedin the application is declared in the manifest file. The sample of that can be found as:

35 27 <uses-feature android:glesversion="0x " android:required="true"/> <permission android:name="com.example.locationtest.permission.maps_rec EIVE" android:protectionlevel="signature" /> <uses-permission android:name="android.permission.access_network_state"/> <uses-permission android:name="com.example.locationtest.permission.maps_receive"/ > <uses-permission android:name="android.permission.access_coarse_location"/> <uses-permission android:name="android.permission.access_fine_location"/> <uses-permission android:name="android.permission.access_wifi_state"/> <uses-permission android:name="android.permission.change_wifi_state"/> <uses-permission android:name="android.permission.change_network_state"/> <uses-permission android:name="android.permission.write_external_storage" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gs ERVICES" /> 3.5 Running the application The application can be run either on device or on emulator. The details about each type of run is described in the following sections On device There are two ways the application can be run on device:

36 28 a. The android device needs to be connected to the laptop with USB cable. On connecting the device, option of downloading USB driver would appear in case the driver is not already installed. Then enable USB debugging on the device. This can be found under Settings->Developer options b. The second way is to run the app from Eclipse: On Eclipse, click on Run from the toolbar. In the Run as window that appears, need to select Android Application and click OK. This will cause eclipse to install the app on the connected device and start it On Emulator When the application needs to be run on Eclipse, then first step is to set the AVD i.e Android Virtual Device. The AVD is a device configuration for the Android emulator that allows to model different devices.

37 29 In order to create AVD, first need to launch the Android Virtual Device Manager by clicking on the toolbar. Figure 3.5 shows the Android Virtual Device Manager Screen. The next step is to click on New in the Android Virtual Device Manager panel. Figure 3.5 Android Virtual Device Manager Next step is to fill in the details for the AVD like name, a platform target, an SD card size etc. Here we have the name of Virtual Device as HTC_AVD, with device configuration similar to Nexus 4 that has 4.7 of screen size. Our targeted device is Android codename Jelly Bean with API Support of level 17. We have RAM capacity of 512 MB and an internal SD card of 500MB. Setting internal card is optional, but it is need to install GooglePlay Service which is essential for this Application.

38 30 Figure 3.6 shows snapshot of our Android Virtual Device Settings as explained above. Figure 3.6 Android Virtual Device Edit Click Okay. The new AVD will appear in the Android Virtual Device Manager screen. Select the new AVD and click Start. Wait for the emulator to boot up and then unlock the emulator screen. In order to run the app from Eclipse, click Run from the toolbar. And then select Android Application and click OK. Eclipse will install the app on the AVD and starts it.

39 31 Chapter 4 FEATURES IMPLEMENTATION 4.1 Software Architecture The Application design approach is based on MVC Architecture. Model is where the application s data objects are stored. The model does not know anything about views and controllers. When a model changes, typically it will notify its observers that a change has occurred. Here we have SettingManager that save data object using Shared Preference. This is service provided by Android OS to store the data application specific. [3] View is what is presented to the users and how users interact with the app. The view is created using HTML, CSS, or XML. We have used XML based approach. Here the UI to tackle operation with respect to Location, Profile or playing around with Rules resides. The controller is the decision maker and the glue between the model and view. The controller updates the view when the model changes. It also adds event listeners to the view and updates the model when the user manipulates the view. Here we have RulesManager that will take care of managing the rules and activate the current rule when an event occurs. All the information for Location, Profile and Rules are sent to Model layer and retrieved via Rules Manager.

40 32 Figure 4.1 shows the Model View Controller layer of the Profile Manager Application. Figure 4.1 Profile Manager Architecture 4.2 Application Home Screen This screen appears when the User launches the application. Figure shows the home screen as seen on Mobile Cell phone Device. The User can choose to do any activity from the available Tab options. They can choose to add name the current location Under Location Tab, or activate any pre-loaded Profiles or can start Adding Rules i.e defining condition in order to active certain Profile.

41 33 The Figure 4.2 shows the snapshot of the home screen as seen in Android phone device. Figure 4.2 Home Screen They can also add Profile Under Pofile Tab. In Android Tabs are part of action bar that makes it easy to explore and switch between different views or function aspects of ones app. We made used of Fixed Tab scheme and below is the code snippet.

42 34 /* Create Tabs */ ActionBar actionbar = getsupportactionbar(); // Create Actionbar Tabs actionbar.setnavigationmode(actionbar.navigation_mode_tabs); // Set Tab Icon and Titles Tab1 = actionbar.newtab().settext("locations"); Tab2 = actionbar.newtab().settext("profiles"); Tab3 = actionbar.newtab().settext("rules"); // Set Tab Listeners Tab1.setTabListener( new TabListener(FragTab1)); Tab2.setTabListener(new TabListener(FragTab2)); Tab3.setTabListener(new TabListener(FragTab3)); actionbar.addtab(tab1); actionbar.addtab(tab2); actionbar.addtab(tab3); //End of Tab Creation 4.3 Location Location Tab gives the User means to name their current Location, which would use to Define Location, based rules. Clicking on Add button (green +), a Popup Dialog will accept the Location name from the User. The information will be related to Setting Manager that will save the data to SharedPreferences, Under the hood, the App will request for current Location using Google Play Library via LocationClient. The name will map to these Coordinates i.e Longitude and Latitude and Address. For now the location is updated every 1 min if Location is selected in the Rules. If certain device does not have, Google Play installed then retrieving Location Coordinates will not be possible.

43 35 Below is code to Fetch Address for the given longitude and latitude. More information about GetAddress Service is present in Section 4.6. Figure 4.3 shows screenshot of User entering Home as the location name. Figure 4.3 Add Location protected void savelocation(string location) { // TODO Auto-generated method stub mlocationname = location; Location currentlocation = getlocation(null); LatLng latlng = new LatLng(currentLocation.getLatitude(), currentlocation.getlongitude()); new LocationServiceUtils().GetAddressFromLatlng(m_Container.getContext(), latlng, this); }

44 36 The App also gives User ability to enter location using google Maps. By clicking on google icon button under location tab, will open Google Maps for the user in new Activity. The User can select the location of interest by touch the screen. A green icon will highlight the location and User can save this location by clicking on Save button present at the bottom the screen. Similar UI described prior to this will give User option to give this location an Appropriate name. The User can also browse the existing Location marked in Red. Figure 4.4 shows screenshot where User opts to fetch the location information using google map. Figure 4.4 Add Location using Google Maps This Google Map Object is defined as placeholder in UI xml file layout. Below is the code to display Map using just Android XML file layout.

45 37 <fragment android:name="com.google.android.gms.maps.mapfragment" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentbottom="true" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" /> Google Map The Google Maps API for Android allows developers to display Maps in their Android Applications. These Maps have same appearances as the maps we see in Google Maps for Mobile. In addition to mapping functionality, the API also supports a full range of interactions that are consistent with Android UI model i.e. set up interactions with a map by defining listeners that respond to user gestures. Google Maps handles the following operations automatically Connecting to the Google Maps service. Downloading map tiles. Displaying tiles on the device screen. Displaying various controls such as pan and zoom. Responding to pan and zoom gestures by moving the map and zooming in or out. There are many types of maps present in Google Map API. Normal: Typical road map consists of Roads, some man-made features, and important natural features such as rivers are shown. Road and feature labels are also visible.

46 38 Hybrid: Satellite photograph data with road maps added. Road and feature labels are also visible. Satellite: It consists of satellite photograph data. Road and feature labels are not visible. Terrain: It contains Topographic data. The map includes colors, contour lines and labels, and perspective shading. Some roads and labels are also visible. We are using Normal Type of Map. Google Maps need special permission which are mentioned in details in Section Profile Profile Tab gives User the liberty to set Device setting such as network preference, location preference and volume of notification, in-coming calls and what should be the ringer tone. User can create or Edit a profile under a given name and make the setting best suited for certain scenario. The Tab displays the List of Profiles created with their respective Names and description of what is enabled in the profile as depicted in Figure 4.5 Figure 4.5 Profile List Tab

47 39 By giving a long Click on the Profile list present under Profile Tab, user will be given an option to either delete or Edit the Profile. Delete will remove the Profile information from the list and storage permanently. When a new Profile is created, the user is given option to make selection for the profile settings as shown in below Figure 4.6. The example shows User have selected Wi-Fi and selecting Sounds options. Figure 4.6 Edit Profile Page

48 40 These User setting are display using UI based XML files, but are little different the regular Views we have used in rest of the application. We have used Preference Class API to host the User Settings Android Preference API Android Provides an API class by name Preference that manages application preferences and implements the preferences UI. Using these ensures that all the preferences within each application are maintained in the same manner and the user experience is consistent with that of the system and other applications. In our application all, the profile related settings are stored under their respective names. But having Preference at our disposal, it is relevantly easy to restore the UI to reflect the setting like Certain checkbox checked or showing the Ringtone setting in the UI or setting volume setting in seek bar[4]. Below is the layout.

49 41 <PreferenceScreen xmlns:android=" > <PreferenceCategory android:title="audio Manager"> <CheckBoxPreference android:key="checkbox_preference" android:title="vibrate!" android:summary="vibration feedback for calls" /> <RingtonePreference android:showdefault="true" android:key="audionotification" android:title="notification Noise" android:ringtonetype="notification" /> <RingtonePreference android:showdefault="true" android:key="audioalarm" android:title="alarm Noise" android:ringtonetype="alarm" /> <ListPreference android:key="audio_profile" android:title="sound" /> /> </PreferenceCategory> <PreferenceCategory android:title="network Manager"> <CheckBoxPreference android:key="networkwifi" android:title="wifi" android:summary="toggle Phone Wifi" /> <CheckBoxPreference android:key="networkdata" android:title="mobile Data" android:summary="toggle Phone Data" />.

50 Rules Rules Component is the heart of this Application. It is the feature that will host the logic to make the decision of when to make Profile related changes, depending on Location, Calendar event or Time. User can Create, Edit or delete the Rules. The Rules Tab will list all the rules created by the User. Each Rule listed here will give a brief description about what the Rule contain. A Rule will have a Checkbox where User can turn it either ON or OFF. When the activity is in OFF mode that means even if the condition to trigger that Rule is satisfied the Profile bonded to that Rule will not be activated. Figure 4.7 shows layout of Rules Tab. Figure 4.7 Rules List Tab By Click on Add (green + sign) at the top of the screen in Rules Tab we can add a new rule. The User has to feed in the Rule Name and Select a Profile from the List. This List

51 43 is the same set of the ones present Under Profile Tab. The User can select appropriate icon for the Rule [5]. The UI also will give different options to the User in order to create a Rule. For Location, based Condition the User will be present with List of location that they had created Under Location Tab. They can select any one of the Location. Time based Condition can be enabled using Time Radio button. This will make Time UI visible. By Click From / End Button will give User a Time Picker Interface that will help them to feed the Start and End Time. They also can choose what Day they want that Time event to Trigger. The User can select Multiple Days with same Time. Calendar based UI can be enabled using Calendar Radio button. The User has to punch in keys words that could be present in the Subject or Title of the Calendar Event. The User can perform various combination of Location with Time or Calendar. They can also have just one of these three options. Under Rule Tab, we are generating Rule for Night time named Good Night, with location selected as Home and time set for 11:30 PM to 6:30 AM and all the days selected except for weekends. The profile selected as BedTime, which has turned off GPS, puts the phone to silent. The List present to display the Rule List Tab uses a custom Adaptor derived from ArrayAdapter. The code to generate Rules list shown below. The other entire list for location and Profile uses similar approach of having their own custom Adapter to List the data. The Rule also takes of conflicts by providing User option to give the Rule priority i.e. LOW, MEDIUM or HIGH. If two rules arrive at same time then the one with Higher Priority will get chance to be active. Also in case if Higher Priority Rule is Active and new one Arrives with lesser Priority will not get chance to be activated.

52 44 private class RulezAdaptor extends ArrayAdapter<String> public View getview(int position, View convertview, ViewGroup parent) { View view = m_layout.inflate(r.layout.rulez_list_row, parent, false); Rules rules = mmanagerofrules.getrulesat(position); for( int i = 0; i < rules.size(); i++){ String type = rules.getconstraintat(i).gettype(); if( type.equals( RulesManager.LOCATION_TYPE)){ LinearLayout ly = (LinearLayout) view.findviewbyid(r.id.ll_location); ly.setvisibility(view.visible); LocationConstraint lc = (LocationConstraint) rules.getconstraintat(i); txtview = (TextView) view.findviewbyid(r.id.locationvalue); txtview.settext( lc.getname() ); } else if( type.equals( RulesManager.CALENDAR_TYPE)){ LinearLayout ly = (LinearLayout) view.findviewbyid(r.id.ll_calendar); ly.setvisibility(view.visible); CalendarConstraint cc = (CalendarConstraint) rules.getconstraintat(i); txtview = (TextView) view.findviewbyid(r.id.calendarvalue); txtview.settext(cc.getkeyword() ); } else if( type.equals( RulesManager.TIME_TYPE)){ LinearLayout ly = (LinearLayout) view.findviewbyid(r.id.ll_clock); ly.setvisibility(view.visible); TimeConstraint tc = (TimeConstraint) rules.getconstraintat(i); txtview = (TextView) view.findviewbyid(r.id.timevalue); txtview.settext(tc.getstring()); } } convertview = view; if( SettingsManager.getInstance().getCurrentRule() == position ) { convertview.setbackgroundcolor(color.rgb(0xf5, 0xD0, 0xA9)); } return convertview; }

53 45 Figure 4.8 Shows Edit Rules Screenshot. Figure 4.8 Rule Edit Page Rules consist of different Software components. These components were carefully designed so as achieve good amount of extensibility meaning we should be also to provide good upgrade if need in future. One of the most important components is known as RulesMangaer. Rules Manager acts like a bookkeeper of Rules and Logic to validate the condition in order for a rule to trigger change in Profile. Rule Manager has of collection all the Rules related information. This information is used while we have modification to the Rules instead of querying store every time you modify or delete you can directly fetch this information from Rules Manager this make less I/O to Device

54 46 Storage. All the Rules that care created has to be derive from component known as ContraintImp. This ensure that we can ADD more Condition in the future without effecting most part of the Application. 4.6 Gson Parser Gson is a Java library that can be used to convert Java Objects into their JSON representation. It can also be used to convert a JSON string to an equivalent Java object. Gson can work with arbitrary Java objects including pre-existing objects that you do not have source-code of. [6] Below is an example of Gson saving a Class Object for Saving Profile List. SharedPreferences mprefs = context.getsharedpreferences(profile_names, Context.MODE_PRIVATE); Editor prefseditor = mprefs.edit(); Gson gson = new Gson(); String json = gson.tojson(infolist); prefseditor.putstring(profile_list, json); prefseditor.commit(); This String is directly saved to Android device using SharedPreferences as described in Section: In Similar way we read the string back and using Gson read those data in same type of Class object.

55 47 SharedPreferences mprefs = context.getsharedpreferences(profile_names, Context.MODE_PRIVATE); Type listtype = new TypeToken<List<String>>() {}.gettype(); Gson gson = new Gson(); String json = mprefs.getstring(profile_list, ""); return gson.fromjson(json, listtype); 4.7 Async Task Async Task enables proper and easy use of the UI thread. This class allows performing background operations and publishing results on the UI thread without having to manipulate threads and/or handlers. Android system start a new process for the application with a single thread of execution. By default, all components of the same application runs in the same process and thread called main Thread. It is endorsed to use Thread that are meant to query networks so as not to keep the UI waiting. This give better user experience. The application uses similar Async Task to fetch Address for Locations. The Application host a service by name GetAddressService. An asynchronous task is defined by three generic types, called Params, Progress and Result, and 4 steps, called on PreExecute, doinbackground, onprogressupdate and onpostexecute. [7] Our service makes used of the following two 1. doinbackground: This is invoked on the background thread immediately after onpreexecute() finishes executing. This step is used to perform background computation that can take a long time. Here the parameters of the asynchronous task are passed to this step. The results returned by this step will be passed to the

56 48 last step. We use this to query for address given latitude and latitude to google API. Below is the code for fetching address using Async protected String doinbackground(latlng... params) { Geocoder geocoder = new Geocoder(mContext, Locale.getDefault()); // Get the current location from the input parameter list LatLng loc = params[0]; // Create a list to contain the result address List<Address> addresses = null; try { /* * Return 1 address. */ addresses = geocoder.getfromlocation(loc.latitude, loc.longitude, 1); } catch (IOException e1) { Log.e("LocationSampleActivity", "IO Exception in getfromlocation()"); e1.printstacktrace(); // If the reverse geocode returned an address if (addresses!= null && addresses.size() > 0) { // Get the first address Address address = addresses.get(0); /* * Format the first line of address (if available), * city, and country name. */ String addresstext = String.format( "%s, %s, %s", // If there's a street address, add it address.getmaxaddresslineindex() > 0? address.getaddressline(0) : "", // Locality is usually a city address.getlocality(), // The country of the address address.getcountryname()); // Return the text return addresstext; }

57 49 2. onpostexecute: This method is invoked on the UI thread after the background computation finishes. The result of the background computation is passed to this step as a parameter. 4.8 Future Work This Application has room to mature and expand not only the constraint mentioned the above documents, but also enabled to perform various other automated task. First, to have better battery life and get better accuracy for location we can used Wi-Fi and cell id for location identification. Therefore, User has three option to GPS, Wi-Fi and Cell id or various combination to identify current position. We can incorporate google API V2 indoor Maps, which give room, based schematic so switch profile can be done on roombased granularity. Enhance the Application can future to go beyond just change profiles to having options to send an , message or call forwarding depending on certain Rules condition being positive. The application design will easy incorporate these changes with minimal reorganization of the code flow.

58 50 Chapter 5 CONCLUSION This Application is extremely handy and can be used by most of the Users being in Office, workout place, Movie Theater or at home, where switch to appropriate profile happens without any hassle. It will help Student or Officer going people to have noise less environment during school lectures or boardroom meetings. This application has been developed using java language. There are lots of resources and sites, which can help in learning android development. In addition, they can be tested in emulator or on actual devices

REMOTE ACCESS TO ANDROID DEVICES. A Project. Presented to the faculty of the Department of Computer Science. California State University, Sacramento

REMOTE ACCESS TO ANDROID DEVICES. A Project. Presented to the faculty of the Department of Computer Science. California State University, Sacramento REMOTE ACCESS TO ANDROID DEVICES A Project Presented to the faculty of the Department of Computer Science California State University, Sacramento Submitted in partial satisfaction of the requirements for

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

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

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu

CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu CS 4518 Mobile and Ubiquitous Computing Lecture 4: Data-Driven Views, Android Components & Android Activity Lifecycle Emmanuel Agu Announcements Group formation: Projects 2, 3 and final project will be

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Alberto Monge Roffarello Politecnico di Torino, 2017/2018 Some slides and figures are taken from the Mobile Application Development (MAD) course Disclaimer

More information

COLLEGE OF ENGINEERING, NASHIK-4

COLLEGE OF ENGINEERING, NASHIK-4 Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK-4 DEPARTMENT OF COMPUTER ENGINEERING 1) What is Android? Important Android Questions It is an open-sourced operating system that is used primarily

More information

Fragments and the Maps API

Fragments and the Maps API Fragments and the Maps API Alexander Nelson October 6, 2017 University of Arkansas - Department of Computer Science and Computer Engineering Fragments Fragments Fragment A behavior or a portion of a user

More information

Introduction to Android

Introduction to Android Introduction to Android Ambient intelligence Teodoro Montanaro Politecnico di Torino, 2016/2017 Disclaimer This is only a fast introduction: It is not complete (only scrapes the surface) Only superficial

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

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi Introduction An application is composed of at least one Activity GUI It is a software component that stays behind a GUI (screen) Activity It runs inside the

More information

Android App Development

Android App Development Android App Development Course Contents: Android app development Course Benefit: You will learn how to Use Advance Features of Android with LIVE PROJECTS Original Fees: 15000 per student. Corporate Discount

More information

Lab 1: Getting Started With Android Programming

Lab 1: Getting Started With Android Programming Islamic University of Gaza Faculty of Engineering Computer Engineering Dept. Eng. Jehad Aldahdooh Mobile Computing Android Lab Lab 1: Getting Started With Android Programming To create a new Android Project

More information

Android" Application Development SAMS. Sams Teach Yourself. Shane Conder. Lauren Darcey. Second Edition

Android Application Development SAMS. Sams Teach Yourself. Shane Conder. Lauren Darcey. Second Edition Lauren Darcey Shane Conder Sams Teach Yourself Android" Application Development Second Edition SAMS 800 East 96th Street, Indianapolis, Indiana, 46240 USA Table of Contents Introduction 1 Who Should Read

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 SYLLABUS. Advanced Android

ANDROID SYLLABUS. Advanced Android Advanced Android 1) Introduction To Mobile Apps I. Why we Need Mobile Apps II. Different Kinds of Mobile Apps III. Briefly about Android 2) Introduction Android I. History Behind Android Development II.

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

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

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

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

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

Mobile and Ubiquitous Computing: Android Programming (part 4)

Mobile and Ubiquitous Computing: Android Programming (part 4) Mobile and Ubiquitous Computing: Android Programming (part 4) Master studies, Winter 2015/2016 Dr Veljko Pejović Veljko.Pejovic@fri.uni-lj.si Examples from: Mobile and Ubiquitous Computing Jo Vermeulen,

More information

Activities and Fragments

Activities and Fragments Activities and Fragments 21 November 2017 Lecture 5 21 Nov 2017 SE 435: Development in the Android Environment 1 Topics for Today Activities UI Design and handlers Fragments Source: developer.android.com

More information

Application Fundamentals

Application Fundamentals Application Fundamentals CS 2046 Mobile Application Development Fall 2010 Announcements CMS is up If you did not get an email regarding this, see me after class or send me an email. Still working on room

More information

Course Learning Outcomes (CLO): Student Outcomes (SO):

Course Learning Outcomes (CLO): Student Outcomes (SO): Course Coverage Course Learning Outcomes (CLO): 1. Understand the technical limitations and challenges posed by current mobile devices and wireless communications; be able to evaluate and select appropriate

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

Programming Concepts and Skills. Creating an Android Project

Programming Concepts and Skills. Creating an Android Project Programming Concepts and Skills Creating an Android Project Getting Started An Android project contains all the files that comprise the source code for your Android app. The Android SDK tools make it easy

More information

Contextual Android Education

Contextual Android Education Contextual Android Education James Reed David S. Janzen Abstract Advances in mobile phone hardware and development platforms have drastically increased the demand, interest, and potential of mobile applications.

More information

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011

Android for Ubiquitous Computing Researchers. Andrew Rice University of Cambridge 17-Sep-2011 Android for Ubiquitous Computing Researchers Andrew Rice University of Cambridge 17-Sep-2011 Getting started Website for the tutorial: http://www.cl.cam.ac.uk/~acr31/ubicomp/ Contains links to downloads

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

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ]

Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ] s@lm@n Android Exam AND-401 Android Application Development Version: 7.0 [ Total Questions: 129 ] Android AND-401 : Practice Test Question No : 1 Which of the following is required to allow the Android

More information

COSC 3P97 Mobile Computing

COSC 3P97 Mobile Computing COSC 3P97 Mobile Computing Mobile Computing 1.1 COSC 3P97 Prerequisites COSC 2P13, 3P32 Staff instructor: Me! teaching assistant: Steve Tkachuk Lectures (MCD205) Web COSC: http://www.cosc.brocku.ca/ COSC

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

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

ANDROID TRAINING PROGRAM COURSE CONTENT

ANDROID TRAINING PROGRAM COURSE CONTENT ANDROID TRAINING PROGRAM COURSE CONTENT Android Architecture System architecture of Android Activities Android Components Android Manifest Android Development Tools Installation of the Android Development

More information

Answers to Exercises

Answers to Exercises Answers to Exercises CHAPTER 1 ANSWERS 1. What is an AVD? Ans: An AVD is an Android Virtual Device. It represents an Android emulator, which emulates a particular configuration of an actual Android device.

More information

CE881: Mobile & Social Application Programming

CE881: Mobile & Social Application Programming CE881: Mobile & Social Application Programming, s, s and s Jialin Liu Senior Research Officer Univerisity of Essex 6 Feb 2017 Recall of lecture 3 and lab 3 :) Please download Kahoot or open a bowser and

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

Spring Lecture 5 Lecturer: Omid Jafarinezhad

Spring Lecture 5 Lecturer: Omid Jafarinezhad Mobile Programming Sharif University of Technology Spring 2016 - Lecture 5 Lecturer: Omid Jafarinezhad Storage Options Android provides several options for you to save persistent application data. The

More information

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie Android Anatomy Android Anatomy 2! Agenda

More information

Android Application Development using Kotlin

Android Application Development using Kotlin Android Application Development using Kotlin 1. Introduction to Kotlin a. Kotlin History b. Kotlin Advantages c. How Kotlin Program Work? d. Kotlin software Prerequisites i. Installing Java JDK and JRE

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

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology

Produced by. Mobile Application Development. David Drohan Department of Computing & Mathematics Waterford Institute of Technology Mobile Application Development Produced by David Drohan (ddrohan@wit.ie) Department of Computing & Mathematics Waterford Institute of Technology http://www.wit.ie User Interface Design" & Development -

More information

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen

Agenda. Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Gill Cleeren Agenda Overview of Xamarin and Xamarin.Android Xamarin.Android fundamentals Creating a detail screen Lists and navigation Navigating from master to detail Optimizing the application Preparing

More information

Android App Development. Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore

Android App Development. Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore Android App Development Muhammad Sharjeel COMSATS Institute of Information Technology, Lahore Mobile devices (e.g., smartphone, tablet PCs, etc.) are increasingly becoming an essential part of human life

More information

Mobile Computing. Introduction to Android

Mobile Computing. Introduction to Android Mobile Computing Introduction to Android Mobile Computing 2011/2012 What is Android? Open-source software stack for mobile devices OS, middleware and key applications Based upon a modified version of the

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

Android Programming in Bluetooth Cochlea Group

Android Programming in Bluetooth Cochlea Group Android Programming in Bluetooth Cochlea Group Zijian Zhao Abstract: My project is mainly android programming work in the Bluetooth Cochlea Group. In this report I will first introduce the background of

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 development. Outline. Android Studio. Setting up Android Studio. 1. Set up Android Studio. Tiberiu Vilcu. 2.

Android development. Outline. Android Studio. Setting up Android Studio. 1. Set up Android Studio. Tiberiu Vilcu. 2. Outline 1. Set up Android Studio Android development Tiberiu Vilcu Prepared for EECS 411 Sugih Jamin 15 September 2017 2. Create sample app 3. Add UI to see how the design interface works 4. Add some code

More information

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle

CS378 - Mobile Computing. Anatomy of an Android App and the App Lifecycle CS378 - Mobile Computing Anatomy of an Android App and the App Lifecycle Application Components five primary components different purposes and different lifecycles Activity single screen with a user interface,

More information

Android Programming (5 Days)

Android Programming (5 Days) www.peaklearningllc.com Android Programming (5 Days) Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse tools. This Android

More information

Minds-on: Android. Session 1

Minds-on: Android. Session 1 Minds-on: Android Session 1 Paulo Baltarejo Sousa Instituto Superior de Engenharia do Porto 2016 Outline Mobile devices Android OS Android architecture Android Studio Practice 1 / 33 2 / 33 Mobile devices

More information

Building User Interface for Android Mobile Applications II

Building User Interface for Android Mobile Applications II Building User Interface for Android Mobile Applications II Mobile App Development 1 MVC 2 MVC 1 MVC 2 MVC Android redraw View invalidate Controller tap, key pressed update Model MVC MVC in Android View

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

Java Training Center - Android Application Development

Java Training Center - Android Application Development Java Training Center - Android Application Development Android Syllabus and Course Content (3 months, 2 hour Daily) Introduction to Android Android and it's feature Android releases and Versions Introduction

More information

Introduction to Android development

Introduction to Android development Introduction to Android development Manifesto Digital We re an award winning London based digital agency that loves ideas design and technology We aim to make people s lives better, easier, fairer, more

More information

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities

University of Babylon - College of IT SW Dep. - Android Assist. Lect. Wadhah R. Baiee Activities Activities Ref: Wei-Meng Lee, BEGINNING ANDROID 4 APPLICATION DEVELOPMENT, Ch2, John Wiley & Sons, 2012 An application can have zero or more activities. Typically, applications have one or more activities;

More information

Lifecycle Callbacks and Intents

Lifecycle Callbacks and Intents SE 435: Development in the Android Environment Recitations 2 3 Semester 1 5779 4 Dec - 11 Dec 2018 Lifecycle Callbacks and Intents In this recitation we ll prepare a mockup tool which demonstrates the

More information

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android?

Questions and Answers. Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android? Q.1) Which of the following is the most ^aeuroeresource hungry ^aeuroepart of dealing with activities on android? A. Closing an app. B. Suspending an app C. Opening a new app D. Restoring the most recent

More information

Introduction To Android

Introduction To Android Introduction To Android Mobile Technologies Symbian OS ios BlackBerry OS Windows Android Introduction to Android Android is an operating system for mobile devices such as smart phones and tablet computers.

More information

Mobile Programming Lecture 1. Getting Started

Mobile Programming Lecture 1. Getting Started Mobile Programming Lecture 1 Getting Started Today's Agenda About the Android Studio IDE Hello, World! Project Android Project Structure Introduction to Activities, Layouts, and Widgets Editing Files in

More information

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment

Fragments were added to the Android API in Honeycomb, API 11. The primary classes related to fragments are: android.app.fragment FRAGMENTS Fragments An activity is a container for views When you have a larger screen device than a phone like a tablet it can look too simple to use phone interface here. Fragments Mini-activities, each

More information

MC Android Programming

MC Android Programming MC1921 - Android Programming Duration: 5 days Course Price: $3,395 Course Description Android is an open source platform for mobile computing. Applications are developed using familiar Java and Eclipse

More information

Beginning Android 4 Application Development

Beginning Android 4 Application Development Beginning Android 4 Application Development Lee, Wei-Meng ISBN-13: 9781118199541 Table of Contents INTRODUCTION xxi CHAPTER 1: GETTING STARTED WITH ANDROID PROGRAMMING 1 What Is Android? 2 Android Versions

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

Syllabus- Java + Android. Java Fundamentals

Syllabus- Java + Android. Java Fundamentals Introducing the Java Technology Syllabus- Java + Android Java Fundamentals Key features of the technology and the advantages of using Java Using an Integrated Development Environment (IDE) Introducing

More information

application components

application components What you need to know for Lab 1 code to publish workflow application components activities An activity is an application component that provides a screen with which users can interact in order to do something,

More information

Programming Android UI. J. Serrat Software Design December 2017

Programming Android UI. J. Serrat Software Design December 2017 Programming Android UI J. Serrat Software Design December 2017 Preliminaries : Goals Introduce basic programming Android concepts Examine code for some simple examples Limited to those relevant for the

More information

Lab Android Development Environment

Lab Android Development Environment Lab Android Development Environment Setting up the ADT, Creating, Running and Debugging Your First Application Objectives: Familiarize yourself with the Android Development Environment Important Note:

More information

Android Programming - Jelly Bean

Android Programming - Jelly Bean 1800 ULEARN (853 276) www.ddls.com.au Android Programming - Jelly Bean Length 5 days Price $4235.00 (inc GST) Overview This intensive, hands-on five-day course teaches programmers how to develop activities,

More information

Android Overview. Most of the material in this section comes from

Android Overview. Most of the material in this section comes from Android Overview Most of the material in this section comes from http://developer.android.com/guide/ Android Overview A software stack for mobile devices Developed and managed by Open Handset Alliance

More information

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners

Overview. What are layouts Creating and using layouts Common layouts and examples Layout parameters Types of views Event listeners Layouts and Views http://developer.android.com/guide/topics/ui/declaring-layout.html http://developer.android.com/reference/android/view/view.html Repo: https://github.com/karlmorris/viewsandlayouts Overview

More information

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu

CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu CS 528 Mobile and Ubiquitous Computing Lecture 3b: Android Activity Lifecycle and Intents Emmanuel Agu Android Activity LifeCycle Starting Activities Android applications don't start with a call to main(string[])

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

Android Programming Lecture 2 9/7/2011

Android Programming Lecture 2 9/7/2011 Android Programming Lecture 2 9/7/2011 Creating a first app 1. Create a new Android project (a collection of source code and resources for the app) from the Eclipse file menu 2. Choose a project name (can

More information

Analyzing Wi Fi P2P in the context of a hangman game 1

Analyzing Wi Fi P2P in the context of a hangman game 1 Analyzing Wi Fi P2P in the context of a hangman game 1 1. Introduction and Findings 2 3 Wi Fi P2P, which complies with the Wi Fi Alliance's Wi Fi Direct certification program, is a relatively new addition

More information

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu

CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu CS 403X Mobile and Ubiquitous Computing Lecture 5: Web Services, Broadcast Receivers, Tracking Location, SQLite Databases Emmanuel Agu Web Services What are Web Services? Means to call a remote method

More information

Understanding Application

Understanding Application Introduction to Android Application Development, Android Essentials, Fifth Edition Chapter 4 Understanding Application Components Chapter 4 Overview Master important terminology Learn what the application

More information

android application development CONTENTS 1.1 INTRODUCTION TO O ANDROID OPERATING SYSTEM... TURES Understanding the Android Software Stack...

android application development CONTENTS 1.1 INTRODUCTION TO O ANDROID OPERATING SYSTEM... TURES Understanding the Android Software Stack... Contents android application development FOR m.tech (jntu - h) i semester - CSE, ii semester - WEB TECHNOLOGIES CONTENTS i UNIT - I [CH. H. - 1] ] [INTRODUCTION TO ANDROID OPERATING SYSTEM]... 1.1-1.32

More information

Required Core Java for Android application development

Required Core Java for Android application development Required Core Java for Android application development Introduction to Java Datatypes primitive data types non-primitive data types Variable declaration Operators Control flow statements Arrays and Enhanced

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

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

CS378 -Mobile Computing. What's Next?

CS378 -Mobile Computing. What's Next? CS378 -Mobile Computing What's Next? Fragments Added in Android 3.0, a release aimed at tablets A fragment is a portion of the UI in an Activity multiple fragments can be combined into multi-paned UI fragments

More information

BCA 6. Question Bank

BCA 6. Question Bank BCA 6 030010601 : Introduction to Mobile Application Development Question Bank Unit 1: Introduction to Android and Development tools Short questions 1. What kind of tool is used to simulate Android application?

More information

ATC Android Application Development

ATC Android Application Development ATC Android Application Development 1. Android Framework and Android Studio b. Android Platform Architecture i. Linux Kernel ii. Hardware Abstraction Layer(HAL) iii. Android runtime iv. Native C/C++ Libraries

More information

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi

ACTIVITY, FRAGMENT, NAVIGATION. Roberto Beraldi ACTIVITY, FRAGMENT, NAVIGATION Roberto Beraldi View System A system for organizing GUI Screen = tree of views. View = rectangular shape on the screen that knows how to draw itself wrt to the containing

More information

Topics Covered in the Android Apps Development Training

Topics Covered in the Android Apps Development Training Topics Covered in the Android Apps Development Training 1. Android Architecture sdk, jdk, class files,.dex, installation, sdk manager, avd manager, avd configurations, emulator, Android Framework Versions,

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/22/2017

More information

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming

Lecture 7: Data Persistence : shared preferences. Lecturer : Ali Kadhim Al-Bermani Mobile Fundamentals and Programming University of Babylon College of Information Technology Department of Information Networks Mobile Fundamentals and Programming Lecture 7: Data Persistence : shared preferences Lecturer : Ali Kadhim Al-Bermani

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

UI Fragment.

UI Fragment. UI Fragment 1 Contents Fragments Overviews Lifecycle of Fragments Creating Fragments Fragment Manager and Transactions Adding Fragment to Activity Fragment-to-Fragment Communication Fragment SubClasses

More information

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015

Android System Architecture. Android Application Fundamentals. Applications in Android. Apps in the Android OS. Program Model 8/31/2015 Android System Architecture Android Application Fundamentals Applications in Android All source code, resources, and data are compiled into a single archive file. The file uses the.apk suffix and is used

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

Distributed Systems Assignment 1

Distributed Systems Assignment 1 Distributed Systems Assignment 1 Marian.george@inf.ethz.ch Distributed Systems Assignment 1 1 The Exercise Objectives Get familiar with Android programming Emulator, debugging, deployment Learn to use

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

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

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle

CS378 -Mobile Computing. Anatomy of and Android App and the App Lifecycle CS378 -Mobile Computing Anatomy of and Android App and the App Lifecycle Hello Android Tutorial http://developer.android.com/resources/tutorials/hello-world.html Important Files src/helloandroid.java Activity

More information

Upon completion of the second part of the lab the students will have:

Upon completion of the second part of the lab the students will have: ETSN05, Fall 2017, Version 2.0 Software Development of Large Systems Lab 2 1. INTRODUCTION The goal of lab 2 is to introduce students to the basics of Android development and help them to create a starting

More information

Android. Lesson 1. Introduction. Android Developer Fundamentals. Android Developer Fundamentals. to Android 1

Android. Lesson 1. Introduction. Android Developer Fundamentals. Android Developer Fundamentals. to Android 1 Android Lesson 1 1 1 1.0 to Android 2 Contents Android is an ecosystem Android platform architecture Android Versions Challenges of Android app development App fundamentals 3 Android Ecosystem 4 What is

More information

ORACLE UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

ORACLE UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP) Android Syllabus Pre-requisite: C, C++, Java Programming SQL & PL SQL Chapter 1: Introduction to Android Introduction to android operating system History of android operating system Features of Android

More information