78
REMIND MY SCHEDULE ANDROID APPLICATION A Project Presented to the faculty of the Department of Computer Science California State University, Sacramento Submitted in partial satisfaction of the requirements for the degree of MASTER OF SCIENCE in Computer Science by Vineeta Bhagbole FALL 2015

REMIND MY SCHEDULE ANDROID APPLICATION A Project …

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

REMIND MY SCHEDULE – ANDROID APPLICATION

A Project

Presented to the faculty of the Department of Computer Science

California State University, Sacramento

Submitted in partial satisfaction of

the requirements for the degree of

MASTER OF SCIENCE

in

Computer Science

by

Vineeta Bhagbole

FALL

2015

ii

REMIND MY SCHEDULE – ANDROID APPLICATION

A Project

by

Vineeta Bhagbole

Approved by:

__________________________________, Committee Chair

Dr. Jinsong Ouyang

__________________________________, Second Reader

Dr. Jun Dai

____________________________

Date

iii

Student: Vineeta Bhagbole

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

iv

Abstract

of

REMIND MY SCHEDULE – ANDROID APPLICATION

by

Vineeta Bhagbole

In today’s fast paced life, keeping track of all the events which has travel schedules is a

tedious task. Though there are number of event reminder and calendar applications

available for android, none of them supports dynamic reminders based on user’s current

location. All the current available applications give an event reminder before a fixed

amount of time from the event start time.

Also, in the current available apps, a user has to separately feed information about all the

events with travel plans for which he/she wants to get reminders. A user can set a fixed

time for notifications to be sent before the event occurs. This requires estimation of the

time required for travel to reach the destination location from a fixed start location and

accordingly set the notification time to avoid delays reaching the destination. This

estimation goes wrong if user starts travelling from different start location. This could

lead to delays or even completely missing the event.

v

With my “RemindMySchedule” android application I am proposing a solution to the

above problem. This application will send dynamic notifications based on user’s current

location, mode of travel, and importance of the schedule. App will automatically sync

only those events which have travel information and send dynamic notifications.

Notification will also include travel route information for users to start navigation.

“RemindMySchedule” also provides the event specific location sharing among selected

group of members to keep track of each other’s whereabouts.

The application has been implemented using Android and its services for the front end.

_______________________, Committee Chair

Dr. Jinsong Ouyang

_______________________

Date

vi

ACKNOWLEDGEMENTS

I would like to express my gratitude to Dr. Jinsong Ouyang, my project advisor for

providing me an opportunity to work on this project, which gave me a great exposure to

develop the skills towards Android Application Development. I thank him for his

generous advice and encouragement which helped me to complete the project

successfully.

In addition, my gratitude is extended to Dr. Jun Dai for his willingness to serve on the

committee.

Lastly, I would like to thank the entire faculty and staff of the Department of Computer

Science Engineering at California State University, Sacramento.

vii

TABLE OF CONTENTS

Page

Acknowledgements ............................................................................................................ vi

List of Figures ......................................................................................................................x

Chapter

1. INTRODUCTION .........................................................................................................1

2. PROJECT REQUIREMENTS .......................................................................................3

2.1 User Requirements ...................................................................................................3

2.2 View Scheduled Events ...........................................................................................4

2.3 Event Profiling .........................................................................................................4

2.4 Settings .....................................................................................................................5

2.5 Notifying User .........................................................................................................6

2.5.1 Factors considered for notification time .........................................................6

2.6 Sharing Location with Others ..................................................................................7

2.7 System Requirements...............................................................................................8

2.7.1 Software requirements ....................................................................................8

2.7.2 Hardware requirements ...................................................................................8

3. ANDROID FRAMEWORK AND SOFTWARE ENVIRONMENT............................9

3.1 Components in Android Application .......................................................................9

3.1.1 Activities .......................................................................................................10

3.1.2 Fragments ......................................................................................................13

viii

3.1.3 Services .........................................................................................................14

3.1.4 Broadcast Receivers ......................................................................................17

3.2 Setup for Android Application Development ........................................................21

3.2.1 Prerequisite installations ...............................................................................21

3.3 Creating “Hello World” Sample Android Application ..........................................24

3.4 Running the App ....................................................................................................28

3.4.1 Installing and running an app on physical device .........................................28

3.4.2 Running an app on emulator .........................................................................28

4. FEATURES IMPLEMENTATION - REMINDMYSCHEDULE ..............................29

4.1 Application Installation ..........................................................................................29

4.1.1 Login information .........................................................................................29

4.1.2 Choose an account ........................................................................................31

4.2 Application Home Page .........................................................................................33

4.3 Event Details ..........................................................................................................35

4.3.1 Event date and time .......................................................................................36

4.3.2 Travel route ...................................................................................................36

4.3.3 Check-in ........................................................................................................37

4.3.4 Setting policies for an event ..........................................................................38

4.4 Reminder Settings ..................................................................................................41

4.5 Show Notifications.................................................................................................42

4.5.1 Time to send notification ..............................................................................45

ix

4.6 Check-In and Location Sharing .............................................................................48

4.6.1 Location sharing among group of friends .....................................................51

4.7 Application Testing ................................................................................................56

4.7.1 Dynamic notification ....................................................................................56

4.7.2 Location sharing............................................................................................60

4.8 Future Work ...........................................................................................................64

5. CONCLUSION ............................................................................................................65

References ..........................................................................................................................66

x

LIST OF FIGURES

Figures Page

Figure 2.1 RemindMySchedule Use Case Diagram ............................................................3

Figure 2.2 Display Scheduled Events ..................................................................................4

Figure 2.3 Profiling an Event ...............................................................................................5

Figure 2.4 Location Sharing with Others .............................................................................7

Figure 3.1 Android Activity Life Cycle .............................................................................12

Figure 3.2 Android Service Life Cycle ..............................................................................16

Figure 3.3 Steps to Make BroadcastReceiver ....................................................................17

Figure 3.4 Development Phases in an Android Application..............................................23

Figure 3.5 Starting New Android Project ..........................................................................24

Figure 3.6 Creating New Android Project .........................................................................25

Figure 3.7 “Hello World” Android Application ................................................................26

Figure 3.8 Default File Layout...........................................................................................27

Figure 4.1 Application Installation – Login Screen ...........................................................29

Figure 4.2 Choose an Account ...........................................................................................31

Figure 4.3 Application Home Page ....................................................................................33

Figure 4.4 Event Details ....................................................................................................35

xi

Figure 4.5 Set Event Policies .............................................................................................39

Figure 4.6 Location Check-In ............................................................................................50

Figure 4.7 Create New Group ............................................................................................51

Figure 4.8 Selecting Group and Adding Friends to Group ................................................52

Figure 4.9 Event Details with Default Policies and Settings .............................................56

Figure 4.10 Travel Time to an Event with Default Policies and Settings ..........................57

Figure 4.11 Dynamic Notication for an Event with Default Policies and Settings ...........57

Figure 4.12 Event Details with Customized Policies and Settings ....................................58

Figure 4.13 Travel Time to an Event with Customized Policies and Settings ..................59

Figure 4.14 Dynamic Notification for an Event with Customized Policies and Settings ..59

Figure 4.15 Event Details Window of Two Different Users .............................................61

Figure 4.16 Selected Group Members of Two Different Users .........................................62

Figure 4.17 Check-In Window of Two Different Users ....................................................63

1

Chapter 1

INTRODUCTION

There are bunch of schedule reminder android applications available today on play store

providing static notification to user before a specified interval of time. The static

notifications will not be proven to be useful when travel time for user is considerably

large with respect to reminder set for fixed time. Also this could cause delays in arriving

at event location or even missing an event.

RemindMySchedule is a solution to the above problem. This is a location based reminder

application which dynamically notifies user so that they can be on or before time for an

event.

The application extracts event details from Google calendar. The event details are

assumed to be pre-entered by user in Google calendar, and then application synchronizes

the data with Google calendar. It will run in background to access the user’s current

location and calculate travel time with respect to mode of travel selected by user. The

application allows user to edit/modify each schedule to set the importance as well as

mode of travel. Also user can do profiling for location access and reminder settings.

Based on the provided details and policies set by user the application will intelligently

notify user about the scheduled event. The notification sent to user also includes the

travel information to start navigation.

2

RemindMySchedule also has a very useful feature of location sharing among group of

friends when they have common event. By using this feature a user can find out where

their friends are with respect event location. Also it does not require texting or calling just

to find out exactly where your friend is while they are driving or doing some other work.

3

Chapter 2

PROJECT REQUIREMENTS

2.1 User Requirements

This mobile application is mainly objected to provide user a location-based travel

reminder application. This application not only keeps track of scheduled events, but also

helps user reach event’s destination location on time.

Figure 2.1 shows all the functionality based operations that can be performed by user.

Figure 2.1 RemindMySchedule Use Case Diagram

View Scheduled Events

Set mode of travel

Set notification buffer

time

Prioritize event

Share location with

other user groups

Set Location access (GPS)

time

4

2.2 View Scheduled Events

The application gets the event data from Google calendar and displays the list of first ten

events on application home page.

Figure 2.2 shows the functional flow in application to display scheduled events.

Figure 2.2 Display Scheduled Events

2.3 Event Profiling

This feature allows user to do profiling for individual events. In this user can edit the

mode for travel, priority and add comments for individual event.

Options provided to select mode of travel:

1. Car

2. Transit

Google calendar with

event details

Extract event details

from Google Calendar

Filter first ten events

with some destination

location on it.

Display event list on

application home

screen

5

3. Walking

4. Bicycling

By default the mode of travel is set to “car” and priority is “normal” for all events. Based

on profiling done, user will be notified for an event with travel route to the event location.

Figure 2.3 shows the user actions to do profiling on an event.

Figure 2.3 Profiling an Event

2.4 Settings

A user can do the custom settings for following:

1. GPS time: It is the interval of time at which user’s current location is checked.

For example, if a user enters five minutes, then his/her location will be accessed at

every five minutes of interval.

Tap on an event from

list Display the details of

event: Name of

event, Date and

Time, Venue, Mode

of travel, Priority

and Remarks. Provide user an

option to edit Mode

of travel, Priority

and Remarks for

individual event and

save the changes.

6

2. Buffer time: It is additional time used to notify user before starting travel for

event location. The additional time is decided by user as per his/her convenience

to prepare before start.

2.5 Notifying User

The notification feature of an application is responsible for dynamically notifying the

user prior to start of event based on his/her current location.

2.5.1 Factors considered for notification time

The following factors are considered in sending notifications to user:

1. Buffer time

2. Travel time to event location

3. Event start time

For example: There is an event at 2:00 PM in the afternoon at location ‘Y’.

User’s current location is ‘X’.

Travel time from ‘X’ to ‘Y’ (Mode of travel selected is “car”) is 30 mins.

Buffer time selected by user is 15 mins.

Notification will be sent 30(travel time) + 15(buffer time) = 45 mins prior to event start.

Time at which notification will be sent = 2:00 PM – 0:45 mins = 1.15 PM

Time to send notification = Event start time – (Buffer time + Travel time)

7

2.6 Sharing Location with Others

This feature allows user to share their location with friends and family. The feature will

be useful when an event is common between a group of friends or family members. To

share their location, user has to check-in their current location. And to view other friends

location user has to add people in a group. Once user creates a group user can see the

location of members in that group on Google maps. In this way user’s friend or family

will be able know the user’s location with respect to event location.

Figure 2.4 shows the location sharing flow.

Figure 2.4 Location Sharing with Others

Access user’s current

location through GPS

Provide an option to

check-in current location

Other person can see

the user’s last

checked-in location

on Google maps.

Create a group of friends

with whom you want to

share your location.

8

2.7 System Requirements

An android application can ideally be developed on any of the following platforms:

1. Windows

2. OS X

3. Linux

2.7.1 Software requirements

1. Java Development Kit (JDK) 7 or later version

2. Android SDK

3. Android Studio

2.7.2 Hardware requirements

1. 2 GB RAM minimum, 4 GB RAM recommended

2. 400 MB hard disk space

3. At least 1 GB for Android SDK, emulator system images, and caches

4. 1280 x 800 minimum screen resolution

9

Chapter 3

ANDROID FRAMEWORK AND SOFTWARE ENVIRONMENT

Android is a platform architected in the form of a software stack. The stack components

consist of applications, application frameworks, run-time environment, libraries and

Linux kernel [1]. The operating system is developed by Google and is made open source

so that users can extend the functionality and usefulness of applications. The android

applications are developed in java using android software development kit [2].

An android application is built of different types of components. Each type serves a

distinct purpose and has a distinct lifecycle that defines how the component is created and

destroyed. The application components are activities, services, broadcast receivers,

content providers. These components are loosely coupled by the application manifest file

AndroidManifest.xml. This file has all the essential information about each component of

the application and how they interact [3].

3.1 Components in Android Application

Components used to build “RemindMySchedule” application are:

1. Activities

2. Fragments

3. Services

4. Broadcast receivers

10

3.1.1 Activities

An activity in android represents a single screen with which the user interacts. A single

application can contain several activities that are bound together. Among these several

activities only can be the main activity which handles the main UI functionality when

application is launched. Though an application can have several activities, only one can

be in active state at a time. Each time when a new activity starts previous activity is

stopped but the data is preserved [4].

The main activity in “RemindMyApplication” is named as “MainActivity”. The main

activity is declared as following in AndroidManifest.xml. Intent filter in main activity

describes the operation to be performed for an activity and type of intents to be received.

Others activity components declared in AndroidManifest.xml are “TabbedActivity”,

“ProgramDetailActivity” and “ProgramEditActivity”.

<activity

android:name=".MainActivity"

android:label="@string/app_name" >

<intent-filter>

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>

</activity>

11

All the activities of a running application are managed in an activity stack and every

activity goes through series of states. The state of each Activity is determined by its

position on the activity stack. When a new activity is started, it becomes active and is

placed on the top of the stack. The previous activity always remains below it in the stack,

and will not come to the foreground again until user navigates back using the Back button

so the next activity down on the stack moves up and becomes active [4].

An activity transition through four states while moving in and out of stack at the time of

creation and destruction [4]:

Active or running: An activity in the foreground of the screen (at the top of the

stack) receiving user input.

Paused: An activity is visible but will not have focus.

Stopped: A stopped activity is not visible to user, but will remain in memory

retaining all state information.

<activity

android:name=".TabbedActivity"

android:label="@string/app_name" >

</activity>

<activity

android:name=".ProgramEditActivity"

android:label="@string/app_name"/>

<activity

android:name=".ProgramDetailActivity"

android:label="@string/title_activity_program_detail" />

12

Inactive: An activity that is killed or not yet launched, it’s inactive. An inactive

activity does not exist on activity stack.

Figure 3.1 shows the lifecycle of activity with call back methods that perform operations

when activity moves between these states.

Figure 3.1 Android Activity Life Cycle [5]

13

3.1.2 Fragments

Fragment is a modular approach to design activity. Fragments are mainly used to build a

dynamic user interface where it is required to encapsulate UI components and behavior of

activity into modules. These modules are created using Fragment class within an activity.

A single activity can contain multiple fragments to build a multi-pane UI having their

own layout and lifecycle. Fragments are like sub activities that can be reused in different

activities [6].

The activity component “TabbedActivity” in “RemindMySchedule” application has three

fragment modules named “HomeFragment”, “SettingsFragment” and

“CheckInFragment”. Each of these fragments has their own layout in the activity. To

draw a UI layout for the first time onCreateView() callback method used. This method

returns the root of fragment’s layout or null if the fragment does not provide a UI.

A fragment’s life cycle is dependent on an activity’s life cycle as it resides in an activity.

Also, a fragment’s code resembles a lot like an activity. It contains similar call back

methods like activity onCreate(), onStart(), onPause() and onStop() [6].

The other callback methods of fragment lifecycle used in application are:

onAttach() Used in all three fragments to associate the fragment with activity.

This method takes an activity as argument.

onCreateView() Used in all the three fragments to draw a UI.

14

onActivityCreated() This method is used in “Check-In” fragment to get an

instance of Google map. The object of Google map obtained after

onCreateView() method is associated with the view. It is important to get hold

on to object beyond the life of view so that the map can be used. The instance

can be acquired using getMapAsync() method of SupportMapFragment class.

onResume() Used in all fragments. When this method is called fragment becomes

active.

onDetach() Overridden in all three fragments. Once this method is called a

fragment is no longer associated with the activity.

3.1.3 Services

Services does not require user interface. It performs operation with long run-time in the

background. A service does not have an independent thread, it uses of the main thread

from hosting process. For example we can download some files or play music in

background while getting involved in some other application [7].

“RemindMySchedule” uses two service components “BackgroundService” and

“ShowNotificationService” declared as following in AndroidManifest.xml.

<service android:name=".services.BackgroundService" />

<service>

android:name=".services.ShowNotificationService"

android:exported="false"

<service/>

15

In the above code snippet attribute “android:name” indicates the name of service subclass

that implements service. And the value false in “android:exported” tells system that

service can only be started by components of same application. There are two classes-

“Service” and “IntentService” that we can extend to create a started service [7].

1. Extending IntentService class

It is a service subclass extended in “ShowNotificationService” to handle an

asynchronous task of sending notifications. This class uses

onHandleIntent() method to handle one intent at a time.

2. Extending Service class

A service can handle intents on multiple threads simultaneously. The service base

class is extended in “BackgroundService” and is responsible for fetching

scheduled event data from Google calendar and calculates distance and travel

time to event location.

Typically a service can be in one of following two states [7]:

Started: A service is started when startService() is called by an application

component, such as an activity. A service can run in the background indefinitely,

even if the component that started service is destroyed. It does not returns any

results to caller, thus once a service has done its task it stops itself.

Bound: An application component binds to a service by calling

method bindService(). A bound service allows components to interact with the

16

service, send requests, and get results within same or different processes. A

service runs as long as application component is bound to it and gets destroyed

once it is unbounded.

There are some call back methods which should be overridden depending upon the

implementation, to handle the service lifecycle. Some of the important call back

methods in service are onStartCommand(), onBind(), onCreate(), onDestroy() [7].

Figure 3.2 shows the lifecycle of a service.

Figure 3.2 Android Service Life Cycle [7]

17

3.1.4 Broadcast Receivers

The broadcast receivers are used to register for system or application events. After

registering, receivers will be notified about the events. For example, applications initiate

broadcasts to tell other applications that some data has been downloaded and is available

for use, so the is broadcast receiver will intercept this communication and initiate

appropriate action [8].

Figure 3.3 shows the two important steps to be done to make BroadcastReceiver works

for the system broadcasted intents.

Figure 3.3 Steps to Make BroadcastReceiver

Android System

Broadcast Receiver

Register for intents to observe

Get notifications when intents occurs

18

A broadcast receiver can be registered either statically in android manifest file or

dynamically with Context.registerReceiver() method. In RemindMySchedule application

two dynamically registered receivers are used that receive intents broadcasted by the

system. As the application need to send broadcasts within same application

LocalBroadcastManager class is used to register and send broadcast of intents.

The two dynamic broadcast receivers declared in “RemindMyschedule” are described as

follows:

1. BROADCAST_RESULT_FOR_SETTINGS

When user clicks on check-in button in event details window, the application context

at that particular point is broadcasted as results to the setting window. Following is the

code snippet where results are broadcasted using a LocalBroadcastManager to settings

tab.

The registered receiver for above intent set the selection of group to one selected in

event detail window. By doing this the result of check-in data on event details window

will be consistent with the data on check-in tab. Following is the code snippet of

LocalBroadcastManager broadcaster =

LocalBroadcastManager.getInstance(getApplicationContext());

Intent intent = new Intent(Constants.BROADCAST_RESULT_FOR_SETTINGS);

broadcaster.sendBroadcast(intent);

19

registered receiver for above intent. ArrayAdapter in the below code is used to

convert list of array objects to vertical list of scrollable items.

2. BROADCAST_RESULT_FOR_CHECKIN

When user clicks on check-in button in event details window, the application context

at that particular point is broadcasted as results to the check-in window same as it was

broadcasted to settings window. Following is the code snippet where results are

broadcasted using a LocalBroadcastManager to check-in tab.

receiver = new BroadcastReceiver() {

@Override

public void onReceive(Context context, Intent intent) {

String selectedGroup =

preferences.getString(Constants.SELECTED_GROUP, "");

allGroupsFromPreferences =

preferences.getString(Constants.GROUP_NAMES, "");

groupNamesArray = allGroupsFromPreferences.split(":");

ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),

R.layout.custom_spinner, groupNamesArray);

groupSpinner.setAdapter(adapter);

for(int i=0;i<groupNamesArray.length;i++) {

if(selectedGroup.equals(groupNamesArray[i])) {

groupSpinner.setSelection(i);

break;

}

}

}

};

LocalBroadcastManager.getInstance(getActivity()).registerReceiver((receiver),

new IntentFilter(Constants.BROADCAST_RESULT_FOR_SETTINGS)

);

20

The registered receiver for above intent updates and save the user’s check-in location

on parse cloud. To fetch the user current location ParseGeoPoint() method from parse

android SDK is used. Apart from updating user information on parse cloud, all the

selected group members will receive an email from application account about the

user’s checked-in location. To send the mail to desired recipients on user’s behalf from

application’s email JavaMail API is used. Following is the code snippet of registered

receiver for above intent.

LocalBroadcastManager broadcaster2 =

LocalBroadcastManager.getInstance(getApplicationContext());

Intent intent2 = new Intent(Constants.BROADCAST_RESULT_FOR_CHECKIN);

broadcaster2.sendBroadcast(intent2);

BroadcastReceiver receiver = (context, intent) -> {

if (googleMap!=null&&googleMap.getMyLocation() != null) {

javaApi.sendMail(preferences.getString(Constants.USERNAME, "") + "

Checked In", preferences.getString(Constants.USERNAME, "") + "

have checked In to this Location at http://maps.google.com/?q=" +

googleMap.getMyLocation().getLatitude() + "," +

googleMap.getMyLocation().getLongitude());

update.put("checkin", new

ParseGeoPoint(googleMap.getMyLocation().getLatitude(),

googleMap.getMyLocation().getLongitude()));

update.put("updatedOn", sd.format(new Date()));

update.saveInBackground((e) -> {

if (e == null) {

Toast.makeText(getActivity(), "Success",

Toast.LENGTH_LONG).show();

}

});

}

21

3.2 Setup for Android Application Development

3.2.1 Prerequisite installations

1. JDK Software

A Java Development Kit (JDK) is an environment for writing Java applications. It

consists of tools that developers need to compile, debug and run Java applications.

One can download the appropriate setup version of JDK from Oracle’s website

and follow the instructions of setup wizard to install and configure JDK. And

then, edit the JAVA_HOME from environment variables to point to directory

where the JDK software is located.

2. Android SDK

An Android SDK is a software development kit that allows developers to create

applications on the Android platform. It includes sample source code,

development tools, an emulator, debugger, and required libraries to build Android

else {

Toast.makeText(getActivity(), "Location not found",

Toast.LENGTH_LONG).show();

}

};

LocalBroadcastManager.getInstance(getActivity()).registerReceiver((receiver),

new IntentFilter(Constants.BROADCAST_RESULT_FOR_CHECKIN)

);

22

applications. We can download and install android SDK from android’s official

website as an additional package that comes with android studio or the stand-

alone SDK package [9].

3. Android Studio IDE

We can download the android studio IDE from android developer’s website by

clicking on download link. After the .exe file is downloaded click on the file and

follow instructions on the setup wizard to complete installation [9].

Android Studio is an official integrated development environment supported by

Google for Android application development. It provides variety of useful

features which makes android development much easier. Some these features are

– easy layout editing by dragging and dropping UI components, providing code

suggestions while writing the code, have sample code templates to build common

application features, able to generate multiple apk file generation associated with

same project and gradle-based build automation system [10].

Figure 3.4 Summarizes all the basic steps and development phases involved while

developing an android application.

23

Figure 3.4 Development Phases in an Android Application [11]

24

3.3 Creating “Hello World” Sample Android Application

Steps for creating a sample “Hello World” android application are as follows:

1. To create a new android project on android studio click on start a new Android Studio

Project from the Welcome to Android Studio screen.

Figure 3.5 shows the “Welcome to Android Studio” screen.

Figure 3.5 Starting New Android Project

25

If a project is already opened select File\New Project from menu to create a new

android project.

Figure 3.6 shows the “New Project” screen.

Figure 3.6 Creating New Android Project

Configure the new project by entering the Application name and Company Domain in

text field. The Package Name will automatically get changed based on

the Application name and Company Domain which uniquely identifies an app among

other apps. The Project location holds the project files at specified location.

Click next for next part of the project setup.

26

2. The next screen “Target Android Devices” allows user to select the target android

device for which app will be developed. The option Phone and Tablet is preselected

as the default. The SDK selected from drop down menu is the minimum version of

Android required to run the app being developed. Click next.

3. Select a blank activity from “Add an activity to Mobile” window and click next.

4. Then from “Customize the Activity” window user can customize an activity by

changing activity name, layout name, title for activity and menu resource name as

desired. Click the Finish button at bottom right of the window.

The android project now created is simply a “Hello World” app with some auto generated

files. Figure 3.7 shows a sample “Hello World” app.

Figure 3.7 “Hello World” Android Application

27

Figure 3.8 shows the layout of default files generated while creating a sample “Hello

World” application.

Figure 3.8 Default File Layout

28

3.4 Running the App

An android application can be run on a physical device with android platform or on an

emulator.

3.4.1 Installing and running an app on physical device

Connect the device with system through USB cable, then enable USB debugging

on device from settings > about phone and tap on build number a couple of times

until debugger mode is enabled.

Click run from the toolbar. Choose the connected running device under “Choose

device” window and click ok. The application will get installed and started by

android studio on the connected device [12].

3.4.2 Running an app on emulator

To run an app on emulator, it is required to create an android virtual device

(AVD) under Tools > Android > AVD Manager, select the required device

configurations and click next. Then select the system image for AVD and click

next. Verify the configuration and click finish.

Click on run from the toolbar after AVD is created. Select the launch emulator

option on “Choose device” window. Then select the AVD created and click ok.

The emulator will get loaded automatically in few minutes [12].

29

Chapter 4

FEATURES IMPLEMENTATION – REMINDMYSCHEDULE

4.1 Application Installation

4.1.1 Login information

The application installation requires user of app to enter his “name” and “email address”

at login screen. The information entered at login screen is associated with other details

such as user’s check-in location so that they can share location with other app users.

Figure 4.1 shows the login screen popped up while installing application.

Figure 4.1 Application Installation – Login Screen

30

The data entered by user at login screen is stored on parse cloud, and to do this data is

built around ParseObject named “userDetails”. ParseObject “userDetails” contains two

key-value pairs one for name and the other for email. Once the key-value pairs are set

data can be saved on backend using saveInBackground() method.

Following is the code snippet for login screen.

userDetails.put("name", name.getText().toString());

userDetails.put("email",email.getText().toString());

userDetails.saveInBackground(new SaveCallback()

{

@Override

public void done(ParseException e)

{

if(e==null)

{

edit.putString(Constants.USERNAME,name.getText().toString());

edit.putString(Constants.EMAIL,email.getText().toString());

edit.commit();

Intent intent = new Intent(getActivity(), TabbedActivity.class);

startActivity(intent);

getActivity().finish();

}

else

{

Toast.makeText(getActivity(),"Some issue with

server",Toast.LENGTH_LONG).show();

}

}

});

31

4.1.2 Choose an account

Once user has entered the login information user is prompted to choose an account. The

account selected will be synchronization with Google calendar.

Figure 4.2 shows the screen where user is asked to choose an account.

Figure 4.2 Choose an Account

32

To make an account selection and managing authorization of the account Google

AccountManager Class is used. It provides access to a centralized database which

contains the registry of user's online accounts. After the user choose an account and

clicks OK, the Google account name will get set by using setSelectedAccountName()

method of class GoogleAccountCredential.

Below is the functional flow of code where user selects an account.

case REQUEST_ACCOUNT_PICKER:

if (resultCode == getActivity().RESULT_OK && data != null &&

data.getExtras() != null)

{

String accountName =

data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);

if (accountName != null)

{

credential.setSelectedAccountName(accountName);

SharedPreferences settings = preferences;

SharedPreferences.Editor editor = settings.edit();

editor.putString(PREF_ACCOUNT_NAME, accountName);

editor.commit();

}

}

else if (resultCode == getActivity().RESULT_CANCELED)

{

mStatusText.setText("Account unspecified.");

}

break;

case REQUEST_AUTHORIZATION:

if (resultCode != getActivity().RESULT_OK)

{

chooseAccount();

}

break;

33

4.2 Application Home Page

The application home page will display the list of upcoming events. It extracts/sync events

information from Google calendar using Google calendar API.

Figure 4.3 shows the list of events on application home page.

Figure 4.3 Application Home Page

The application user interface is designed as a tabbed activity in which user can navigate

across the tabs by swiping over views with a title strip on top. The template includes three

fragment sections, PagerTitleStrip, SectionPagerAdapter to manage section fragments and

ViewPager to host the section contents.

34

To extract the event data from Google calendar AsyncTask class is used. It allows fetching of

event data from Google calendar using Google calendar API call in background using

doInbackground() method which ensures that UI stays responsive. Once the background

thread finishes its task onPostExecute() method is called which publishes the result in main

UI thread. To publish the results on main UI window ArrayAdapter is used. The Array

adapter converts an ArrayList of objects into View items loaded into the ListView (visual

representation) container.

The following code snippet shows the background operations performed by

doInBackground() method.

protected List<Program> doInBackground(SingleLocation... params) {

try {

singleLocation = params[0];

listOfPrograms = getDataFromApi();

for (Program program : listOfPrograms) {

TravelDuration distance = getDistanceAndTime(program, params[0]);

travelDurations.add(distance);

System.out.println("DISTANCE FROM:" + program.getLocation() + "--> TO:

lat:" + params[0].getLatitude() + "Long:" +

params[0].getLongitude() + "-->" + distance.getDuration()+"

-->"+distance.getSeconds());

}

} catch (final GooglePlayServicesAvailabilityIOException availabilityException) {

availabilityException.printStackTrace();

} catch (UserRecoverableAuthIOException userRecoverableException) {

userRecoverableException.printStackTrace();

} catch (Exception e) {

e.printStackTrace();

}

return null;

}

35

4.3 Event Details

RemindMySchedule application allows user to view event details. When user select an

event from upcoming event list on application home page event details will be displayed

for that event.

Figure 4.4 shows the event details window.

Figure 4.4 Event Details

The user is able to do following from event details window:

1. View event date and time.

2. View event location and travel route.

3. Check-in and see other user group location.

4. Set policies for an event by editing the event details.

36

4.3.1 Event date and time

User can find the event date and start time on event details window when user tap on an

event.

4.3.2 Travel route

Event details window also provides the travel route information to user to have a quick

look on routed path in Google maps. User can view the route information by clicking on

navigate button. This feature helps user to get a prior idea of event location about how far

it is from his current location.

When user clicks on “navigate” button intent named “notificationIntent” is created to

start a new activity as Google maps with route details from current location to event

location. Following is the code snippet demonstrating the application behavior when user

clicks on navigate button on event details window.

navigate.setOnClickListener(new View.OnClickListener() {

@Override

public void onClick(View view) {

Intent notificationIntent = new Intent(android.content.Intent.ACTION_VIEW,

Uri.parse("http://maps.google.com/maps?f=d&daddr=" +

program.getLocation()));

startActivity(notificationIntent);

}

});

37

4.3.3 Check-in

This will allow user to check-in his current location and also user can see other

application user’s location.

When user clicks on “Check In” button the current activity is closed using finish()

method. And the ActivityResult is propagated back to whoever launched the activity

using onActivityResult() internally. Also the selected group information form event

details window is saved. Following is the code to show the application behavior when

check-in button is clicked from event details window.

Once the selected group information is saved TabbedActivity current position is set to

Check-In fragment and sendResult() method is called which broadcasts the results to

“Settings” and “Check-In” fragment using LocalBroadcastManager.

checkin.setOnClickListener((view) -> {

finish();

String groupSelected =

preferences.getString("GROUPNAME"+program.getId(),"");

preferences.edit().putString(Constants.SELECTED_GROUP,groupSelected)

.commit();

TabbedActivity.mViewPager.setCurrentItem(2);

sendResult();

}

});

38

Following is the code for sendResult() method where to intents are created named

“intent” and “intent2”. The “intent” is created to broadcast result to “Settings” fragment

and “intent2” is created to broadcast result to “Check-In” fragment.

4.3.4 Setting policies for an event

RemindMySchedule allows user to set policies for specific event. To set policies for an

event click on edit icon in event details screen. Once user clicks on edit button user will

be prompted with editable fields for following:

1. Priority of schedule: A priority can be set to either normal, high and low.

2. Mode to travel: In mode of travel user can specify the transportation mode to be

used by him/her for individual events. Travel mode could be any of the four travel

modes driving, walking, bicycling and transit provided by Google maps.

public void sendResult()

{

LocalBroadcastManager broadcaster =

LocalBroadcastManager.getInstance(getApplicationContext());

Intent intent = new

Intent(Constants.BROADCAST_RESULT_FOR_SETTINGS);

broadcaster.sendBroadcast(intent);

LocalBroadcastManager broadcaster2 =

LocalBroadcastManager.getInstance(getApplicationContext());

Intent intent2 = new

Intent(Constants.BROADCAST_RESULT_FOR_CHECKIN);

broadcaster2.sendBroadcast(intent2);

}

39

3. Location sharing group: In this user can select a group with whom he want to

share his location and vice versa.

4. Remarks

Figure 4.5 shows the edit window for a selected event

Figure 4.5 Set Event Policies

When user clicks on “edit” icon all the event policies description will replaced by

editable fields and the save button icon will be visible in place of an edit icon. Following

code shows the tasks performed while edit button is clicked for example “View” of the

fields changed to editable text or a spinner.

40

edit.setOnClickListener((v) -> {

if (isEdit)

{

edit.setImageResource(android.R.drawable.ic_menu_save);

isEdit = false;

remarks.setVisibility(View.GONE);

remarksEditText.setVisibility(View.VISIBLE);

modeofcommute.setVisibility(View.GONE);

modeofcommutespinner.setVisibility(View.VISIBLE);

priority.setVisibility(View.GONE);

priorityspinner.setVisibility(View.VISIBLE);

remarksEditText.setText(program.getRemarks());

modeofcommutespinner.setSelection(program.getWayOfCommute() - 1);

priorityspinner.setSelection(program.getPriority() - 1);

group.setVisibility(View.GONE);

groupspinner.setVisibility(View.VISIBLE);

String groupName = preferences.getString("GROUPNAME"

+program.getId(), null);

if (groupName == null)

{

groupspinner.setSelection(0);

}

else

{

for (int i = 0; i < groupNamesArray.length; i++)

{

if (groupNamesArray[i].equals(groupName))

{

groupspinner.setSelection(i);

break;

}

}

}

}

41

4.4 Reminder Settings

This feature allows user to do profiling on reminder settings. Profiling options include the

following:

1. GPS time in minutes: It is the time interval at which user’s current location is

accessed.

2. Buffer time in minutes: It is additional time entered by user as per his

convenience. For example buffer time could be the time required by user to wrap

up things and prepare for the event.

The reminder settings can be done from “Settings” tab. The above mentioned profiling

options are provided in editable form to user, a user can simply type in the GPS time and

Buffer time as desired. Also user can edit the “Username” and add members in a group

by adding their email ids in selected group. Once all changes are done user can save the

changes by clicking on “Save” button at bottom of the window. Following is the code

snippet for saving the changes done on “Settings” fragment.

save.setOnClickListener((v) -> {

edit.putString(Constants.GPS_TIME, gpsTime.getText().toString());

edit.putString(Constants.BUFFER_TIME,

bufferTime.getText().toString());

edit.putString(Constants.SHOOTING_EMAIL_ADDRESS,

emailAddresses.getText().toString().trim());

edit.putString(Constants.USERNAME,name.getText().toString());

edit.commit();

createAlarm(getActivity());

Toast.makeText(getActivity(), "Saved successfully",

Toast.LENGTH_LONG).show();

42

4.5 Show Notifications

The application provides a feature to send dynamic notifications to user based on his

current location and mode of travel. The dynamic notification helps user to reach their

event location on time. Notification also includes the travel route information for users to

start navigation. User can navigate to the event location by clicking on notification sent.

To send dynamic notifications to user the application will run following tasks in the

background:

1. Access user’s current location at specified intervals.

To access last known location of user, device’s last known location is requested

using one of the Google Play services location APIs called FusedLocationAPi.

This API registers for the location updates using a public method called

requestLocationUpdates(). Following is the code showing how to get the location of

application user using services provided by Google.

protected void startLocationUpdates()

{

LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient,

mLocationRequest, this);

final LocationManager manager = (LocationManager)

getSystemService(Context.LOCATION_SERVICE);

if (!manager.isProviderEnabled(LocationManager.GPS_PROVIDER))

{

stopCurrentService();

}

}

43

2. Calculate travel time between user’s current location and an event location.

The travel time and distance between source and destination points is retrieved in

background using Google maps Distance Matrix API. To make a request to retrieve

data url of form “https://maps.googleapis.com/maps/api/distancematrix/json?”

is used. JSON in the url indicates the form of output. The url is then appended with

the required parameters using StringBuilder. In following code we see that required

parameter append to url are origin (user’s current location), destination (event

location), mode of commute and application’s API key. Response to request is

returned in the JSON format. The response received is then parsed for text and

value fields which indicate travel time and distance respectively.

StringBuilder urlString = new StringBuilder();

urlString.append("https://maps.googleapis.com/maps/api/distancematrix/json?");

urlString.append("origins=");//from

urlString.append(location.getLatitude());

urlString.append(",");

urlString.append(location.getLongitude());

urlString.append("&destinations=");//to

urlString.append(program.getLocation());

urlString.append("&mode=");

urlString.append(wayOfcommuteString);

urlString.append("&sensor=true");

urlString.append("&key=AIzaSyA-Mli_vdtLODqOhizc9ew7oLUFHxu-uog");

System.out.println("URL=" + urlString.toString());

Log.d("xxx", "URL=" + urlString.toString());

// get the JSON And parse it to get the directions data.

HttpURLConnection urlConnection = null;

URL url = null;

url = new URL(urlString.toString().replace(" ", "%20"));

44

urlConnection = (HttpURLConnection) url.openConnection();

urlConnection.setRequestMethod("GET");

urlConnection.setDoOutput(true);

urlConnection.setDoInput(true);

urlConnection.connect();

InputStream inStream = urlConnection.getInputStream();

BufferedReader bReader = new BufferedReader(new InputStreamReader(inStream));

String temp, response = "";

while ((temp = bReader.readLine()) != null) {

response += temp;

}

bReader.close();

inStream.close();

urlConnection.disconnect();

//Sortout JSONresponse

JSONObject object = (JSONObject) new JSONTokener(response).nextValue();

JSONArray array = object.getJSONArray("rows");

//Log.d("JSON","array: "+array.toString());

//Routes is a combination of objects and arrays

JSONObject routes = array.getJSONObject(0);

//Log.d("JSON","routes: "+routes.toString());

JSONArray legs = routes.getJSONArray("elements");

//Log.d("JSON","legs: "+legs.toString());

JSONObject steps = legs.getJSONObject(0);

//Log.d("JSON","steps: "+steps.toString());

JSONObject distance = steps.getJSONObject("duration");

//Log.d("JSON","distance: "+distance.toString());

String sDistance = distance.getString("text");

int iDistance = distance.getInt("value");

TravelDuration travelDuration = new TravelDuration();

travelDuration.setDuration(sDistance);

travelDuration.setSeconds(iDistance);

return travelDuration;

45

4.5.1 Time to send notification

The time to send dynamic notifications depends on following:

1. Travel time required with respect to mode of travel selected.

2. Additional buffer time entered by user.

The above two factors ensures that user gets notified prior enough so that they can be on

or before the scheduled time.

Time to show notification = EventTime – (time required to commute + buffer time)

To setup the reminder for an event “AlarmManager” class is used. This class allows

scheduling an alarm for application that will still be valid even when application is not in

a running state or device is asleep. For this an explicit intent is created describing the

service to be started. The explicit intent is again wrapped within a PendingIntent

“alarmIntent”. When the alarm goes off PendingIntent.getService() is used to broadcast

and wakeup device.

Following code snippet shows the code for method showNotificationForDuration() to

calculate “timeToShowNotification” and to set alarm for an upcoming event.

46

private void showNotificationForDuration(List<Program> listOfPrograms,

List<TravelDuration> travelDurations, SingleLocation singleLocation)

{

if (listOfPrograms != null && travelDurations != null)

{

for (int i = 0; i < listOfPrograms.size(); i++)

{

Program program = listOfPrograms.get(i);

TravelDuration travelDuration = travelDurations.get(i);

long eventTime = getMillisecondsFromDate(program.getDate());

long currentTime = new Date().getTime();

System.out.println("Current Date-->" + new Date() + " In Milliseconds-->" +

currentTime);

System.out.println("Program Date-->" + program.getDate() + " In

Milliseconds-->" + eventTime);

long timeRemaining = (eventTime - currentTime);

long timeRequiredToCommute = (travelDuration.getSeconds() * 1000);

System.out.println("Time Remaining-->" +

timeRemaining/(60*1000)+"minutes");

System.out.println("Time Required For Commute-->" +

timeRequiredToCommute/(60*1000)+"minutes");

int id = settings.getInt(program.getId(),0);

if(id==0)

{

id=(int)new Date().getTime();

settings.edit().putInt(program.getId(),id).commit();

}

47

if(!settings.getBoolean(program.getId()+Constants.ALARMSET,false))

{

Gson gson = new Gson();

String programJson = gson.toJson(program,Program.class);

String travelDurationJson = gson.toJson(travelDuration,TravelDuration.class);

String singleLocationJson = gson.toJson(singleLocation,SingleLocation.class);

AlarmManager alarmMgr = (AlarmManager)

getSystemService(Context.ALARM_SERVICE);

Intent intent = new Intent(this, ShowNotificationService.class);

intent.putExtra(Constants.SINGLE_LOCATION,singleLocationJson);

intent.putExtra(Constants.PROGRAM,programJson);

intent.putExtra(Constants.TRAVEL_DURATION,travelDurationJson);

PendingIntent alarmIntent = PendingIntent.getService(this, id, intent, 0);

Calendar calendar = Calendar.getInstance();

long bufferTime =

Integer.parseInt(settings.getString(Constants.BUFFER_TIME,"30"))*60*1000;

timeRequiredToCommute+=bufferTime;

long timeToShowNotification = eventTime - timeRequiredToCommute;

calendar.setTimeInMillis(timeToShowNotification);

System.out.println("Notification Date" + new

Date(timeToShowNotification).toString());

alarmMgr.set(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(),

alarmIntent);

}

}

}

}

48

4.6 Check-In and Location Sharing

RemindMySchedule also allows user to share their location among group of friends. This

feature is very useful when user needs to share their location with group of friends while

user is driving, or engaged in some other work. This avoids unnecessary call and

messages. By using this feature all users have to do is check-in, and his current location

will be broadcasted among the selected group of friends.

To implement this feature parse android SDK is used. This SDK allows developer to

build a full-featured android app to store data, send push notifications and manage users.

It eliminates the need of maintaining servers by providing complete backend solution.

Each app build using parse has application id and client key applied to SDK install [13].

To store user’s location data on parse ParseObject is used. Each ParseObject has key-

value pairs of JSON-compatible data. For data storing developer has to simply set key-

value pairs, and parse backend will store data. For saving data on parse cloud

saveInBackground() method is used. Once the data is stored using saveInBackground()

parse automatically creates a class and its objectId which is used to distinguish different

sorts of data. The objectId created at the time of saving data on clouds is to retrieve data

using a ParseQuery [13].

The code snippet shows functional flow of application when a user checks-in his location.

49

public View onCreateView(LayoutInflater inflater, ViewGroup container,

Bundle savedInstanceState)

{

if (rootView != null)

{

ViewGroup parent = (ViewGroup) rootView.getParent();

if (parent != null)

parent.removeView(rootView);

}

try

{

rootView = inflater.inflate(R.layout.fragment_check_in2, container, false);

} catch (InflateException e) {

/* map is already there, just return view as it is */

}

// Inflate the layout for this fragment

Button checkIn = (Button) rootView.findViewById(R.id.checkin);

checkIn.setOnClickListener((view) -> {

if (googleMap != null)

{

if (googleMap.getMyLocation() != null)

{

javaApi.sendMail(preferences.getString(Constants.USERNAME, "") + "

Checked In", preferences.getString(Constants.USERNAME, "") + "

have checked In to this Location at http://maps.google.com/?q=" +

googleMap.getMyLocation().getLatitude() + "," +

googleMap.getMyLocation().getLongitude());

update.put("checkin", new

ParseGeoPoint(googleMap.getMyLocation().getLatitude(),

googleMap.getMyLocation().getLongitude()));

update.put("updatedOn",sd.format(new Date()));

update.saveInBackground((e) -> {

if (e == null)

{

Toast.makeText(getActivity(), "Success",

Toast.LENGTH_LONG).show();

}

});

}

50

Figure 4.6 shows the location check-In window

Figure 4.6 Location Check-In

else

{

Toast.makeText(getActivity(), "Wait for the location",

Toast.LENGTH_LONG).show();

}

}

});

if (googleMap != null)

{

plotGeoPoints();

}

return rootView;

}

51

4.6.1 Location sharing among group of friends

Steps of share location among group of friends are:

1. Create a group: To create a group follow the below steps:

i) Go to settings.

ii) Click on edit button under recipients section.

iii) Type the group name in “create new group” section and then click create.

Figure 4.7 shows the create group window.

Figure 4.7 Create New Group

52

2. Select a group from drop down.

3. Type the email address of friends separated by “,” to add them in selected group.

4. Click save button.

Figure 4.8 shows selecting a group from drop down and email address of the

people in the selected group.

Figure 4.8 Selecting Group and Adding Friends to Group

53

5. A user can view the check-in location of other users by following two ways:

a) Go to check-in tab to see the location of friends in a group. The Google map

integrated in check-in tab will show the marked location of friends in a group.

To see the zoom-in location of a friend tap on the name and location of

selected friend will be zoomed in.

b) Or user can also view the event specific check-in information among group of

friends or family from event details window by clicking on check-in button.

Once the user clicks on check-in button they will be redirected to check-in

window with marked location of selected group members for an event.

The method plotGeoPoints() is implemented to mark the location of selected

group of friends. This method does the following task to plot location of friends

on integrated Google map:

i. The emails id’s of the selected group members is extracted from parse

cloud using ParseQuery “query.whereContainedIn()”. This query returns

the objects with acceptable values satisfying the query criteria.

ii. List of objects returned from ParseQuery is individually parsed to get the

check-In information associated with each application user. And to

associate latitude and longitude coordinates with an object

“ParseGeoPoint” is used.

54

iii. Once the latitude and longitude position of object is known

GoogleMap.addMarker() method is used to mark the position on map.

iv. To zoom in marked location GoogleMap.animateCamera() is used, so

that application user can have a closer look of friends location on map.

Below is the code snippet of plotting geographic location of friends.

public void plotGeoPoints()

{

if (googleMap != null)

{

googleMap.clear();

ParseQuery<ParseObject> query = ParseQuery.getQuery("UserDetails");

String emailString =

preferences.getString(preferences.getString(Constants.SELECTED_GROUP, ""), "");

String[] emails = emailString.split(",");

names.setVisibility(View.VISIBLE);

Set<String> mySet = new HashSet<String>();

Collections.addAll(mySet, emails);

for (int i = 0; i < emails.length; i++)

{

query.whereContainedIn("email", mySet);

}

55

query.findInBackground((objects, e) -> {

names.removeAllViews();

for (ParseObject parseObject : objects) {

ParseGeoPoint parseGeoPoint = (ParseGeoPoint)

parseObject.get("checkin");

if (parseGeoPoint != null) {

final LatLng position = new LatLng(parseGeoPoint.getLatitude(),

parseGeoPoint.getLongitude());

MarkerOptions markerOptions = new MarkerOptions();

markerOptions.position(position);

markerOptions.title(String.valueOf(parseObject.get("name")));

markerOptions.snippet("Location " + parseGeoPoint.getLatitude()

+ ", " + parseGeoPoint.getLongitude() + " at " +

String.valueOf(parseObject.get("updatedOn")));

markerOptions.icon(BitmapDescriptorFactory.fromBitmap(drawTextToBitmap(R.d

rawable.ic_mymarker, String.valueOf(parseObject.get("name")))));

googleMap.addMarker(markerOptions);

TextView textView = new TextView(getActivity());

textView.setText(String.valueOf(parseObject.get("name")));

LinearLayout.LayoutParams llp = new

LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,

LinearLayout.LayoutParams.WRAP_CONTENT);

llp.setMargins(0, 10, 0, 0);

textView.setLayoutParams(llp);

textView.setTextColor(Color.BLUE);

textView.setTextSize(20);

textView.setTypeface(null, Typeface.BOLD);

textView.setOnClickListener( (v) -> {

moveToCurrentLocation(position);

});

names.addView(textView);

}

}

});

}

}

56

4.7 Application Testing

4.7.1 Dynamic notification

To validate the feature of dynamic notification some dummy event entries are added to

Google calendar. These event details are synchronized and displayed on

“RemindMySchedule” application. The upcoming event entries are then used to test the

dynamic notification for events with default policies and settings, and also for the

customized ones to verify the full functionality of dynamic notification based on mode of

commute.

1. Steps performed to validate the dynamic notifications for events with default

policies and settings are as follows:

a) Figure 4.9 shows an upcoming event details with default policies and settings.

Figure 4.9 Event Details with Default Policies and Settings

57

b) Figure 4.10 shows the travel time to event location when mode of commute is

car. This step is performed to verify the correctness of time at which

notification is sent to user.

Figure 4.10 Travel Time to an Event with Default Policies and Settings

c) Figure 4.11 shows the dynamic notification for above scheduled event.

Figure 4.11 Dynamic Notication for an Event with Default Policies and

Settings

58

d) Verifying the accuracy of time at which dynamic notification is sent.

Event start time = 11:30 PM (from figure 4.9)

Priority = Normal (default) (from figure 4.9 )

Mode of Commute = Car (default) (from figure 4.9)

GPS frequency (in minutes) = 1 (default) (from figure 4.9)

Buffer time (in minutes) = 30 (default) (from figure 4.9)

Travel time = 4 minutes (from figure 4.10)

Time to show notification = Event time – (Travel time + Buffer time)

= 11:30 PM – (4 minutes + 30 minutes)

= 10:56 PM

2. Steps performed to validate the dynamic notifications for customized event policies

and settings are as follows:

a) Figure 4.12 shows an upcoming event details with customized policies and

settings.

Figure 4.12 Event Details with Customized Policies and Settings

59

b) Figure 4.13 shows the travel time to event location when mode of commute is

walking. This step is performed to verify the correctness of time at which

notification is sent to user.

Figure 4.13 Travel Time to an Event with Customized Policies and Settings

c) Figure 4.14 shows the dynamic notification for above scheduled event.

Figure 4.14 Dynamic Notification for an Event with Customized Policies and

Settings

60

d) Verifying the accuracy of time at which dynamic notification is sent.

Event start time = 3:00 PM (from figure 4.12)

Priority = Normal (default) (from figure 4.12)

Mode of Commute = Walking (from figure 4.12)

GPS frequency (in minutes) = 1 (default) (from figure 4.12)

Buffer time (in minutes) = 20 (from figure 4.12)

Travel time = 26 minutes (from figure 4.13)

Time to show notification = Event time – (Travel time + Buffer time)

= 3:00 PM – (26 minutes + 20 minutes)

= 2:14 PM

4.7.2 Location sharing

The location sharing feature of “RemindMySchedule” application is used to share

location between groups of friends having common events. To validate this feature

application is installed among group of users located at different parts of country.

Steps performed for validation are as follows:

1. A common event “Group Study” is created by two users: Vineeta and Chandler.

Both application users create their own group and select the relevant group to a

common event from event details window.

61

Figure 4.15 shows the event details window of a common event between two

different users.

User 1: Vineeta User 2: Chandler

Figure 4.15 Event Details Window of Two Different Users

Note: While creating group user can give any name to group as they like.

Selected group by User1: Group1

Selected group by User2: Friends

62

Figure 4.16 shows the members of selected group on event details window for both

users.

User 1: Vineeta User 2: Chandler

Figure 4.16 Selected Group Members of Two Different Users

Note: The group members were added using email id of the users.

Members added to “Group1” by User 1 (Vineeta): Chandler , Prasanth

Members added to “Friends” by User 2 (Chandler): Vineeta, Prasanth

63

2. The two application users check-in their location from associated event details

window. The checked in location of users is then broadcasted among members. And

users in a group will be able to see each other’s location.

Figure 4.17 shows the check-in window of two different users from the group.

User 1: Vineeta User 2: Chandler

Figure 4.17 Check-In Window of Two Different Users

64

4.8 Future Work

This application intelligently notifies user about the event prior enough so that user can

reach event location on time. It also provides the travel route information by

automatically extracting the event location from database so that user does not have to

separately navigate for event location. The accuracy and efficiency of application to send

dynamic notifications relies upon the profiling done by user. The accuracy of notification

is directly depended upon the frequency of location access. More frequently the location

is accessed more accurate is the result. But frequent location access while application

runs in background could reduce the battery life of device. To prevent this application

can be optimized with an adaptive approach or some algorithm for location check to save

the battery life. The algorithm design should allow application to automatically adjust

the frequency of location check based on event day, time and time left for event.

65

Chapter 5

CONCLUSION

This application is intended to be more useful than existing schedule reminder application

by offering dynamic notifications to user. The application manages the event schedules

for user by keeping track of all the scheduled events. It runs in background to access

user’s current location and also calculates the travel time needed depending upon the

mode of commute. The calculation results are then used to notify user dynamically.

This application also offers an important feature of location sharing among friends. The

feature is developed using parse SDK for android.

66

REFERENCES

[1] Techotopia. "An Overview of the Android Architecture." [Online]. Available:

http://www.techotopia.com/index.php/An_Overview_of_the_Android_Architecture.

Accessed in October 2015.

[2] Wikipedia. "Android software development." [Online]. Available:

https://en.wikipedia.org/wiki/Android_software_development. Accessed in July

2015.

[3] Google Inc. "Application Fundamentals | Android Developers." [Online]. Available:

http://developer.android.com/guide/components/fundamentals.html. Accessed in

July 2015.

[4] Google Inc. "Activities | Android Developers." [Online]. Available:

http://developer.android.com/guide/components/activities.html. Accessed in July

2015.

[5] Best android training. "Android Project Structure and Activity Life Cycle." [Online].

Available: https://bestandroidtraining.wordpress.com/2013/03/30/android-project-

structure/. Accessed in October 2015.

[6] Google Inc. "Fragments | Android Developers." [Online]. Available:

http://developer.android.com/guide/components/fragments.html. Accessed in

October 2015.

67

[7] Google Inc. "Services | Android Developers." [Online]. Available:

http://developer.android.com/guide/components/services.html. Accessed in October

2015.

[8] Google Inc. "BroadcastReceiver | Android Developers." [Online]. Available:

http://developer.android.com/reference/android/content/BroadcastReceiver.html.

Accessed in November 2015.

[9] Google Inc. "Installing the Android SDK | Android Developers." [Online].

Available: http://developer.android.com/sdk/installing/index.html. Accessed in July

2015.

[10] Google Inc. "Android Studio Overview | Android Developers." [Online]. Available:

http://developer.android.com/tools/studio/index.html. Accessed in July 2015.

[11] Google Inc. "Developer Workflow | Android Developers." [Online]. Available:

http://developer.android.com/tools/workflow/index.html. Accessed in November

2015.

[12] Google Inc. "Running Your App | Android Developers." [Online]. Available:

http://developer.android.com/training/basics/firstapp/running-app.html. Accessed in

July 2015.

[13] Parse. "Android Developers Guide." [Online]. Available:

https://parse.com/docs/android/guide. Accessed in November 2015.