6

Click here to load reader

Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

  • Upload
    buitram

  • View
    213

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

Android Application Development for GPS-Based Tree Location Tracker

Engr. Alexander T. Demetillo, Engr. Michelle V. Japitana, Sonny S. Norca

CLAIMS-GIS Project, College of Engineering and Information Technology, Caraga State University, Butuan

City, Philippines [email protected]

[email protected] [email protected]

KEY WORDS: Location Based Services, Network Location Provider, Geofencing, SQLite ABSTRACT: Android application is becoming very popular nowadays due to the expansion of smartphone

devices. With the incorporation of GPS devices in smartphones, Location Based Services (LBS) have become a

trend in the past few years. Using this software application, the user’s current location will be retrieved and then

use the acquired data to provide information for that location. In line with the National Greening Program, the

City Government of Butuan spearheaded the “Balangayan Grow a Million Tree Project”. Funds were allocated

for the various activities associated with this project such as site preparation, seedling production, hauling of

seedlings to planting sites including the maintenance and protection of the established plantations. The CGB needs

to keep a track of the numbers of the seedlings planted so that the funds allocated are justified. There is need of a

tool that will aid the CGB to monitor the site and the seedlings planted in it. With the use of Android Technology

and GPS enabled handset, seedlings may be located anywhere in the field. Once the location is acquired, the

information obtained can then be attached to various media in the form of meta-data. Geotagging is the process

of adding geographical information to photographs. Information such as species name, cost, date planted and

planters are stored in the SQLite. SQLite database is an integral part of the application program, due to the server-

less design of SQLite applications, and this database require less configuration than client server databases. Aside

from Geotagging, Android Technology is also capable of defining a virtual boundary around a real world

geographical area. Geofencing allows automatic alerts to be generated based on the defined coordinates gathered

during surveys. If the surveyor have really entered the area then the administrator will be notified otherwise the

area to be surveyed will be marked as undone. 1. INTRODUCTION Smart phones have become ubiquitous as newer less expensive models with greater feature sets have been released

(Kolhe, 2012). This technology has led to the decline of usage in obtaining the information using the traditional

desktop based approach. One of the widely used operating system for Smart phone is the Android OS. Android is

an open source operating system intended for smart phones, freely available to develop new ideas. Nowadays with

the advent of high-technology, mobile systems are more than that of communicating tool. The most recent and

useful Android application is regarding the use of browsers and GPS navigation system (Kolhe, 2012). Global

Positioning Systems (GPS) is a top priority technology used for locating a device position accurately. Recent

mobile devices have an additional GPS receiver integrated to trace the user location. The researchers have used

GPS as the approach idea for location tracking. The platform used for development is Android Operating System

and it has been proven as the best operating system for a context-aware location based services (Hassan, 2008). Most promising type of contextual information is the proximity selection known as Location Based Service

(Ananya and Venkatalakshmi, 2011). Location Based Services (LBS) have become a trend in the past few years

and is widely used for Location-Aware application for Android. With the incorporation of GPS devices in

smartphones and using cellular network towers, obtaining the user location was made possible. Although GPS is

most accurate it quickly consumes battery power, and doesn't return the location as quickly as users want (Reddy,

2011). Using the assisted GPS, acquiring the location in cellular devices is much faster. Assisted GPS works by

determining user location using cell towers. Very often cellular network towers have GPS receivers (or a base

station nearby) and those receivers are constantly pulling down satellite information and computing the data

(http://www.windowscentral.com), this data is then passed on to the cellular phone when requested. Since

Android’s source code is released by Google under open source licenses it is open for modifications. Android's

open nature has encouraged a large community of developers and enthusiasts to use the open-source code as a

foundation for community-driven projects, which add new features for advanced users

(https://en.wikipedia.org/wiki/Android). To be able to track the seedlings planted in the field, several android

capabilities were integrated with the LBS. Geo-fencing (or geofencing) is a feature in a software program that

uses the Global Positioning System. Application that includes geo-fencing may allow administrators to set up

Page 2: Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

triggers so when a device enter or exits the boundaries created at a certain point of survey, a verification message

is set. Geographic Information obtained during survey will be attached to image captured during survey in the

form of metadata. Geotagging is the process of adding geographical information to photographs, images of the

seedlings is captured which will serve as a proof that the area has been validated.

This application uses GPS that has been integrated with the device. If the device supports assisted GPS then the

device will automatically request for the satellite information from the nearest Network Location Provider. GPS

accuracy may also vary, factors such as weather condition, amount of interference and horizon information: open

fields are faster than canyons or urban environments where buildings can interfere with the satellite-receiver line

of site. 2. MATERIALS AND METHODS 2.1 Android Platform In developing the application, the researchers employed the Eclipse IDE a Java-based open source platform. To

be able to set up new Android project, a plugin was added. Android Development Tool (ADT) was used to extend

the capabilities of eclipse to create the Application User Interface, packages were added based on the Android

Framework API. These API’s facilitate to access the contents on the phone such as contacts and calendar

information and also integrate them with external web-service in order to provide online services. Errors may

occur during the development, for a complete set of debugging tools Android SDK was also integrated. 2.2 Acquire Location

The Google Maps was utilized to provide a visual representation for the user. Google provides a Maps external

library that includes the com.google.android.maps package. The com.google.android.maps package used in this

application offered built-in downloading, rendering, and caching of Maps tiles, as well as a variety of display

options and controls. An additional package called Map View was added to be able to use the maps. A Map View

displays a map with data obtained from the Google Maps service. When the MapView has focus, it will capture

key presses and touch gestures to pan and zoom the map automatically; including handling network requests for

additional maps tiles. It also provides all of the UI elements necessary for users to control the map. To use Google

Maps in the application, a Maps API key had to be obtained to register with the service and Android system had

to be notified that the application wishes to implement the add-on Google APIs which are external to the base

APIs (Reddy, 2011). After setting the map the next thing to consider is how to acquire the user location. Location Listener is another

library added to get the current location of the species. A Location Listener is the interface implemented to receive

location updates. Instead of relying on GPS alone, assisted GPS was also implemented which acquires the location

much faster. Assisted GPS works by determining user location using cell towers. Very often cellular network

towers have GPS receivers (or a base station nearby) and those receivers are constantly pulling down satellite

information and computing the data (http://www.windowscentral.com), this data is then passed on to the cellular

phone when requested. Once the location is acquired the accuracy of that coordinates must be showed, to do that the Location Strategies

was implemented. What this strategy do is to filter the locations according to the provider, time acquired and the

accuracy of the coordinates. During this time, user will receive numerous location fixes from network, WI-FI

provider and GPS. Preserve best location by the filtering algorithm.

The coordinates provided after the filtering process will be used for geotagging and geofencing. In the geotagging

process, images of the seedlings in the field are attached into the coordinates. The group of coordinates collected

will be used for the geofencing. Here the coordinates gathered will be connected to each other to form a polygon.

This polygon will represent the area where the seedlings are planted.

Page 3: Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

Figure 1 A timeline representing the window in which an application listens for location updates

Figure 1 shows this model in a timeline that visualizes the period in which an application is listening for location

updates and the events that occur during that time. Here the application starts at the given time, then sometime

later start listening for updates from desired location provider. After the updates were given, it will now maintain

a current best estimate of location by filtering out new but less accurate fixes. If the best result was given then it

will stop listening for location updates and take advantage of the best location estimate. 2.3 Capture Image To be able to capture images, the application has gained access to the android camera. To be able to integrate the

application and the camera, several codes must be added to the application. To access the device camera,

permission had to be set in the Android Manifest file by including the <uses-permission> as CAMERA and

<usesfeatures> manifest element to declare the camera features used by the application. The Camera class is used to set image capture settings, start/stop preview and snap pictures

(www.developer.android.com). This class manages the actual camera hardware and is the client for the Camera

service. Camera class is not thread safe and is meant for use from only one event. Thus this class’s methods could

not be called from multiple threads at once. MediaStore® is the class which contains the meta-data for all available media on both internal and external storage

devices. ACTION_IMAGE_CAPTURE is the standard intent which is used by the camera application to capture

an image and return it. The EXTRA_OUTPUT parameter is set to store the images captured in the gallery and

name them with the place name previously named by the user. The Application stores the images in the SD card

of the device and can also be viewed in the Image Gallery of the phone (MediaStore®, 2010). 2.4 Store Data The data storage options which the Android supports: Shared Preferences, Internal Storage, External Storage,

SQLite Databases and Network Connection (www.developer.android.com). Tree Tracker uses internal storage,

External Storage and SQLite databases for storing persistent application data. By default, the application once installed is stored in the internal storage of the Android system. This is private to

the application and other applications cannot access it. When the user uninstalls the application, these files get

removed. Since every Android-compatible device supports a shared “external storage” to save files, this application uses

Secure Digital (SD) card to store the images captured. External storage are open to the public and can be read by

all who can access it. It can be modified by the user when connected to a computer and the mode is set to USB

Mass Storage which allows transferring files. Android also provides full support to SQLite databases. All databases that are created in the application are

accessible by name to any class in the application but none outside. This is implemented by creating a sub-class

to SQLiteOpenHelper and overriding the onCreate() method to execute the SQLite command to create the tables

in the databases. The methods on getWritableDatabase and getReadableDatabase are called for write to and read

from the database which return SQLiteDatabase object (SQLiteOpenHelper, 2010).

Page 4: Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

The Android SDK includes a sqlite3 database tool (www.developer.android.com) which is required to browse the

table contents, run SQL commands and perform other SQL functions. Executing an SQL query returns a Cursor

which stores the result set pointing to all the rows found by the query. 3. RESULTS AND DISCUSSION Figure 2 shows that the application has successfully integrated the Google Maps and Location Listener. Here the

Map tiles were downloaded, rendered and cached to provide users with visual representation of his current

location. The Map View can be focused using the capture key presses and touch gestures to pan and zoom the

map automatically. It also provides all of the UI elements necessary for users to control the map. The GPS settings

will automatically pop up in this view providing a user option whether to enable or disable the GPS.

The GPS accuracy was also indicated as well as the type of provider. In this example GPS provides the location

and the accuracy was the result given by the filtering algorithm. Locations were filtered according to the provider,

time acquired and the accuracy of the coordinates. Compared to the WIFI signal, GPS provides the best location

given by the filtering algorithm. On the other hand, Figure 3 shows that the acquired coordinates needed for

creating the boundary. This acquired coordinates during the field validation were grouped according to planters.

Lists of the coordinates obtained are also provided to see to it the number of points needed and the number of

points that were gathered coincides.

Figure 2. Result of the integration of Google maps and Location Listener for location updates.

Figure 3. Result of the gathered coordinates connected to one another for Geofencing

Page 5: Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

Once completed the points will automatically connect to each other. If not then gathering of coordinates can be

resumed next time. This boundary will be use to set up triggers, so when a device enters (or exits) the boundaries

defined by the field evaluator, verification will be sent to the server. All of the text data gathered in this process are stored in the SQLite while the pictures are stored in the SD card. In the Geotagging process, images of the area are captured which will serve as an evidence that the area have been

evaluated. Each points have their corresponding pictures attached shown in Figure 4.

SD card has been chosen as the image storage to address the limit of the phones internal storage. If an SD card is

provided, the capacity of the phone to store files can be extended up to 32GB which very is useful when it comes

to the number of images that can be accommodated in every survey. The resolution of the picture was also reduced during the geotagging process. The pictures that were attached in

the points were decoded so that the phone memory can be save. An image with a higher resolution does not

provide any visible benefit, but still takes up memory and incurs additional performance overhead due to

additional on the fly scaling. Decoding large bitmaps without exceeding the per application memory limit by

loading a smaller subsampled version in memory. With this method OutOfMemory exception will be avoided.

Figure 4. Images attached to the points. And attachment of coordinates to the Image (Geotagging)

Figure 5.Images Captured showing the planted trees for the Balangayan Grow a Million Tree Project

Page 6: Android Application Development for GPS-Based Tree .... Android... · Android Application Development for GPS-Based Tree Location Tracker ... Network Location Provider, Geofencing,

The images that have been captured during the survey are stored in the SD card. The application automatically

creates a folder once the camera used by the application has been activated. This folder will serve as the storage

in which all the images captured by the application are stored. Attached along the images are the date it is captured

and the coordinates as shown in Figure 5. The folder created by the app is used as a reference where the gallery

retrieves the picture from. 4. CONCLUSION With the help of the android technology, Google® APIs and assisted GPS current location are acquired in the

outdoors much faster. However even with the help of AGPS, factors such as amount of interference example

weather conditions and cloudy sky still affects the accuracy of the coordinates given. It will be more appropriate

to conduct field validation under a good weather condition to acquire best results. Because of a faster location

acquisition, less processing power is required by the device so therefore it saves battery life. The images captured

by the device are of high resolution. Errors were avoided when the image sizes were reduced before being

displayed in the application. Scaling down the image is really an efficient way to minimize the memory used by

the application. This application is very simple to use and is helpful to capture multiple coordinates and displaying

geographic information together with the visual representation in the map. 5. ACKNOWLEDGEMENT

The researchers would like to give thanks to the City Government of Butuan for the trust, utmost support and for

funding the Comprehensive Land Information and Management System using GIS (CLAIMS-GIS) Project. Also,

we are very much thankful to the strong support of the Caraga State University in the implementation of this

project.

6. REFERENCES [1] http://www.javacodegeeks.com/2010/09/android-location-based-services.html [2] http://www.windowscentral.com/gps-vs-agps-quick-tutorial [3] https://en.wikipedia.org/wiki/Android_(operating_system).html [4] Android Developers. Android Location Package, 2010. [5] Android Developers. MediaStore, 2010. [6] Android Developers. SQLiteOpenHelper, 2010.

[7] Hassan,Z.S ,”Ubiquitous computing and android,” third international conference on Digital information

management,pp. 166-171,2008.

[8] Vaishali L. Kolhe, 2012. Path Finder and Dictator – GPS Navigation Using TTS Path Algorithm In

Smart Phone p. 84.

[9] Siddartha Sreenivasa Reddy, 2011. Trip Tracker Application on Android, pp. 8-14.

[10] Ananya S., Venkatalakshmi B., 2011. Location Based Intelligent Mobile Organizer p. 488