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

Size: px
Start display at page:

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

Transcription

1 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 the degree of MASTER OF SCIENCE in Computer Science by Prasad D. Lakhangaonkar FALL 2015

2 REMOTE ACCESS TO ANDROID DEVICES A Project by Prasad D. Lakhangaonkar Approved by:, Committee Chair Dr. Jinsong Ouyang, Second Reader Dr. Jun Dai Date ii

3 Student: Prasad D. Lakhangaonkar 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 REMOTE ACCESS TO ANDROID DEVICES by Prasad D. Lakhangaonkar Internet and mobile devices have certainly changed the face of this era. They have made communications possible in spite of the physical barriers around us. In addition, there is always a need for more innovations, which could make our lives easier. There is always a need for accessing all your personal devices remotely; it is more convenient to have access to all your PDAs, Tablets, and Laptops at times when we are not prepared to carry it around. Likewise, it is a very common thing to forget our phone at home or leave it behind for charging and we need to access our contact list, an important document file or multimedia files, which are all stored in your phone when your phone is not accessible physically. This system promises to deliver your phone's content such as a contact list, document files and multimedia files through PC browser. The contents of the phone can be accessed from any PC web browser by using the right credentials that user had set using the android application in his phone. The system consists of android application and a web application. The android application developed using JAVA language and the web application developed using PHP, JavaScript and HTML. The system's server part communicates with the android iv

5 application through Google Cloud Messaging (GCM) service so that the android application does not have to request the server in a timely fashion and saves a lot of battery power., Committee Chair Dr. Jinsong Ouyang Date v

6 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. Jun Dai for his willingness to serve on the committee. I would like to thank my family and friends, for their love and support. Lastly, I would like to thank the entire faculty and staff of the Department of Computer Science Engineering at California State University, Sacramento. vi

7 TABLE OF CONTENTS Page Acknowledgements... vi List of Figures...x Chapter 1. INTRODUCTION PROJECT REQUIREMENTS User Options User Options for Android Application Register Login Change Password Logout User Options for Web Application Login Documents Contacts Pictures Music Videos Logout ANDROID DEVELOPMENT BASICS...13 vii

8 3.1 Android Application Components Activities Services Broadcast Receivers Content Providers Saving Data Android Environment Setup Creating Sample Android Application using Android Studio Android Application Files Java Files Layout Files Manifest File Running the Application On Device On Emulator FEATURES IMPLEMENTATION Remote Access to Android Devices Architecture Android Application Register Activity Login Activity Home Activity Change Password Activity viii

9 4.2.5 GCM Notification Async Task Web Application Documents Tab Contacts Tab Pictures Tab Music Tab Videos Tab Future Work CONCLUSION...75 References...76 ix

10 LIST OF FIGURES Figures Page Figure 2.1 Android Application Use Case Diagram... 4 Figure 2.2 Register Activity Flow Diagram... 5 Figure 2.3 Login Activity Flow Diagram... 5 Figure 2.4 Change Password Activity Flow Diagram... 6 Figure 2.5 Web Application Use Case Diagram... 7 Figure 2.6 Documents Tab Flow Diagram... 9 Figure 2.7 Contacts Tab Flow Diagram Figure 2.8 Pictures Tab Flow Diagram Figure 2.9 Music Tab Flow Diagram Figure 2.10 Videos Tab Flow Diagram Figure 3.1 Activity Lifecycle Figure 3.2 Service Lifecycle Figure 3.3 Android Studio Welcome Screen Figure 3.4 New Project Configuration in Android Studio Figure 3.5 Form Factors for a New Project in Android Studio Figure 3.6 Choose Device Dialog box in Android Studio Figure 3.7 Android Virtual Device Manager Figure 3.8 Android Virtual Device Configuration Figure 4.1 Remote Access to Android Devices Architecture Figure 4.2 Register Activity x

11 Figure 4.3 Login activity Figure 4.4 Home Activity Figure 4.5 Change Password Activity Figure 4.6 Web Application Home Screen Figure 4.7 Documents Tab Figure 4.8 PDF Documents Figure 4.9 Save Document File Figure 4.10 Contacts List Figure 4.11 Pictures Figure 4.12 Music Files Figure 4.13 Music Preview Figure 4.14 Video Files Figure 4.15 Video Preview xi

12 1 Chapter 1 INTRODUCTION Remote access to android devices application allows users to access their android device remotely through web browser. This application comes very handy to users who tends to forget their android device at home or leave it behind for charging. In addition, we need to access our contact list, an important document file or multimedia files, which are all stored in the phone when the phone is not accessible physically. It allows the users of this application to access different document files, contacts, pictures, music and videos files stored in their android device through web browser. Remote access to android devices system consists of android application and web application. The android application is used for registration of the device and for uploading the requested content to the web application server. The web application requests and display the contents fetched from the android device. The web application sends different types of request to the android device through Google Cloud Messaging (GCM) server. The GCM server then sends the push notification to android device. Once the android device receives the notification, which is nothing but a request from web application to upload content, the android application on device parses it and depending on type of request, it uploads the appropriate content to the web application server. Therefore, the web application communicates with the android device through GCM server. The GCM server is used here because the android application does not have to poll the web application server in timely fashion for any requests from web application,

13 2 which actually consumes a lot of battery power. The GCM server receives the request from the web application and sends it to the android device as a push notification and then the android application, which runs in the background, perform its work of uploading the contents according to type of request. This way with the use of GCM server, the android application consumes less battery power [1]. Following chapters includes details about working & features of remote access to android devices.

14 3 Chapter 2 PROJECT REQUIREMENTS 2.1 User Options Remote Access to Android Devices system consists of android application as well as web application. Both these applications i.e. Android application and the web application provides various options to the user. Following sections discusses these options in detail. 2.2 User Options for Android Application Android application is half and core part of Remote Access to Android Devices system. Android application provides different options to the user to let them access their android device contents using the web application. Figure 2.1 shows the different options provided by android application to the user. These options are: 1. User can register their device with web application s server. 2. User can login to the android application. 3. User can change their current password for the account. The changing of password is available only after the user has logged in the application. 4. User can logout from the android application.

15 4 Figure 2.1 Android Application Use Case Diagram Register Users of Remote Access to Android Devices has to install the android application on their android device and needs to register their device with the web application s server. After registration of the android device, user can login to the android application as well as a web application with the credentials provided during registration. Figure 2.2 explains how a user can register an android device with the web application server.

16 5 Figure 2.2 Register Activity Flow Diagram Login After successful registration of the android device, user can login to the android application, change the password for current account & logout from the application. The user has to login to the android application before he can login to the web application, otherwise the user cannot access the android device contents using a web application. Figure 2.3 explains how a user can login to android application. Figure 2.3 Login Activity Flow Diagram Change Password To change the password for the current account, the user has to login to the android application. Figure 2.4 explains how a user can change password for the current account.

17 6 Figure 2.4 Change Password Activity Flow Diagram Logout User has an option to logout from the android application. User cannot access android device contents using web application after logging out from the android application. 2.2 User Options for Web Application The web application or the web interface is the other half part of the Remote Access to Android Devices system. Using web application user can access their android device contents. Web application provides various different options to the user to access different contents of their android device. Figure 2.2 shows the options provided to the user by the web application. These options are briefly listed below: 1. User can login to the web application. 2. User can access different document files stored in their android device. 3. User can access contacts stored in their android device. 4. User can access pictures stored in their android device. 5. User can access music files stored in their android device. 6. User can access video files stored in their android device.

18 7 7. User can logout from the web application. Figure 2.5 Web Application Use Case Diagram

19 Login User can login to the web application with the credentials he set during registration of the android device using android application. After successful login, the web application provides different tabs to let user access & download different files to their PC that are stored in their android device Documents User can click on the documents tab from the home screen of the web application to access different document types stored in their device. The options under documents tab are pdf documents, word documents, excel documents and power point documents. The web application communicates with the associated android device using GCM server. Once the user selects one of the above-mentioned option from documents tab, the web application composes that particular document type request and sends that request to the GCM server, which in turns sends the request to the associated android device. The android application receives the request and according to the request type, the android application uploads requested content to a web application server. The web application then displays the requested documents to the user. Figure 2.6 explains how a user can access different documents stored in the android device using a web application.

20 9 Figure 2.6 Documents Tab Flow Diagram Contacts User can click on the contacts tab from the home screen of the web application to access all contacts from the associated android device. When the user clicks on contacts tab, the web application composes contacts request and sends it to the GCM server, which in turn sends the request to the associated android device. The android application on android device receives the request and parse it. Depending on the request type, the android application uploads requested content to a web application server. After receiving the contents in this case contacts from android device, the web application displays it to the user. Figure 2.7 explains how a user can access contacts stored in the android device using a web application.

21 10 Figure 2.7 Contacts Tab Flow Diagram Pictures Under pictures tab, user has an option to select different albums that are present in their android device. Once the user selects the particular album from pictures tab, all the pictures from that album are fetched from the android device and is displayed to the user. When user clicks on the particular album, the web application composes and sends a picture request to GCM server, which in turn sends the request to the associated android device. The android application then receives the request and parses it. Depending on the type of request, the android application uploads requested content to a web application server and it is shown to the user using a web application. Figure 2.8 explains how a user can access pictures stored in the android device using a web application.

22 11 Figure 2.8 Pictures Tab Flow Diagram Music User can click on the music tab from the home screen of the web application to receive all music files from the android device. When the user clicks on music tab, the web application composes the music request and sends it to the GCM server, which in turn sends the request to the associated android device. The android application then receives the request and parses it. Depending on the request type, the android application uploads requested content to a web application server. After receiving the music files from android device, the web application displays a music files list to the user. Figure 2.9 explains how a user can access music files stored in the android device using a web application. Figure 2.9 Music Tab Flow Diagram

23 Videos User can click on the videos tab from the home screen of the web application to receive all video files from the android device. When the user clicks on videos tab, the web application composes the video request and sends it to the GCM server, which in turn sends the request to the associated android device. The android application then receives the request and parses it. Depending on the request type, the android application uploads requested content to a web application server. After receiving the video files from android device, the web application displays a video files list to the user. Figure 2.10 explains how a user can access video files stored in the android device using a web application. Figure 2.10 Videos Tab Flow Diagram Logout Web application provides an option to the user to logout from the application. The web application stores the user s device data on server for caching purpose & logging out from the application deletes that data from the web application s server.

24 13 Chapter 3 ANDROID DEVELOPMENT BASICS Android is an open source operating system based on Linux kernel designed primarily for touchscreen mobile devices such as smartphones and tablet computers. It provides single application model that gives the ability for application to run on any device supported by Android [2]. It automatically adapts to look best in UI based on the device so no need to design different app for each device design. Along with this feature, Android also lets the user have as much control as needed for UI on wide range of devices supported by Android. Remote access to android devices project consists of two parts that includes android application and web application. The android application is developed using Java programming language and the web application is implemented using web technologies that includes PHP, JavaScript, Bootstrap and HTML. The android application is compiled using Android SDK tools into an android package called apk file. This.apk file is used to install the application in android devices. Android consists of different types of application components. These components are essential building blocks of an android application and can be visual or non-visual and each type serves a distinct purpose and has distinct lifecycle. These components can also reuse components of other applications [2].

25 Android Application Components Android has main four components, which are used in any android application. These components are activities, services, content providers and broadcast receivers. Following section describes each component in detail. In this project s android application, components such as activities, services, content providers, broadcast receivers and shared preferences for saving data are used Activities Activity is a visual representation component that represents a single screen with a user interface. For example, in this project's android application there are many activities like login activity, register activity, home activity, change password activity, and so on. Any 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. The activity passes data to each other using intents. In addition, whenever a new activity starts, the old or previous activity is preserved by the system in a stack (the "back stack") [3]. This new activity is pushed on backed 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 [3]. In this project login activity, register activity, home activity & change password activity are part of android application and it interacts with the user for various purposes. Activity must have its entry in manifest file of an application to be accessible by the system [3]. The activity can be added in manifest file as a <activity> element that is child

26 15 element of <application> element as shown below and it is how the manifest file looks like: <manifest... > <application... > <activity android:name=".exampleactivity" />... </application... >... </manifest > In an activity element intent filters element is specified to declare how other application components may activate it. 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: <intent-filter> <actionandroid:name="android.intent.action.main"/> <categoryandroid:name="android.intent.category.launcher"/> </intent-filter> </activity> The following are the activity life cycle methods [3], which are shown in Figure 3.1. oncreate This method is called when the activity is first created. In this method view creation and data binding is performed. This method is followed by onstart() method. onstart() After the activity has been created the, it is eligible to run on foreground, so before activity becomes visible to user onstart() method is called. onrestart() After the activity has stopped and if it is going to restart, then just before restart the onrestart() method is called. onrestart() method is always followed by onstart() method.

27 16 onresume() At this point activity interacts with the user. onresume() method is called just before activity starts interacting with the user. Figure 3.1 Activity Lifecycle [3] onpause() When one activity starts another activity then the calling activity or first activity is stopped. So onpause() method is called for an activity that starts the other

28 17 activity. This method is always followed by onresume() method if the activity again comes to foreground or onstop if it is invisible to the user. onstop() Just before the activity is going to stop the onstop() method is called. onstop() method is followed by onrestart() method if the user again navigates to the activity or ondestroy() if it is going away. ondestroy() Just before activity is destroyed, ondestroy() method is called. This method is followed by nothing Services A service is an application's component that performs a long-running operation. The service does not require user interaction and it supplies functionality for other applications to use. A service does not have a user interface and hence it is not bounded to the lifecycle of an activity [4]. A service is managed by android and hence it has its own lifecycle. Services are used to perform long running time-consuming tasks such as uploading or downloading of a file and it is used to perform some asynchronous tasks in general. In this project s android application, services are used for uploading of various device data to the web application server. Service can be intent service or just service which again has two forms namely started service and bound service [4], below section describes all forms in details: 1. Intent Service: Intent service is a simplest form of service. It is created to execute a specific task in a separate thread and then exit. The intent service is triggered by the main activity that creates explicit intent pointing to the service [4]. The intent

29 18 service is then started and the onhandleintent method is executed. For example, send a notification if an alarm occurs. 2. Started Service: Any application component can use a service in a same way as any component can use an activity. For example, a service is started when an activity calls startservice() method. Now the service runs in the background indefinitely until its task is completed, even if the activity that started the service is destroyed [4]. When the task is completed the service stops automatically. It is used for downloading or uploading a file over a network or playing a music in background. In this project s android application, started type of services are used for uploading of device data to the web application server. 3. Bounded Service: When an application component like activity calls the bindservice() method then the service is bound service. The bound service provides interface that allows components to interact with the service. The interface is of client server type in which a client can send requests and get results. Also the client can unbound the service by calling the unbindservice() method [4]. This type of service is used to get some information like information about current song being played in a music player. Figure 3.2 shows the lifecycle of services in android. The following are the android service life cycle methods [4], which are shown in Figure 3.2. onstartcommand() The system calls this method when an activity or another component requests for a service to be started by calling startservice() method.

30 19 oncreate() The system calls this method before onstartcommand() method or onbind() method to perform the setup of the service. This method is called when the service is first created. onbind() The system calls this method when an activity or another component wants to bind with the service by calling bindservice() method. The component usually calls this method to perform some remote procedure calls. ondestroy() The system calls this method when the service is no longer needed and it is to be destroyed.

31 20 Figure 3.2 Service Lifecycle [4] 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 as shown below and it is how the manifest file looks like: <manifest... >... <application... > <serviceandroid:name=".exampleservice"/>... </application> </manifest>

32 Broadcast Receivers A broadcast receiver is a dormant component of the android system. It comes into action when a certain event occurs for which it is registered. Broadcast receiver allows applications to register for a particular event and once the event occurs, the system notifies all registered applications. For example, some system broadcasts include boot completed, time tick, battery is low and many others. In addition, application can broadcast messages to know other applications the changes it has done for example, a file has downloaded and it is ready to use by other applications. The broadcast receiver's job is to activate some software component like to notify the user about the occurrence of the event [5]. A broadcast receiver is registered by defining it in the applications manifest file. In this project s android application, broadcast receiver is triggered when android device receives push notification from GM and is used to start a service to upload data to the web application server. 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 [5] Content Providers In android, an application cannot access the data of other application by default. This principle in android is called sandboxing [6]. However, often applications wants share data with other application and this is possible by using content providers. The content providers is a mechanism through which data stored by one application can be accessed

33 22 by other application. The application usually stores the data in file system or SQLite database and make that data available to other applications via content providers; other application can read or modify the application data depending on the settings of content provider [6]. The content provider for an application is implemented as subclass of ContentProvider, which is interface between application's provider and other applications. A client application accesses the data from content provider with ContentResolver object. The ContentResolver object has query(), insert(), update(), delete() methods to access data from content providers. For example, to insert data into the provider insert() method is used and it returns the content URI for that row. Similarly, update() and delete() methods are used to update the data and to delete the data from provider respectively. Examples of built-in Content Providers in Android OS are Contacts, MediaStore, Bookmarks, Settings and others [6]. In this project s android application, Contacts, MediaStore and File Provider content providers are used to access and upload android device data like contacts, media files, document files, etc. to the web application server. Following code snippet shows how to query media store content provider for music files: Uri uri = android.provider.mediastore.audio.media.external_content_uri; Log.i(TAG, "Querying media..."); ContentResolver mcontentresolver = getapplicationcontext().getcontentresolver(); Cursor cur = mcontentresolver.query(uri, null, MediaStore.Audio.Media.IS_MUSIC + " = 1", null, null); Log.i(TAG, "Query finished. " + (cur == null? "Returned NULL." : "Returned a cursor."));

34 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: 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 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 as shown below. SharedPreferences mprefs = context.getsharedpreferences(pref_userid, Context.MODE_PRIVATE); Editor prefseditor = mprefs.edit(); prefseditor.putstring(key_id, UserId); 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

35 24 return if the key isn't present as shown below. SharedPreferences mprefs = context.getsharedpreferences(pref_userid, Context.MODE_PRIVATE); String userid = mprefs.getstring(key_id, ""); return userid; 3.2 Android Environment Setup To get started with android, we have to download Android Studio, which is easy to use Android IDE -Integrated Development Environment. Before Android Studio, we had to use Eclipse IDE and setup the SDK and other pieces of software needed. It was not difficult either but Android Studio makes is easy to use and it makes programming Android easy [7]. So the first step is to make sure that latest Java JDK is installed- at least JDK 6. After that, perform the following steps [7]: 1. First Download Android Studio package from Android Studio Home page ( 2. Install Android Studio by launching the downloaded EXE file, which also installs all of the Android SDK and tools. Android Studio also installs the virtual device. 3. Then you can opt to start Android Studio after the installation. Figure 3.3 shows the welcome screen of Android Studio.

36 25 Figure 3.3 Android Studio Welcome Screen 3.3 Creating Sample Android Application using Android Studio The android project has all files and code required for the android application. The Android Studio IDE installs all the required tools to start coding our application. 1. Android Studio lists all recent projects if you have any and new project can be created by selecting the first option i.e., start a new Android Studio Project. 2. When the new window appears, we need to provide the application's name and location of the project. Figure 3.4 shows the configuration of new project in Android Studio.

37 26 Figure 3.4 New Project Configuration in Android Studio In Android Studio's new project window we need to fill appropriate values like application name to give an application a name like in this sample application the name of application is "RemoteAccessToAndroidDevices". The project location is the project directory and the package name is package namespace for our app, which is "dcreator.com.remoteaccesstoandroiddevices" for this sample project. On clicking next, the screen as shown in Figure 3.5 appears.

38 27 Figure 3.5 Form Factors for a New Project in Android Studio The minimum SDK is the lowest version supported by this application. To support multiple devices, the minimum SDK is set in such a way that the application can perform its basic operations. In Android Studio, there is no need to specify the target SDK [7]. On clicking next, for this sample project we select BlankActivity and click next. The other details are left at default and click Finish. By default, the application stores hello world code and we just need to run it. 3.4 Android Application Files Android application contains various files and they are divided into three categories [7] as follows: Java file Layout file

39 28 Manifest file Java Files The java files handles all the processing of the events that happens and allows user to interact with the system. The java files are very important files of android application. This is the place where definitions of functions like oncreate(), onstart(), onpause(), onstop(), etc. resides. These files are responsible for getting the user inputs and process the activities accordingly. Using these files, the layouts are added dynamically and user entered values in the text boxes can be obtained and stored Layout Files The layout file defines the graphical user interface (GUI) components an activity contains as well as styling of those components. The user can view the layout in the graphical mode and they can even select the device that they desire to view the layout. The layouts can be of different types. Few of them are listed below: Linear Layout In linear layout, like the name suggests all the graphical elements are displayed in linear fashion. The linear fashion can be horizontal or vertical. This layout is mostly used when the graphical components are static and will not change during the course of application. Relative Layout In relative layout, the graphical components are displayed or arranges itself relative to other graphical components. This layout is widely used as position of graphical components may vary according to different screen resolution on different devices. This layout is recommended for

40 29 developers to use as there is large pool of devices with varying screen sizes and resolution. Table Layout In table layout, the graphical components are grouped and displayed into rows and columns. The rows and columns in table layout forms cells and each cell contains a graphical component. This layout is mostly used when information is to be provided to the user in a form like weather information where columns can be date of the month and rows can be various weather information like high temperature, low temperature, etc. 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 Manifest File The manifest file is one of the most important component of the android application [7]. The manifest file stores the essential information about the android application. The manifest file defines the application components such as activity, services, broadcast receivers, content providers, etc. To use any component in the android application, first it has to be defined in the manifest file or else the functionality of that component will not be executed when the application is installed. The manifest file also incorporates any special permissions to be required to run the application. The manifest file defines what version of the Android Operating System, the application is compatible with [1]. It can defined as follows

41 30 <uses-sdk android:minsdkversion="16" android:targetsdkversion="18"/> The developer can define all the activities, their theme etc. in the manifest files as shown below: <activity android:name=".mainactivity" <intent-filter> <actionandroid: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 shown below: <receiverandroid:name=".alarmreceiver"/> For proper execution of the application, the permissions required by it has to be defined in the manifest file. For example, performing a network operation requires android.permission.internet. The permissions are defined in the manifest file as shown below: <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.write_external_storage" />

42 Running the Application Using Android Studio, android application can be run on either device or on android studio's emulator or any other third party emulator like genymotion, which usually loads quickly as compared to Android Studio's emulator On Device To run the application on device, the device has to be connected to the laptop with USB cable. After connecting the device, the option to download and install a USB driver would appear in case if the there is no driver available. Then enable USB debugging on the device under developer option in settings. The last thing to do after enabling USB debugging is to run the app from Android Studio [7]. On Android Studio, Click on run from the toolbar. In the Run as window that appears, need to select running android device and click OK. Figure 3.6 shows the connected devices to install the android application.

43 32 Figure 3.6 Choose Device Dialog box in Android Studio On Emulator When we want to run application on emulator then the first step is to set up the Android Virtual Device. The AVD is a device configuration for the Android emulator that allows to model different devices. The first thing to create AVD, we need to launch the Android Virtual Device Manager option available in the toolbar of Android Studio IDE. The next step is to click on 'Create Virtual Device ' as shown in the Android Virtual Device Manager panel Figure 3.7.

44 33 Figure 3.7 Android Virtual Device Manager Next step is to select the device and API version and fill the name for AVD as shown in Figure 3.8. Figure 3.8 Android Virtual Device Configuration

45 34 Click Finish. The new configured AVD will appear in the Android Virtual Device Manager screen. Then select the desired AVD and press play button to run it. Wait for emulator to boot up and then unlock the locked screen. In order to install and execute the android application, click Run button from toolbar in Android Studio IDE. After clicking the run button the choose device window will open then select the running virtual device and click ok. Android Studio will install and starts application on virtual device [7].

46 35 Chapter 4 FEATURES IMPLEMENTATION 4.1 Remote Access to Android Devices Architecture Remote Access to Android Devices consists of android application and web application. Using web application user can access the contents of their android device. The android application is required to register the android device with the web application server. As shown in Figure 4.1, the first step is to get the android device registered to both GCM server and web application server. The user can register a device using android application by providing a unique id and password combination. In the background, registration process includes the following steps: Figure 4.1 Remote Access to Android Devices Architecture

47 36 1. After user clicks on register button, the request will go to Google Cloud Messaging Server (GCM) server. 2. GCM server will provide registration id for the device. 3. Share registration id with user details to a web application server. 4. Use registration id to send push notification from web application through GCM server to android device. After successful registration of the device, user is allowed to login to android application. A user can login to the web application only after successful login to the android application. Using android application, username and password are sent to a web application server side for authentication. After positive authentication response from web application server to the android application, user gets logged in the android application & then user can log in web application with the same credentials. Using web application user can access the android device contents by clicking on different tabs available on home screen of the web application. When user clicks on any tab, the web application in the background sends request to the android device to upload the content to the web application server. When any content has to be uploaded from the android device, the web application composes the request and sends it to GCM server, which in turn sends the same request to the android device. The Android application receive the request and parses it. Based on the request type, the android application uploads requested data to a web application server and it is displayed using web application to the user. This process goes on as user

48 37 clicks on different available tabs on web application to access different contents from android device. 4.2 Android Application The android application is used for registration of the device and uploading of data to a web application server. It consists of activities for user interaction, services that runs in the background without user interaction for uploading of data to a web application server and broadcast receiver to receive push notification. Let us see the implementation details of android application Register Activity Register activity is used for registration of the android device with the web application server. The user has to provide name, address and password to create new account. Once the account is created successfully, user can use credentials to login into android application as well as into web application. The following code snippet shows background operations performed by registerinbackground() method to register the device with web application server: private void registerinbackground(final String name, final String ,final String password) { new AsyncTask<Void, Void, String>() protected void onpreexecute() { super.onpreexecute(); pdialog.setmessage("registering with GCM..."); protected String doinbackground(void... params) { String msg = "";

49 38 try { if (gcmobj == null) { gcmobj = GoogleCloudMessaging.getInstance(applicationContext); //registering with gcm regid = gcmobj.register(config.google_project_id); msg = "Registration ID :" + regid; Log.d(TAG,msg); catch (IOException ex) { msg = "Error :" + ex.getmessage(); Log.d(TAG, msg); return protected void onpostexecute(string msg) { if (!TextUtils.isEmpty(regId)) { registeruser(name, , password); hidedialog(); //make toast for successful registration Toast.makeText(getApplicationContext(),"Registration Successfull", Toast.LENGTH_LONG).show(); else { hidedialog(); Toast.makeText(getApplicationContext(),"Registration UnSuccessfull", Toast.LENGTH_LONG).show(); Log.d(TAG,"Registration Unsuccessfull"); //end of outer post execute.execute(null, null, null); After sending a registration request to the web application server, the server validates and adds the user details to its database & sends back the registration acknowledgement message to the android application. The server looks for any existing user with the same id in its database & if the same id is found in the database, the server sends the unsuccessful registration message to the android application.

50 39 Following is the PHP code snippet that adds new user details to the web server s database: if ($tag == 'register') { // Request type is Register new user $name = $_POST['name']; $ = $_POST[' ']; $password = $_POST['password']; // check if user is already existed if ($db->isuserexisted($ )) { // user is already existed - error response $response["error"] = TRUE; $response["error_msg"] = "User already existed"; echo json_encode($response); else{ // store user $user = $db->storeuser($name, $ , $password); if($user) { // user stored successfully $response["error"] = FALSE; $response["uid"] = $user["uid"]; $response["user"]["name"] = $user["name"]; $response["user"][" "] = $user[" "]; $response["user"]["created_at"] = $user["created_at"]; $response["user"]["updated_at"] = $user["updated_at"]; $response["user"]["gcm_regid"] = $user["gcm_regid"]; echo json_encode($response); else{ // user failed to store $response["error"] = TRUE; $response["error_msg"] = "Error occured in Registartion"; echo json_encode($response); Figure 4.2 shows the register activity through which registration of user can be performed.

51 40 Figure 4.2 Register Activity Login Activity Login activity is used to login to the android application and this activity is popped when user opens the android application. In addition, the login activity contains register button that directs to the register activity. If the user has already registered, then user can login into the application with correct credentials and once the web application server authenticates the user successfully, the user is directed to the Home activity where the user has other options. After logging into the android application, the user can login into the web application and access the contents of android device. Following code snippet shows login function written in java programming language for android application: private void checklogin(final String , final String password) { StringRequest strreq = new StringRequest(Request.Method.POST,

52 Config.APP_SERVER_URL, new Response.Listener<String>() public void onresponse(string response) { Log.d(TAG, "Login Response: " + response.tostring()); hidedialog(); try { JSONObject jobj = new JSONObject(response); boolean error = jobj.getboolean("error"); // Check for error node in json if(!error) { String uid = jobj.getstring("uid"); JSONObject user = jobj.getjsonobject("user"); String = user.getstring(" "); // Launch home activity Intent intent = new Intent(LoginActivity.this,MainActivity.class); startactivity(intent); finish(); else { String errormsg = jobj.getstring("error_msg"); Toast.makeText(getApplicationContext(), errormsg, Toast.LENGTH_LONG).show(); catch(jsonexception e) { // JSON error e.printstacktrace(); Log.d(TAG,"CompleteTrace"+Log.getStackTraceString(e));,new Response.ErrorListener() public void onerrorresponse(volleyerror error) { Log.e(TAG, "Login Error: " + error.getmessage()); Toast.makeText(getApplicationContext(), error.getmessage(), Toast.LENGTH_LONG).show(); hidedialog(); protected Map<String, String> getparams() { 41

53 42 // Posting parameters to login url Map<String, String> params = new HashMap<String, String>(); params.put("tag", "login"); params.put(" ", ); params.put("password", password); return params; ; // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_string_req); After sending a login request to the web server, the server authenticates the user & sends back the acknowledgement. The server looks for the user in its database & if the user is found in database, the server validates the password and responds appropriately. Following PHP code snippet shows authentication of user at the server side: if($tag == 'login'){ // Request type is check Login $ = $_POST[' ']; $password = $_POST['password']; $gcm_regid=$_post['regid']; // check for user in database $user = $db->getuserby andpassword($ , $password); if($user!= false) { $result = $db->addgcm($ , $gcm_regid); if ($result) { # code... // user found, prepare successful response $response["error"] = FALSE; $response["uid"] = $user["uid"]; $response["user"]["name"] = $user["name"]; $response["user"][" "] = $user[" "]; $response["user"]["created_at"] = $user["created_at"]; //$response["user"]["updated_at"] = $user["updated_at"]; echo json_encode($response); else { // user not found, prepare error response

54 43 $response["error"] = TRUE; $response["error_msg"] = "Not valid username or password "; echo json_encode($response); Figure 4.3 shows login activity through which a user can login to the android application. Figure 4.3 Login activity Home Activity Home activity is the activity where the user has options to logout from the application or change the password for the current account. Home activity also displays the web application address that user can visit using PC browser & access his android device contents. Figure 4.4 shows home activity where the user can change the password for the current account or can logout from the application.

55 44 Figure 4.4 Home Activity Change Password Activity To change the password for the current account, the user has to login to the android application and has to click on change password button on home activity as shown in Figure 4.4. After clicking on change password, the user is directed towards change password activity. In the change password activity, the user provides new password and clicks on change password button to change the password for current account. Following code snippet shows how a user is directed from home activity to change password activity: private void changepassword(final String ) { if(!textutils.isempty( )) { Intent myintent = new Intent(MainActivity.this,

56 45 ChangePasswordActivity.class); startactivity(myintent); In the change password activity, user has to provide new password and click on change password button to change the password. Following is the code snippet that sends change password request to a web application server: private void change_password(final String , final String password) { // Tag used to cancel the request String tag_string_req = "req_changepassword"; pdialog.setmessage("changing password..."); showdialog(); StringRequest strreq = new StringRequest(Method.POST, Config.APP_SERVER_URL, new Response.Listener<String>() public void onresponse(string response) { Log.d(TAG, "Register Response: " + response.tostring()); //put data into SQLite database try { JSONObject jobj = new JSONObject(response); boolean error = jobj.getboolean("error"); if (!error) { String errormsg = jobj.getstring("error_msg"); Log.e(TAG, "Password changed successfully: " + errormsg); Toast.makeText(getApplicationContext(), errormsg, Toast.LENGTH_LONG).show(); else { // Error occurred in registration. Get the error // message String errormsg = jobj.getstring("error_msg"); Toast.makeText(getApplicationContext(), errormsg, Toast.LENGTH_LONG).show(); catch (JSONException e) { e.printstacktrace(); hidedialog();, new Response.ErrorListener() {

57 public void onerrorresponse(volleyerror error) { Log.e(TAG, "Change Password Error: " + error.getmessage()); Toast.makeText(getApplicationContext(), error.getmessage(), Toast.LENGTH_LONG).show(); hidedialog(); ) protected Map<String, String> getparams() { // Posting params to register url Map<String, String> params = new HashMap<String, String>(); params.put("tag", "changepassword"); params.put(" ", ); params.put("password", password); return params; ; // Adding request to request queue AppController.getInstance().addToRequestQueue(strReq, tag_string_req); Upon receiving the change password request, the web application server finds the user in the database and updates its password column with new password. Below is the web server code snippet for changing the password for current user written in PHP language: if($tag == 'changepassword') { // Request type is check Login $ = $_POST[' ']; $password = $_POST['password']; // check for user $user = $db->change_password($ ,$password); if($user!= false) { // user found $response["error"] = FALSE; $response["error_msg"] = "Password changed successfully"; echo json_encode($response);

58 47 Figure 4.5 shows the change password activity on an android application through which a user can change the password for the current account. Figure 4.5 Change Password Activity GCM Notification The broadcast receiver component of android application is used for performing certain task when certain event occurs i.e. broadcast receiver comes into action when certain event occurs as explained in chapter 3. In our android application, broadcast receiver comes into action when there is a push notification from GCM server, which is nothing but a request from web application to upload data to a web application server. The dormant broadcast receiver comes into action and starts the service for processing that notification. The service then parses the request and uploads the requested data to a web application server.

59 48 Following code shows broadcast receiver named GCMBroadcastReceiver that comes into action when the android device receives GCM notification and it starts the service named GCMNotificationIntentService, which parses the request and uploads the data to a web application server. public class GcmBroadcastReceiver extends WakefulBroadcastReceiver public void onreceive(context context, Intent intent) { ComponentName comp = new ComponentName(context.getPackageName(), GCMNotificationIntentService.class.getName()); startwakefulservice(context, (intent.setcomponent(comp))); setresultcode(activity.result_ok); 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 android application uses similar Async Task to register device with the application server. An asynchronous task is defined by three generic types, called Params, Progress and Result, and 4 steps, called on PreExecute, doinbackground, onprogressupdate and onpostexecute. [8] Our service makes used of the following three:

60 49 1. onpreexecute(): This is the first method that gets executed in async task. This step is used to show the dialog boxes on the screen with messages to know the user about the type of processing happening in the background. 2. 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 last step. We use this to register our device with the GCM server and get the registration id that will be used for push notification. 3. 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. In this step we hide or remove any dialog boxes that were shown during the execution of doinbackground method and we process the parameters passed by the doinbackground method. In our application, doinbackground passes the GCM registration id to onpostexecute method for sharing it with the application server which again can call another async task. Below is the code snippet for registration of android device with GCM server using Async Task : private void registerinbackground(final String name, final String ,final String password) { new AsyncTask<Void, Void, String>() protected void onpreexecute() { super.onpreexecute(); pdialog.setmessage("registering with GCM..."); showdialog();

61 protected String doinbackground(void... params) { String msg = ""; try { if (gcmobj == null) { gcmobj = GoogleCloudMessaging.getInstance(applicationContext); //registering with gcm regid = gcmobj.register(config.google_project_id); msg = "Registration ID :" + regid; Log.d(TAG,msg); catch (IOException ex) { msg = "Error :" + ex.getmessage(); Log.d(TAG,msg); return protected void onpostexecute(string msg) { if (!TextUtils.isEmpty(regId)) { registeruser(name, , password); hidedialog(); //make toast for successful registration Toast.makeText(getApplicationContext(),"Registration Successfull", Toast.LENGTH_LONG).show(); //end of outer post execute.execute(null, null, null); 4.3 Web Application When user opens the web application using PC browser, login page is displayed to the user. User can login to the web application with the correct credentials and once he is logged in, the web application s home page is displayed. The user can perform any available option from home page. The user can access different contents from their android device by clicking on documents tab, contacts tab, pictures tab, music tab and

62 51 videos tab. The web application s front end is implemented using HTML, CSS and JavaScript and its server using PHP language. Figure 4.6 shows the web application s home page where different tabs are present which are discussed in the following section. Figure 4.6 Web Application Home Screen Documents Tab Documents tab is a dropdown tab that contains different options like PDF files, word files, excel files and presentation files. Figure 4.7 shows the documents dropdown tab.

63 52 Figure 4.7 Documents Tab User can click on any of the file type under documents tab to upload all files of that type from the android device to the web application server. When user clicks on any of the file type, the JavaScript function is called, which in turn calls PHP function asynchronously that composes the clicked file type request. Following is the JavaScript code snippet to call PHP function asynchronously with PDF files request: function receive_pdf(){ var data = "request_type=files_pdf"; $.ajax({ url: "content_provider.php", type: 'POST', data: data, beforesend: function() {, success: function(data, textstatus, xhr) { //hook the element here and add push return data to that element var json = $.parsejson(data); if(json.request_type!= 'request_pending'){ var output=json.content.content;

64 53 $('#placeholder').append(output); $('#mymain').unblock(); listfilter(); else { settimeout(function(){ receive_pdf();, 2000);, error: function(xhr, textstatus, errorthrown) { ); return false; The PHP function is used to compose a request that contains request id and request type and is sent to android device through GCM server. After receiving the request, android application uploads the requested data to the web application server. Following is the PHP code snippet that composes PDF files request: if($request_type=="files_pdf") { $obj=array("request_type"=>$request_type, "content" => array("server_request_id" =>$last_inserted_id,)); $json_obj= json_encode($obj); $pushmessageobject=new sendpushnotification(); $pushmessageobject->sendpushnotification1($json_obj,$uid); $response_obj=array("request_type"=>"request_pending", "content" => array("server_request_id" =>$last_inserted_id, "request_type" =>$request_type, "user_id" =>$uid)); $response_obj=json_encode($response_obj); echo $response_obj;

65 54 The above request is sent to the GCM server, which in turn sends the request to android device as a push notification. Following is the PHP function code snippet to send any type of request to GCM server: function send_push_notification($registatoin_ids, $message) { // Set POST variables $url = ' $fields = array( 'registration_ids' => $registatoin_ids, 'delay_while_idle' => false, 'time_to_live'=>430000, 'data' => $message,); $headers = array( 'Authorization: key='. GOOGLE_API_KEY, 'Content-Type: application/json' ); // Open connection $ch = curl_init(); // Set the url, number of POST vars, POST data curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Disabling SSL Certificate support temporarly curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); // Execute post $result = curl_exec($ch); if ($result === FALSE) { die('curl failed: '. curl_error($ch)); // Close connection curl_close($ch); //echo $result; The above request is received by broadcast receiver component of the android application and it starts the service, which parses the request and uploads the requested data to web application server.

66 55 Following is the code snippet of android service that searches all PDF files in the android device with the help of media store files content provider and uploads it to web application server: if(request_type.compareto("files_pdf") == 0) { JSONObject message_content = new JSONObject(); try { message_content = receiveddata.getjsonobject("content"); Log.i(TAG, "******Received type:" + request_type + " Server Request ID: " + message_content.getint("server_request_id")); catch (JSONException e) { e.printstacktrace(); JSONObject mainobject = new JSONObject(); JSONArray contentarray = new JSONArray(); try { mainobject.put("server_request_id", message_content.getint("server_request_id")); mainobject.put("request_type", "files_pdf"); catch (JSONException e) { e.printstacktrace(); //Query starts here String TAG = "getfilespdf"; Uri uri = MediaStore.Files.getContentUri("external"); Log.i(TAG, "Querying all pdf Files..."); Log.i(TAG, "URI: " + uri.tostring()); ContentResolver mcontentresolver = getapplicationcontext().getcontentresolver(); String[] projection = { // MediaStore.Files.FileColumns., MediaStore.Files.FileColumns.DISPLAY_NAME, MediaStore.Files.FileColumns.DATA, MediaStore.Files.FileColumns.MEDIA_TYPE, MediaStore.Files.FileColumns.MIME_TYPE, MediaStore.Files.FileColumns.SIZE, MediaStore.Files.FileColumns._ID, ; // only pdf String selectionmimetype = MediaStore.Files.FileColumns.MIME_TYPE + "=?"; String mimetype1 =

67 56 MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf"); String[] selectionargspdf = new String[]{ mimetype1; Cursor cur = mcontentresolver.query(uri,projection, selectionmimetype,selectionargspdf, null); //Query ends here //Column indexes int displayname = cur.getcolumnindex(mediastore.files.filecolumns.display_name); int data = cur.getcolumnindex(mediastore.files.filecolumns.data); int idcolumn = cur.getcolumnindex(mediastore.files.filecolumns._id); // Put contents in item // While loop from here try { if (cur.getcount() > 0) { mainobject.put("count", cur.getcount()); // add each file to Items while (cur.movetonext()) { JSONObject item = new JSONObject(); // item.put("filename:",cur.getstring(displayname)); item.put("file_path",cur.getstring(data)); item.put("file_id",cur.getstring(idcolumn)); contentarray.put(item); ; cur.close(); else { cur.close(); mainobject.put("count", 0); JSONObject item = new JSONObject(); //item.put("filename:",cur.getstring(displayname)); item.put("file_path",jsonobject.null); item.put("file_id",jsonobject.null); contentarray.put(item); catch (JSONException e) { e.printstacktrace(); //after successful in log then send try { mainobject.put("content",contentarray); messagetoserver(message_content.getint("server_request_id"),mainobject.tostring());

68 57 catch (JSONException e) { e.printstacktrace(); After the android service uploads the requested data successfully to the web application server, the requested data is shown to the user using web application. For example, when the user clicks on PDF files from documents tab, all PDF files available on the android device are listed in the content view box. Figure 4.8 shows a list of PDF documents in the content view box of web application where a user can click on the download link for any particular file to download that file to the PC. Figure 4.8 PDF Documents User can even filter the file list by typing keywords in the search box. Similar to PDF files, user can access other file types by clicking on different options under documents tab.

69 58 Figure 4.9 shows saving of document file after clicking on download link. Figure 4.9 Save Document File Contacts Tab When user clicks on contacts tab, all contacts stored in the android device are uploaded to the web application server and are displayed in the content view box of web application. The user can even filter the contacts by typing keywords in the search box which is available in the web application. When user clicks on contacts tab, the web application composes the contacts request and sends it to GCM server. GCM server then sends the request to associated android device as push notification. The broadcast receiver component of the android application comes into action that receives the request & starts the service, which parses the request and uploads the requested data. Following code snippet in PHP that is called by the JavaScript function asynchronously composes contacts request and sends it to the GCM server:

70 59 if($request_type=="contacts") { $obj=array("request_type"=>$request_type, "content" => array( "server_request_id" =>$last_inserted_id)); $json_obj= json_encode($obj); $pushmessageobject=new sendpushnotification(); $pushmessageobject->sendpushnotification1($json_obj,$uid); $response_obj=array("request_type"=>"request_pending", "content" => array( "server_request_id" =>$last_inserted_id, "request_type" =>$request_type, "user_id" =>$uid)); $response_obj=json_encode($response_obj); echo $response_obj; The above request is received by broadcast receiver component of the android application and it starts the service, which parses the request and uploads all contacts to web application server. Following is the code snippet of android service that searches all contacts in the android device with the help of contacts content provider and uploads it to web application server: if(request_type.compareto("contacts") == 0) { JSONObject message_content = new JSONObject(); try { message_content = receiveddata.getjsonobject("content"); Log.i(TAG, "******Received type:" + request_type + " Server Request ID: " + message_content.getint("server_request_id")); catch (JSONException e) { e.printstacktrace(); JSONObject mainobject = new JSONObject(); JSONArray contentarray = new JSONArray(); try { mainobject.put("server_request_id", message_content.getint("server_request_id")); mainobject.put("request_type", "contacts"); catch (JSONException e) { e.printstacktrace();

71 //put contacts in content array here String phonenumber = null; String = null; Uri CONTENT_URI = ContactsContract.Contacts.CONTENT_URI; String _ID = ContactsContract.Contacts._ID; String DISPLAY_NAME = ContactsContract.Contacts.DISPLAY_NAME; String HAS_PHONE_NUMBER = ContactsContract.Contacts.HAS_PHONE_NUMBER; //for phone numbers Uri PhoneCONTENT_URI = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; String Phone_CONTACT_ID = ContactsContract.CommonDataKinds.Phone.CONTACT_ID; String NUMBER = ContactsContract.CommonDataKinds.Phone.NUMBER; //for details Uri CONTENT_URI = ContactsContract.CommonDataKinds. .CONTENT_URI; String CONTACT_ID = ContactsContract.CommonDataKinds. .CONTACT_ID; String DATA = ContactsContract.CommonDataKinds. .DATA; //item is already declared StringBuffer output = new StringBuffer(); ContentResolver contentresolver = getapplicationcontext().getcontentresolver(); Cursor cursor = contentresolver.query(content_uri, null, null, null, null); try { // Loop for every contact in the phone if (cursor.getcount() > 0) { while (cursor.movetonext()) { String contact_id = cursor.getstring(cursor.getcolumnindex(_id)); String name = cursor.getstring(cursor.getcolumnindex(display_name)); int hasphonenumber = Integer.parseInt(cursor.getString(cursor.getColumnIndex(HAS_PHONE_NUMBER))); if (hasphonenumber > 0){ JSONObject item=new JSONObject(); item.put("first_name",name); // Query and loop for every phone number of the contact Cursor phonecursor=contentresolver.query(phonecontent_uri,null,phone_contact_id +" =?",new String[]{contact_id,null); while(phonecursor.movetonext()){ Integer c=1; phonenumber=phonecursor.getstring(phonecursor.getcolumnindex(number)); //output.append("\n Phone number:" + phonenumber); 60

72 61 item.put("phone_number"+c,phonenumber); phonecursor.close(); //// Query and loop for every of the contact[same like above] Cursor cursor=contentresolver.query( content_uri,null, contact_id+ " =?",new String[]{contact_id,null); while( cursor.movetonext()){ = cursor.getstring( cursor.getcolumnindex(data)); //output.append("\n " + ); item.put(" ", ); cursor.close(); contentarray.put(item); // if ends here //try ends here catch (JSONException e) { e.printstacktrace(); //after successful in log then send try { mainobject.put("content",contentarray); //mainobject.put("count",cursor.getcount()); messagetoserver(message_content.getint("server_request_id"),mainobject.tostring()); catch (JSONException e) { e.printstacktrace(); //Contacts ends here After the android service uploads all contacts successfully to the web server, a list of contacts is shown to the user in the content view box of web application. Figure 4.10 shows list of all contacts in the content box of web application where a user can click on any particular contact to view complete details of that contact.

73 62 Figure 4.10 Contacts List Pictures Tab Pictures tab is a dropdown tab that contains different album names, which are present in the android device. User can click on any of the picture album from the dropdown list to fetch all pictures from that album that are stored in the android device. Each album under the pictures tab has unique id, which is used by the web application to compose pictures request. When user clicks on any particular album, JavaScript function is called, which in turn calls PHP function asynchronously that composes pictures request and sends it to GCM server. GCM server then sends the request to associated android device as push notification. The broadcast receiver component of the android application comes into action, which receives the request & starts a service that parses the request and uploads the requested data to a web application server.

74 63 Following is the code snippet in PHP that is called by the JavaScript function asynchronously that composes pictures request and sends it to the GCM server: if($request_type=="album_view") { $obj=array("request_type"=>$request_type, "content" => array("server_request_id" => $last_inserted_id, "item_id"=> $_POST['album_id'])); $json_obj= json_encode($obj); $pushmessageobject=new sendpushnotification(); $pushmessageobject->sendpushnotification1($json_obj,$uid); $response_obj=array("request_type"=>"request_pending", "content" =>array("server_request_id" =>$last_inserted_id, "request_type" =>$request_type, "user_id" =>$uid, "item_id"=>$_post['album_id'])); $response_obj=json_encode($response_obj); echo $response_obj; The above request is received by broadcast receiver component of the android application and it starts the service, which parses the request and uploads all pictures from particular album to web application server. Following is the code snippet of android service that searches all pictures from particular album in the android device with the help of media store content provider and uploads it to web application server: if (request_type.compareto("album_view") == 0) { String albumid=""; JSONObject message_content = new JSONObject(); try { message_content=receiveddata.getjsonobject("content"); albumid=message_content.getstring("item_id"); catch (JSONException e) { e.printstacktrace(); Boolean issdpresent = android.os.environment.getexternalstoragestate().equals(android.os.environment.media_mounted); if (issdpresent) {

75 Cursor c = getapplicationcontext().getcontentresolver().query(mediastore.images.media.exter NAL_CONTENT_URI, new String[]{MediaStore.Images.Media._ID, MediaStore.Images.Media.BUCKET_ID+" LIKE?", new String[] {albumid, null); if (c!= null){ final int imageid_column=c.getcolumnindexorthrow(mediastore.images.media._id); c.movetofirst(); Cursor d; JSONObject mainobject=new JSONObject(); JSONArray contentarray=new JSONArray(); try{ mainobject.put("server_request_id", message_content.getint("server_request_id")); mainobject.put("count",c.getcount()); mainobject.put("request_type","album_view"); mainobject.put("album_id",albumid); mainobject.put("current_page",""); mainobject.put("total_pages",""); catch(jsonexception e){ e.printstacktrace(); Log.i(TAG,"imagesCountValidation: "+c.getcount()); while(!c.isafterlast()){// for each image get the thumb and put in json long imageid=c.getint(imageid_column); Log.i(TAG,"imageId: "+imageid); final BitmapFactory.Options bmoptions=new BitmapFactory.Options(); bmoptions.insamplesize=2; Bitmap bm=mediastore.images.thumbnails.getthumbnail( getapplicationcontext().getcontentresolver(),imageid, MediaStore.Images.Thumbnails.MINI_KIND, bmoptions); ByteArrayOutputStream bao=new ByteArrayOutputStream(); bm.compress(bitmap.compressformat.jpeg,50,bao); byte[]ba=bao.tobytearray(); String ba1=base64.encodetostring(ba,base64.default); Log.i(TAG,"imgData: "+ba1); JSONObject item=new JSONObject(); try{ item.put("pic_id",imageid); item.put("thumb_content",ba1); item.put("file_type","image/png"); contentarray.put(item); catch(jsonexception e){ e.printstacktrace(); 64

76 65 c.movetonext();//while ends try{ mainobject.put("content",contentarray); messagetoserver(message_content.getint("server_request_id"),mainobject.tostring()); catch(jsonexception e){ e.printstacktrace(); c.close(); // album_view ends here After the android service uploads all pictures from the particular album successfully to the web server, it is shown to the user using web application. Figure 4.11 shows all pictures from a particular album in the content view box of web application where a user can click on any picture to view that picture in the content preview box. Figure 4.11 Pictures

77 Music Tab When user clicks on music tab, all music files stored in the android device are uploaded to the web application server and are displayed in the content view box of web application. The user can filter the music list by typing desired text words in the search box. When user clicks on music tab, the web application composes music request and sends it to GCM server. GCM server then sends the request to associated android device as push notification. The broadcast receiver component of the android application comes into action, which receives the request & starts a service, which parses the request and uploads the requested data in this case the video files to a web application server. Following code snippet in PHP that composes music request and sends it to the GCM server: if($request_type=="music") { $obj=array("request_type"=>$request_type, "content" => array("server_request_id" =>$last_inserted_id)); $json_obj= json_encode($obj); $pushmessageobject=new sendpushnotification(); $pushmessageobject->sendpushnotification1($json_obj,$uid); $response_obj=array("request_type"=>"request_pending", "content" => array("server_request_id" =>$last_inserted_id, "request_type" =>$request_type, "user_id" =>$uid)); $response_obj=json_encode($response_obj); echo $response_obj; The above request is received by broadcast receiver component of the android application and it starts the service, which parses the request and uploads all music files to web application server.

78 67 Following is the code snippet of android service that searches all music files in the android device with the help of media store content provider and uploads it to web application server: if(request_type.compareto("music") == 0) {// Music Starts here JSONObject message_content = new JSONObject(); try { message_content = receiveddata.getjsonobject("content"); Log.i(TAG, "******Received type:" + request_type + " Server Request ID: " + message_content.getint("server_request_id")); catch (JSONException e) { e.printstacktrace(); JSONObject mainobject = new JSONObject(); JSONArray contentarray = new JSONArray(); try { mainobject.put("server_request_id", message_content.getint("server_request_id")); mainobject.put("request_type", "music"); catch (JSONException e) { e.printstacktrace(); String TAG = "Music"; Uri uri =android.provider.mediastore.audio.media.external_content_uri; Log.i(TAG, "Querying media..."); Log.i(TAG, "URI: " + uri.tostring()); ContentResolver mcontentresolver = getapplicationcontext().getcontentresolver(); Cursor cur = mcontentresolver.query(uri, null, MediaStore.Audio.Media.IS_MUSIC + " = 1", null, null); Log.i(TAG, "Query finished. " + (cur == null? "Returned NULL." : "Returned a cursor.")); //Columns indexes int displayname = cur.getcolumnindex(mediastore.audio.media.display_name); int data = cur.getcolumnindex(mediastore.audio.media.data); int idcolumn = cur.getcolumnindex(mediastore.audio.media._id); try { // Loop for every music file in the phone if (cur.getcount() > 0) { mainobject.put("count", cur.getcount());

79 68 while (cur.movetonext()) { Log.i(TAG, "ID: " + cur.getstring(idcolumn)); Log.i(TAG, "displayname: " + cur.getstring(displayname) + " data: " + cur.getstring(data)); JSONObject item = new JSONObject(); item.put("file_name",cur.getstring(displayname)); //item.put("file_path",cur.getstring(data)); item.put("file_id",cur.getstring(idcolumn)); contentarray.put(item); cur.close(); else { cur.close(); mainobject.put("count", 0); JSONObject item = new JSONObject(); item.put("file_name",jsonobject.null); item.put("file_path",jsonobject.null); item.put("file_id",jsonobject.null); contentarray.put(item);//try ends here catch (JSONException e) { e.printstacktrace(); //after successful log then send try { mainobject.put("content",contentarray); messagetoserver(message_content.getint("server_request_id"),mainobject.tostring()); catch (JSONException e) { e.printstacktrace(); // Music ends here After the android service uploads all music files successfully to the web server, a list of music files is displayed in the content view box of web application. Figure 4.12 shows a list of music files in the content box of web application where a user can click on download/preview link for any particular music file to play that music file in the content preview box of web application.

80 69 Figure 4.12 Music Files Figure 4.13 shows the music file being played in the content preview box of web application. Figure 4.13 Music Preview

81 Videos Tab When user clicks on videos tab, all video files stored in the android device are uploaded to the web application server and are displayed in the content view box of web application. The user can filter the videos list by typing desired text words in the search box. When user clicks on videos tab, the web application composes videos request and sends it to GCM server. GCM server then sends the request to associated android device as push notification. The broadcast receiver component of the android application comes into action, which receives request & starts a service, which parses the request and uploads the requested data in this case the video files to the web application server. Following code snippet in PHP that composes video request and sends it to the GCM server: if($request_type=="video") { $obj=array("request_type"=>$request_type, "content" => array("server_request_id" =>$last_inserted_id)); $json_obj= json_encode($obj); $pushmessageobject=new sendpushnotification(); $pushmessageobject->sendpushnotification1($json_obj,$uid); $response_obj=array("request_type"=>"request_pending", "content" => array("server_request_id" =>$last_inserted_id, "request_type" =>$request_type, "user_id" =>$uid)); $response_obj=json_encode($response_obj); echo $response_obj; The above request is received by broadcast receiver component of the android application and it starts the service, which parses the request and uploads all video files to web application server.

82 71 Following is the code snippet of android service that searches all video files in the android device with the help of media store content provider and uploads it to web application server: if(request_type.compareto("video") == 0) {// Video starts here JSONObject message_content = new JSONObject(); try { message_content = receiveddata.getjsonobject("content"); Log.i(TAG, "******Received type:" + request_type + " Server Request ID: " + message_content.getint("server_request_id")); catch (JSONException e) { e.printstacktrace(); JSONObject mainobject = new JSONObject(); JSONArray contentarray = new JSONArray(); try { mainobject.put("server_request_id", message_content.getint("server_request_id")); mainobject.put("request_type", "video"); catch (JSONException e) { e.printstacktrace(); //Query starts here String TAG = "getvideo"; //Uri uri = android.provider.mediastore.audio.media.external_content_uri; Uri uri = android.provider.mediastore.video.media.external_content_uri; Log.i(TAG, "Querying video media..."); // Perform a query on the content resolver. The URI we're passing specifies that we // want to query for all video media on external storage (e.g. SD card) ContentResolver mcontentresolver = getapplicationcontext().getcontentresolver(); String[] projection = { MediaStore.Video.VideoColumns._ID, MediaStore.Video.VideoColumns.ALBUM, MediaStore.Video.VideoColumns.BUCKET_DISPLAY_NAME, MediaStore.Video.VideoColumns.CATEGORY, MediaStore.Video.VideoColumns.DATA, MediaStore.Video.VideoColumns.DISPLAY_NAME, MediaStore.Video.VideoColumns.MIME_TYPE, MediaStore.Video.VideoColumns.SIZE, MediaStore.Video.VideoColumns.DURATION,; //Cursor allnonmediafiles = cr.query(uri, projection, selection, selectionargs, sortorder); Cursor cur = mcontentresolver.query(uri,projection, null, null, null); Log.i(TAG, "Query finished. " + (cur == null? "Returned NULL." : "Returned a

83 72 cursor.")); Log.i(TAG, "Listing..."); //Column indexes int displayname = cur.getcolumnindex(mediastore.video.videocolumns.display_name); int data = cur.getcolumnindex(mediastore.video.videocolumns.data); int idcolumn = cur.getcolumnindex(mediastore.video.videocolumns._id); //add other columns afterwards if this works successfully try { if (cur.getcount() > 0) { mainobject.put("count", cur.getcount()); // add each videos to Items while (cur.movetonext()) { JSONObject item = new JSONObject(); item.put("file_name",cur.getstring(displayname)); //item.put("filepath:",cur.getstring(data)); item.put("file_id",cur.getstring(idcolumn)); contentarray.put(item);; cur.close(); else { cur.close(); mainobject.put("count", 0); JSONObject item = new JSONObject(); item.put("file_name",jsonobject.null); //item.put("filepath:",jsonobject.null); item.put("file_id",jsonobject.null); contentarray.put(jsonobject.null); catch (JSONException e) { e.printstacktrace(); //Query ends here //after successful in log then send try { mainobject.put("content",contentarray); messagetoserver(message_content.getint("server_request_id"),mainobject.tostring()); catch (JSONException e) { e.printstacktrace(); //video ends here After the android service uploads all videos files successfully to the web server, a list of video files list is displayed in the content view box of web application.

84 73 Figure 4.14 shows a list of video files in the content view box of web application where a user can click on download/preview link for any particular video file to play it in the content preview box of web application. Figure 4.14 Video Files Figure 4.15 shows the playing of video file in the content preview box of web application.

85 74 Figure 4.15 Video Preview 4.4 Future Work Remote access to android devices provides easy interface for users to access and download the different files like documents and multimedia files stored in android device from any standard web browser. This system can extended in many different ways. The system can be extended to provide the functionality of transferring of files from PC to android device, an option of saving files on any favorite cloud drive and functionality of viewing and sending SMS from the browser. The system design will easily incorporate these changes with minimal reorganization of the code flow.

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

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

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

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

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

PROFILE MANAGER ANDROID APPLICATION. A Project. Presented to the faculty of the Department of Computer Science 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

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

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

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

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

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

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

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

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

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

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 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

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

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

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

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

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

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 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

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

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 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

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

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

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

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

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

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

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

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

Introduction to Android

Introduction to Android Introduction to Android http://myphonedeals.co.uk/blog/33-the-smartphone-os-complete-comparison-chart www.techradar.com/news/phone-and-communications/mobile-phones/ios7-vs-android-jelly-bean-vs-windows-phone-8-vs-bb10-1159893

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

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

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

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

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

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

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

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

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

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

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 App Development

Android App Development Android App Development Outline Introduction Android Fundamentals Android Studio Tutorials Introduction What is Android? A software platform and operating system for mobile devices Based on the Linux kernel

More information

ANDROID DEVELOPMENT. Course Details

ANDROID DEVELOPMENT. Course Details ANDROID DEVELOPMENT Course Details centers@acadgild.com www.acadgild.com 90360 10796 01 Brief About the Course Android s share of the global smartphone is 81%. The Google Certified Android development

More information

Android App Development for Beginners

Android App Development for Beginners Description Android App Development for Beginners DEVELOP ANDROID APPLICATIONS Learning basics skills and all you need to know to make successful Android Apps. This course is designed for students who

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

Remote Workspace. Nubo End User Guide. Version: 1.3 Date: June, Copyright 2017 by Nubo Inc. All rights reserved. Page 1

Remote Workspace. Nubo End User Guide. Version: 1.3 Date: June, Copyright 2017 by Nubo Inc. All rights reserved. Page 1 Nubo End User Guide Version: 1.3 Date: June, 2017 Copyright 2017 by Nubo Inc. All rights reserved. Page 1 Table of Contents ABOUT THIS GUIDE... 3 1. REGISTRATION & ACTIVATION... 4 A. Install the Nubo App

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

Google Maps Troubleshooting

Google Maps Troubleshooting Google Maps Troubleshooting Before you go through the troubleshooting guide below, make sure that you ve consulted the class FAQ, Google s Map Activity Tutorial, as well as these helpful resources from

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

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

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

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 Volley Tutorial

Android Volley Tutorial Android Volley Tutorial by Kapil - Monday, May 16, 2016 http://www.androidtutorialpoint.com/networking/android-volley-tutorial/ YouTube Video Volley is an HTTP library developed by Google to ease networking

More information

Lab 3: Using Worklight Server and Environment Optimization Lab Exercise

Lab 3: Using Worklight Server and Environment Optimization Lab Exercise Lab 3: Using Worklight Server and Environment Optimization Lab Exercise Table of Contents Lab 3 Using the Worklight Server and Environment Optimizations... 3-4 3.1 Building and Testing on the Android Platform...3-4

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

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

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

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

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

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

Android Online Training

Android Online Training Android Online Training IQ training facility offers Android Online Training. Our Android trainers come with vast work experience and teaching skills. Our Android training online is regarded as the one

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

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

Android Essentials with Java

Android Essentials with Java Android Essentials with Java Before You Program o Exercise in algorithm generation Getting Started o Using IntelliJ CE Using Variables and Values o Store data in typed variables Static Methods o Write

More information

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism

1. Implementation of Inheritance with objects, methods. 2. Implementing Interface in a simple java class. 3. To create java class with polymorphism ANDROID TRAINING COURSE CONTENT SECTION 1 : INTRODUCTION Android What it is? History of Android Importance of Java language for Android Apps Other mobile OS-es Android Versions & different development

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

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

TABLE OF CONTENTS. Abstract... ii. Table of Contents... iii. List of Figures... vii. List of Tables... xi. 1. Background and Rationale...

TABLE OF CONTENTS. Abstract... ii. Table of Contents... iii. List of Figures... vii. List of Tables... xi. 1. Background and Rationale... ABSTRACT Sponsorship is an Android app which sets up an online platform for sponsorship related events. This app allows the users to post their requirements regarding the current ongoing events. The Sponsors

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

Midterm Examination. CSCE 4623 (Fall 2017) October 20, 2017

Midterm Examination. CSCE 4623 (Fall 2017) October 20, 2017 Midterm Examination CSCE 4623 (Fall 2017) Name: UA ID: October 20, 2017 Instructions: 1. You have 50 minutes to complete the exam. The exam is closed note and closed book. No material is allowed with you

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

User Guide Preface Readme Audience Vocabulary Navigation

User Guide Preface Readme Audience Vocabulary Navigation User Guide AJ De Las Alas, Tiffany Chan, Stephanie Tran, Viet Tran 1.0 Preface 1.1 Readme DELTA is an application that belongs to Julie Schweitzer s research group. After the application is opened, the

More information

Android Software Development Kit (Part I)

Android Software Development Kit (Part I) Android Software Development Kit (Part I) Gustavo Alberto Rovelo Ruiz October 29th, 2010 Look & Touch Group 2 Presentation index What is Android? Android History Stats Why Andriod? Android Architecture

More information

Developing Android applications in Windows

Developing Android applications in Windows Developing Android applications in Windows Below you will find information about the components needed for developing Android applications and other (optional) software needed to connect to the institution

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

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna

Programming with Android: System Architecture. Dipartimento di Scienze dell Informazione Università di Bologna Programming with Android: System Architecture Luca Bedogni Marco Di Felice Dipartimento di Scienze dell Informazione Università di Bologna Outline Android Architecture: An Overview Android Dalvik Java

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

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

End User Manual. December 2014 V1.0

End User Manual. December 2014 V1.0 End User Manual December 2014 V1.0 Contents Getting Started... 4 How to Log into the Web Portal... 5 How to Manage Account Settings... 6 The Web Portal... 8 How to Upload Files in the Web Portal... 9 How

More information

Mobile Application Development

Mobile Application Development Mobile Application Development The principal goal of education is to create men and women who are capable of doing new things, not simply repeating what other generations have done. -Jean Piaget Mobile

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

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

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

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

Follow Me an Android Application

Follow Me an Android Application Follow Me an Android Application Requirements Analysis Document CIS 450: Fall 2014 September 15, 2014 Table of Contents Introduction... 3 Proposed System... 3 Functional Requirements... 3 Non-Functional

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

ANDROID APPLICATION DEVELOPMENT COURSE Training Program

ANDROID APPLICATION DEVELOPMENT COURSE Training Program ANDROID APPLICATION DEVELOPMENT COURSE Training Program This Android Application Development Course is a 24 Hours Training Program with Certification. The program is to be developed for Matriculated, Intermediate

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

Drupal Cloud Getting Started Guide Creating a Lab site with the MIT DLC Theme

Drupal Cloud Getting Started Guide Creating a Lab site with the MIT DLC Theme Introduction Drupal Cloud Getting Started Guide Creating a Lab site with the MIT DLC Theme In this Getting Started Guide, you can follow along as a website is built using the MIT DLC Theme. Whether you

More information

NEWPERCEPT ANDROID APPLICATION. A Project. California State University, Sacramento

NEWPERCEPT ANDROID APPLICATION. A Project. California State University, Sacramento NEWPERCEPT 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

More information

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement.

Lecture 1 Introduction to Android. App Development for Mobile Devices. App Development for Mobile Devices. Announcement. CSCE 315: Android Lectures (1/2) Dr. Jaerock Kwon App Development for Mobile Devices Jaerock Kwon, Ph.D. Assistant Professor in Computer Engineering App Development for Mobile Devices Jaerock Kwon, Ph.D.

More information

Sync User Guide. Powered by Axient Anchor

Sync User Guide. Powered by Axient Anchor Sync Powered by Axient Anchor TABLE OF CONTENTS End... Error! Bookmark not defined. Last Revised: Wednesday, October 10, 2018... Error! Bookmark not defined. Table of Contents... 2 Getting Started... 7

More information

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

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II) ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II) Lecture 6: Notification and Web Services Notification A notification is a user interface element that you display outside your app's normal

More information

DSS User Guide. End User Guide. - i -

DSS User Guide. End User Guide. - i - DSS User Guide End User Guide - i - DSS User Guide Table of Contents End User Guide... 1 Table of Contents... 2 Part 1: Getting Started... 1 How to Log in to the Web Portal... 1 How to Manage Account Settings...

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