Smartphone Local Ticketing Application Submitted in partial requirementsof the degree of Bachelor of Engineering by Bhakti Anekar(Roll No.:05) Neelay Upadhyaya(Roll No.:76) Yash Sanghavi(Roll No.:59)

under the guidance of Supervisor: Prof.Kailas Devadkar

Information Technology Sardar Patel Institute of Technology 2013-2014 Project Report Approval for B. E.

This project report entitled Local Ticketing Application by

Bhakti anekar, Neelay Upadhyaya, Yash Sanghavi is approved for the degree of Bachelor of Engineering in Information Technology

Examiners

1. ------

2. ------

Supervisors 1. ------

2. ------

Chairman

------Date: Place:

Declaration

We declare that this written submission represents our ideas in our own words and where others' ideas or words have been included, we have adequately cited and referenced the original sources. We also declare that we have adhered to all principles of academic honesty and integrity and have not misrepresented or fabricated or falsified any idea/data/fact/source in our submission. We understand that any violation of the above will be cause for disciplinary action by the Institute and can also evoke penal action from the sources which have thus not been properly cited or from whom proper permission has not been taken when needed.

------

(Bhakti Anekar-05)

------

(Neelay Upadhyaya-76)

------

(Yash Sanghavi-59) Abstract

One of the biggest challenges in the current ticketing facility is QUEUE in buying our suburban railway tickets. E-ticket facility was introduced where users browse through a government website and book their long journey railway tickets which can be printed out after confirmation to show it to the checker when needed and also a new technology called M-ticketing (Mobile Ticketing) was introduced where customers messaged to the web portal through mobile phones after which a complete web page download to the where users can do the same booking process as it was in the e-ticketing facility. In foreign countries Oyster cards Octopus card has become mandatory during travel. In this fast growing world of technology we still stand in the queue or buy with smart cards or coupons our suburban tickets, which is more frustrating at times to stand in the queue or if we forget our cards.This application Smartphone Ticketing Application(STA) ticketing is mainly to buy the suburban tickets which is the most challenging when compared to booking the long journey tickets through ‘M-ticket’ which fails with suburban(local travel) tickets. Our STA ticket can be bought with just a smart phone application, where you can carry your suburban railway tickets in your smart phone. It uses the smart phones GPS facility to validate and delete your ticket automatically after a specific interval of time once the user reaches the destination. User’s ticket information is stored in a distributed database for security purpose which is missing in the present suburban system. Also the ticket checker is provided with a checker application to search for the user’s ticket with the ticket number in distributed database for checking purposes. Contents

List of Figures iii

Glossary iv

1 Introduction 1 1.1 Problem Definition ...... 1 1.2 Scope ...... 1 1.3 Existing System ...... 2 1.4 Proposed System ...... 2 1.5 Assumptions and Constraints ...... 2 1.5.1 Assumptions ...... 2 1.5.2 Constraints ...... 2 1.6 System Requirements ...... 3 1.6.1 ...... 3 1.6.2 Hardware ...... 3 1.6.3 Web Server Requirements ...... 3

2 Literature Review 4 2.1 Selecting Android as a Development Platform ...... 4 2.2 Analyzing the Railways Website ...... 4 2.3 IEEE paper on Android Suburban Railway Ticketing with GPS as Ticket Checker .5

3 Methodology 6 3.1 Analysis ...... 6 3.1.1 Use Case Diagram ...... 6 3.1.2 Activity Diagram for passenger ...... 8 3.1.3 Activity Diagram for ticket checker ...... 9 3.1.4 Sequence Diagram ...... 10 3.1.5 Collaboration Diagram ...... 11 3.1.6 StateChart Diagram for passenger ...... 12 3.1.7 StateChart Diagram for Ticket checker ...... 13 3.1.8 Class Diagram ...... 14 3.2 Design ...... 15

i 3.2.1 Block Diagram ...... 15 3.2.2 Architecture Diagram ...... 16 3.3 Implementation ...... 16 3.3.1 Technology used ...... 16 3.3.2 Work Breakdown Structure ...... 18 3.3.3 Method Description ...... 19

4 Results 20 4.1 Sample Code for key scenarios ...... 20 4.1.1 User Functions ...... 20 4.1.2 Tracker Fragment ...... 21 4.1.3 QRcode Fragment ...... 25 4.1.4 Booked History Log ...... 26 4.1.5 Insert into log ...... 27 4.2 Test cases ...... 29 4.3 Results Snapshots ...... 30

5 Conclusion and Future Work 36

Appendix - Algorithms 37

References 38

Acknowledgements 49

ii List of Figures

2.1 Comparison of Operating System ...... 4

3.1 Use Case Diagram ...... 6 3.2 Activity Diagram for passengers ...... 8 3.3 Activity Diagram for Ticket checker ...... 9 3.4 Sequence Diagram ...... 10 3.5 Collaboration Diagram ...... 11 3.6 StateChart Diagram for passenger ...... 12 3.7 StateChart Diagram for Tickte checker ...... 13 3.8 Class Diagram ...... 14 3.9 Block Diagram ...... 15 3.10 Architecture Diagram ...... 16 3.11 Work Breakdown Structure ...... 18

4.1 Test Cases ...... 29 4.2 Registration ...... 30 4.3 User Login ...... 31 4.4 User Profile ...... 31 4.5 Edit Profile ...... 32 4.6 Menu...... 32 4.7 Application Popup ...... 33 4.8 Book Ticket ...... 33 4.9 Book Ticket ...... 34 4.10 Passenger Details ...... 34 4.11 Journey Tracker ...... 35 4.12 QR image ...... 35

iii Abbreviations

STA Smartphone Ticketing Application. QR QUick Response. MB Megabyte. GPS Global Positioning System. SDK Software Development Kit. GHz Gigahertz. ms milliseconds.

iv Chapter 1

Introduction

1.1 Problem Definition

One of the biggest challenges in the current ticketing facility is the WAITING QUEUE in buying our suburban railway tickets. With Mumbai being highly populated city, the queues are really long as local trains are the most common mode for transport. It is very time consuming. Alternatives such as Coupons and Smart Cards are still not effective. With this application we will be able to overcome many of its limitations and will be able to make it more efficient. Smart-phone Ticketing Application(STA) is mainly to buy the suburban ticket.Our Smart- phone ticket can be bought with just a smart phone.It uses the smart phones ”GPS” facility to validate ticket automatically with ease. This application is developed specially for smartphone users since studies say that almost 50makes use of and also almost 80

1.2 Scope

This Smart-phone Local Ticketing application is build for Android platform. This application Smart-phone Ticketing Application(STA) ticketing is mainly to buy the suburban tickets which is the most challenging when compared to booking the long journey tickets through ‘M-ticket’ which fails with suburban(local travel) tickets. It allows the passenger to buy local train ticket for Mumbai Suburbs which includes Central, Western and Harbor Railways using the application on their smart-phone. The GPS facility in the Smart-phone acts as a ticket checker. It uses the smart phones GPS facility to validate and delete your ticket automatically after a specific interval of time once the user reaches the destination. User’s ticket information is stored in a distributed database for security purpose which is missing in the present suburban system. Also the ticket checker is provided with a checker application to search for the user’s ticket with the ticket number in distributed database for checking purposes.The application is developed for Android platform as the number of Android users is more compared to Blackberry and iOS users.The user can book tickets for Western and Central Railways.He can buy a maximum of four tickets at one time.The GPS facility in the phone acts as a journey tracker.The application allows the passengers to buy First class or Second class tickets according to convenience.The QR image of the ticket is generated which consists of user information and ticket information.The ticket checker can scan the QR image and can check the ticket through it.The GPS facility acts as a ticket checker and invalidates a ticket

1 after crossing particular destination.

1.3 Existing System

E-ticket facility is currently available only for the long journey railway tickets. The current website such as irctc.com is widely used for booking long journey tickets in India. But there is no such facility for booking tickets for Mumbai local trains. A new technology called M-ticketing (Mobile Ticketing) In foreign countries Oyster cards Octopus card has become mandatory during travel. And facilities like Coupons and Smart Cards are available currently. We suffer if we forget our travel cards and we then stand in the Queue for our local suburban tickets.

1.4 Proposed System

Smartphone Ticketing Application(STA) is mainly to buy the suburban tickets. Our Smartphone ticket with just using a smartphone. The user will have to create an account through this applica- tion. Using this account, when the user enters in the circumference of a nearby railway station , a pop-up notification will be received. Only after then the user is able to book the railway ticket. The Smartphone Ticketing Application uses the phones GPS facility to validate the ticket and track the journey. At the time of booking GPS checks the source station name and then validates the ticket. Also it keeps a track of the journey. If the user crosses the destination station the ticket is automatically deleted. When the ticket is booked , the time of booking is recorded and timer will be started. Using the GPS , after an hour if the journey is not started the ticket will deleted and of no use. Also the user cannot book the railway ticket if the fare of the ticket is more than the balance available in the phone. This Application will be used to overcome the limitations of long queues and less time consuming.

1.5 Assumptions and Constraints

1.5.1 Assumptions • The user should have an Android smartphone with an active data plan.

• The balance in the users account should not be less than the ticket fare.

• The battery of the phone must be more than 20

• The GPS system is turned on.

1.5.2 Constraints • It should take less than 2 second for local transactions.

• The network transactions should happen within 3 seconds.

• The application should be capable of providing transaction for 24 hrs per day.

2 1.6 System Requirements

1.6.1 Software • Operating System : Android

• Language : minimum ANDROID SDK 2.3

• Back End : MySQL

1.6.2 Hardware • Processor : 800 GHz

• RAM : 512 MB

1.6.3 Web Server Requirements • A web server with approx 100 GB of available disk space.

• A web server that supports PHP, such as Apache or Internet Information Server

• PHP 4.1.0 or higher

• Database Support:MySql 5.0 or higher if using PHP MySQL client API 5.0 or higher

3 Chapter 2

Literature Review

2.1 Selecting Android as a Development Platform

Mobile operating systems have clearly amassed a fat chunk of the smartphone market, plus a lot of users down the line, with tech giants like Google and Apple at the top of the food chain. Research firm IDC‘s top operating systems based on worldwide smartphone unit sales and market share in the third quarter of 2012.

Figure 2.1: Comparison of Operating System

2.2 Analyzing the Railways Website

Surveying the basic railway-based sites like www.mttnow.com, www.irctc.co.in the following con- clusion was derived. The user had the ability of booking tickets through the internet but the user could not book tickets through their mobile phones directly. Also there was no facility to book local suburban railway tickets through any websites .So the understanding from the survey is that even though the internet is a medium through which people can book their railway tickets but due to lack of facility to book local railway tickets and also booking tickets using smart-phone there is a need to develop a smart-phone application to book railway tickets and also use GPS as ticket checker.

4 2.3 IEEE paper on Android Suburban Railway Ticketing with GPS as Ticket Checker

The study of this paper as reference helped analyze how a smartphone can be used to book local railway tickets.Understanding from the survey is that even though the internet is a medium through which people can book their railway tickets but due to lack of facility to book local railway tickets and also booking tickets using smartphone there is a need to develop a smartphone application to book railway tickets and also use GPS as ticket checker. GENERATING QR CODE: Once the php code generates the ticket number and time of buy the details saved in the MySQL database are sent to Google Chart API engine in order to generate the QR code. here all the personal and ticket information are converted into QR codes and sent back to the user mobile as HTTP response and saved in the application memory. GPS TICKET VALIDATION: GPS plays the role of the checker, where when the user buys the ticket, the source geopoints, destination geopoints,ticket type, expiry time date are stored in a mobile SQLite database. This service checks the user’s current location in accordance with the destination geopoints, after which the ticket type is checked and accordingly the ticket is deleted if two is single or updated if type is return.[8]

5 Chapter 3

Methodology

3.1 Analysis

3.1.1 Use Case Diagram

Figure 3.1: Use Case Diagram

UseCase Id: 1 Name: Register Actor: Passenger Goals: To enable the user to register success- fully with proper authentication process Precondition: User must have launched application Post condition: User can see the homepage and the option to edit his profile

6 UseCase Id: 2 Name: Login Actor: Passenger Goals: To enable the user to login successfully with proper authentication process Precondition: User must have launched application Post con- dition: User can see the homepage and the option to edit his profile

UseCase Id: 3 Name: Buy Ticket Actor: Passenger Goals: To enable user to get ticket based on the source and destination asked Precondition: The balance must be greater than fare.

Use Case Id: 4 Name: Recharge Actor: Passenger Goals:Get the fare for the location given Precondition: User must have launched application

7 3.1.2 Activity Diagram for passenger

Figure 3.2: Activity Diagram for passengers

Figure 3.2 refers to Activity Diagram for Passenger. The Passenger registers and logs into the account. Then he can book a ticket only if he has sufficient balance.

8 3.1.3 Activity Diagram for ticket checker

Figure 3.3: Activity Diagram for Ticket checker

Figure 3.3 refers to Activity Diagram for Ticket Checker. The Ticket Checker logs in and validates the ticket. If ticket is invalid he issues fine.

9 3.1.4 Sequence Diagram

Figure 3.4: Sequence Diagram

Figure 3.4 represents the sequence diagram. It shows the flow of activities of the Passenger, starting from registering to booking a ticket.

10 3.1.5 Collaboration Diagram

Figure 3.5: Collaboration Diagram

Figure 3.5 shows the collaboration diagram. It represents the interaction between the entities.

11 3.1.6 StateChart Diagram for passenger

Figure 3.6: StateChart Diagram for passenger

Figure 3.6 refers to State Chart Diagram for the Passenger. It shows the different states of the Passenger.

12 3.1.7 StateChart Diagram for Ticket checker

Figure 3.7: StateChart Diagram for Tickte checker

Figure 3.7 refers to State Chart Diagram for the Ticket Checker. It shows the different states of the Ticket Checker.

13 3.1.8 Class Diagram

Figure 3.8: Class Diagram

Figure 3.8 refers to Class Diagram for the entire system showing interaction between different classes.

14 3.2 Design

3.2.1 Block Diagram

Figure 3.9: Block Diagram

Technology Mapping for each block referring to Figure 3.9 is as follows: 1.Login User: Android XML 2.Get Current Location: GPS 3.Select Destination: JSON, PHP 4.Get Fare: JSON, PHP 5.Database: MySQL 6.QR image: QR generator API

15 3.2.2 Architecture Diagram

Figure 3.10: Architecture Diagram

Figure 3.10 refers to 3-tier Archictecture Diagram. 1st tier is the client side which makes use of users smartphone. The backend is implemented in the 3rd tier and the middle tier is the business tier which is implemented using PHP.

3.3 Implementation

3.3.1 Technology used Technologies used are: The various technologies used: 1. JAVA Java is a set of several computer software products and specifications from Sun Microsystems (which has since merged with Oracle Corporation), that together provide a system for developing application software and deploying it in a cross-platform computing environment. Java is used in a wide variety of computing platforms from embedded devices and mobile phones on the low end, to enterprise servers and supercomputers on the high end.[4] 2. Android Android is a Linux-based operating system designed primarily for touch screen mobile devices such as smart-phones and tablet computers, developed by Google in conjunction with the . While Android is designed primarily for smart-phones and tablets, the open and customizable nature of the operating system allows it to be used on other electronics, including laptops and net-books, smart-books, e-book readers, and smart TVs (Google TV). Applications

16 are usually developed in the Java language using the Android Software Development Kit, but other development tools are available, including a Native Development Kit for applications. Applications can be acquired by end-users either through an app store such as Google Play or the Amazon App- store, or by downloading and installing the application’s APK file from a third-party site.[4][6] 3. JSON(JavaScript Object Notation) JSON or JavaScript Object Notation is a text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects. Despite its relationship to JavaScript, it is language-independent, with parsers available for many languages. The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML. 4. PHP PHP is a server-side scripting language designed for web development but also used as a general- purpose programming language. PHP is now installed on more than 244 million websites and 2.1 million web servers. Originally created by Rasmus Lerdorf in 1995, the reference implementation of PHP is now produced by The PHP Group. While PHP originally stood for Personal Home Page, it now stands for PHP: Hypertext Preprocessor, a recursive acronym.PHP code is interpreted by a web server with a PHP processor module, which generates the resulting web page. 5. MySQL The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation. MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack (and other ’AMP’ stacks). LAMP is an acronym for ”Linux, Apache, MySQL, Perl/PHP/Python.” Free-software- open source projects that require a full-featured database management system often use MySQL.

17 3.3.2 Work Breakdown Structure

Figure 3.11: Work Breakdown Structure

Figure 3.11 represents the Work Breakdwon Structure. It shows how the project is divided into deliveriables and milestones.

18 3.3.3 Method Description 1.Register User: User has to register before using the application. The user credentials are verified and account is set up. 2.Login User: User has to login before using the application. The user credentials are verified and then the user is allowed to use the application. 3. Get Current Location: The application uses GPS to track the current location , based on that the source of the ticket is detected.[2] 4. Select Destination: The user has to enter the destination to buy ticket and also to get fare. 6.Get fare: The user can view the fare of ticket by entering the source and destination. 7.Book Ticket: The user has to specify the destination thereby he can book the ticket. Also he has to have sufficient balance in account. 8. Add into transaction log: The record of the ticket is added to the database known as the transaction log. 9. Generate QR image of the ticket: The QR image of the ticket is generated using Google QR generator API.[7] 10.Verify Ticket: The QR image is scanned and the ticket is verified accordingly. 11.Journey Tracker: Using the phones GPS the current location is updated at every instant, thereby tracking the entire journey.[2]

19 Chapter 4

Results

4.1 Sample Code for key scenarios

4.1.1 User Functions public JSONObject loginUser(String email, String password) { // Building Parameters List params = new ArrayList(); params.add(new BasicNameValuePair("tag", login_tag)); params.add(new BasicNameValuePair("email", email)); params.add(new BasicNameValuePair("password", password)); JSONObject json = jsonParser.getJSONFromUrl(loginURL, params); // return json // Log.e("JSON", json.toString()); return json; }

public JSONObject insertIntoLog(String email,String Source,String Destination,Integer pass,Integer fare,String time) { List nameValuePairs = new ArrayList(); nameValuePairs.add(new BasicNameValuePair("Source",Source)); nameValuePairs.add(new BasicNameValuePair("Destination", Destination)); nameValuePairs.add(new BasicNameValuePair("pass",pass.toString())); nameValuePairs.add(new BasicNameValuePair("fare",String.valueOf(fare))); nameValuePairs.add(new BasicNameValuePair("Time",time)); nameValuePairs.add(new BasicNameValuePair("email", email)); JSONObject json = jsonParser.getJSONFromUrl(updateLog, nameValuePairs); return json; } public JSONObject registerUser(String Fname,String Lname, String email,Integer age, Character gender, String password) {

20 // Building Parameters List params = new ArrayList(); params.add(new BasicNameValuePair("tag", register_tag)); params.add(new BasicNameValuePair("Fname", Fname)); params.add(new BasicNameValuePair("Lname", Lname)); params.add(new BasicNameValuePair("email", email)); params.add(new BasicNameValuePair("Age", age.toString())); params.add(new BasicNameValuePair("Gender", gender.toString())); params.add(new BasicNameValuePair("password", password));

// getting JSON Object JSONObject json = jsonParser.getJSONFromUrl(registerURL, params); // return json return json; } public JSONObject updateUser(String Fname,String Lname,Integer age, Character gender,String email) { // Building Parameters List params = new ArrayList(); params.add(new BasicNameValuePair("tag", update_tag)); params.add(new BasicNameValuePair("Fname", Fname)); params.add(new BasicNameValuePair("Lname", Lname)); params.add(new BasicNameValuePair("Age", age.toString())); params.add(new BasicNameValuePair("Gender", gender.toString())); params.add(new BasicNameValuePair("email", email));

// getting JSON Object JSONObject json = jsonParser.getJSONFromUrl(updateURL, params); // return json return json; }

4.1.2 Tracker Fragment private void initializeMap() { MarkerOptions marker; gpsTracker = new GPSTracker(getActivity().getApplicationContext()); Log.e("daf", String.valueOf(gpsTracker.canGetLocation())); if (gpsTracker.canGetLocation()) { String stringLatitude = String.valueOf(gpsTracker.latitude);

String stringLongitude = String.valueOf(gpsTracker.longitude);

21 String country = gpsTracker.getCountryName(getActivity() .getApplicationContext()); String city = gpsTracker.getLocality(getActivity() .getApplicationContext());

String postalCode = gpsTracker.getPostalCode(getActivity() .getApplicationContext());

String addressLine = gpsTracker.getAddressLine(getActivity() .getApplicationContext());

} else {// can’t get location// GPS or Network is not enabled//

gpsTracker.showSettingsAlert(); }

if (googleMap == null) { googleMap = ((SupportMapFragment) getFragmentManager() .findFragmentById(R.id.map)).getMap(); // check if map is created successfully or not if (googleMap == null) { Toast.makeText(getActivity().getApplicationContext(), "Sorry! unable to create maps", Toast.LENGTH_SHORT) .show(); }

double source_latitude = getActivity().getIntent().getDoubleExtra( "lat_source", 0.00); double source_longitude = getActivity().getIntent().getDoubleExtra( "lng_source", 0.00); double dest_latitude = getActivity().getIntent().getDoubleExtra( "lat_dest", 0.00); double dest_longitude = getActivity().getIntent().getDoubleExtra( "lng_dest", 0.00);

int source_code = getActivity().getIntent().getIntExtra( "code_source", 0); int dest_code = getActivity().getIntent().getIntExtra("code_dest", 0);

22 Log.e("fc", String.valueOf(source_code)); Log.e("feffc", String.valueOf(dest_code));

marker = new MarkerOptions().position( new LatLng(source_latitude, source_longitude)).title( "Source"); marker.icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_YELLOW)); googleMap.addMarker(marker); marker = new MarkerOptions().position( new LatLng(dest_latitude, dest_longitude)).title( "Destination"); marker.icon(BitmapDescriptorFactory .defaultMarker(BitmapDescriptorFactory.HUE_RED)); googleMap.addMarker(marker); direction = (source_code < dest_code) ?"down":"up";

Stations[] stations = Stations.values(); PolylineOptions polylines = new PolylineOptions(); polylines.width(2.5f); polylines.color(Color.MAGENTA); polylines.add(new LatLng(source_latitude, source_longitude)); CameraPosition cameraPosition = new CameraPosition.Builder() .target(new LatLng(source_latitude, source_longitude)) .zoom(12).build(); googleMap.animateCamera(CameraUpdateFactory .newCameraPosition(cameraPosition)); Log.e("dire", direction); if (direction.equals("down")) { for(int i = 0; i < stations.length; i++) { if (!(stations[i].getLatitude() == source_latitude)) { } else { if ((stations[i + 1].getLatitude() == dest_latitude)) break; else { marker = new MarkerOptions().position(new LatLng( stations[i + 1].getLatitude(), stations[i + 1].getLongitude())); // ROSE color icon marker.icon(BitmapDescriptorFactory\\ .defaultMarker(BitmapDescriptorFactory.HUE_AZURE));

23 // adding marker googleMap.addMarker(marker); polylines.add(new LatLng(stations[i + 1] .getLatitude(), stations[i + 1] .getLongitude())); source_latitude = stations[i + 1].getLatitude(); }

}

} polylines.add(new LatLng(dest_latitude, dest_longitude));

googleMap.addPolyline(polylines); } else { for(int j = stations.length - 1; j > 0; j--) { if (!(stations[j].getLatitude() == source_latitude)) {

} else { if ((stations[j - 1].getLatitude() == dest_latitude))

break; else { marker = new MarkerOptions().position(new LatLng( stations[j - 1].getLatitude(), stations[j - 1].getLongitude())); // ROSE color icon marker.icon(BitmapDescriptorFactory\\ .defaultMarker(BitmapDescriptorFactory.HUE_AZURE)); // adding marker googleMap.addMarker(marker); polylines.add(new LatLng(stations[j - 1] .getLatitude(), stations[j - 1] .getLongitude())); source_latitude = stations[j - 1].getLatitude(); } } } polylines.add(new LatLng(dest_latitude, dest_longitude));

24 googleMap.addPolyline(polylines); } marker.position(new LatLng(gpsTracker.latitude, gpsTracker.longitude)); marker.icon(BitmapDescriptorFactory .fromResource(R.drawable.ft_icon_gps)); googleMap.addMarker(marker); } } }

4.1.3 QRcode Fragment

public void onClick(View v) { switch(v.getId()) { case R.id.button1: shareImage(); break; } } private void shareImage() { Intent share = new Intent(Intent.ACTION_SEND);

// If you want to sharea png image only, you can do: // setType("image/png");OR for jpeg: setType("image/jpeg"); share.setType("image/*");

// Make sure you put example png image named myImage.png in your // directory String imagePath = Environment.getExternalStorageDirectory() +"/ticket.png";

File imageFileToShare = new File(imagePath);

Uri uri = Uri.fromFile(imageFileToShare); share.putExtra(Intent.EXTRA_STREAM, uri);

startActivity(Intent.createChooser(share,"Share Image!"));

}

25 4.1.4 Booked History Log

public BookedHistoryLog(String logID,String Source,String Destination, int pass,String pass1,String pass2,String pass3,int fare ,String Time) { this.logID = logID; this.Source = Source; this.Destination = Destination; this.pass = pass; this.pass1 = pass1; this.pass2 = pass2; this.pass3 = pass3; this.fare = fare; this.Time = Time; //this.Email= Email; }

public BookedHistoryLog(String logID,String Source,String Destination, int pass,String trainclass,int fare) { this.logID = logID; this.Source = Source; this.Destination = Destination; this.pass = pass; this.trainclass = trainclass; this.fare = fare; //this.Email= Email; }

public String getID() { return this.logID; } public void setID(String id) { this.logID = id; } void setSource(String Fname) { this.Source = Fname; } void setDestination(String Lname) { this.Destination = Lname; } public String getSource()

26 { return Source; } public String getDestination() { return Destination; } public String getTime() { return Time; } public void setTime(String time) { this.Time = time; } void setPass(int no) { this.pass = no; } public int getPass() { return pass; } void setFare(int amount) { this.fare = amount; } public int getFare() { return fare; } public String getTrainClass() { // TODO Auto-generated method stub return trainclass; }

4.1.5 Insert into log

// Generate Guid function NewGuid() { $s = strtoupper(md5(uniqid(rand(),true))); $guidText = substr($s,0,3) .’-’. substr($s,3,3) .’-’. substr($s,6,3).’-’.

27 substr($s,9,3).’-’. substr($s,12,3); return $guidText; } // End Generate Guid

$Guid = NewGuid();

$userId = mysql_query("SELECT uid FROM users WHERE email=’$email’") or die(mysql_error()); if($userId) { $user_id = mysql_fetch_assoc($userId); } $userId = $user_id[’uid’]; $currenttime = time(); $settoexpire = time()*3600*2; $result = mysql_query("INSERT INTO booked_history_log(User_Id,Log_id,Source,Destination,total_pass,fare,class,pass1,pass1_dest,pass1_fare,class1,pass2,pass2_dest,pass2_fare,class2,pass3,pass3_dest,pass3_fare,class3,total_fare,Time,validUpTo,changedValidity)VALUES(’$userId’,’$Guid’,’$source’,’$dest’,’$pass’,’$fare’,’$class’,’$pass1’,’$pass1_dest’,’$pass1_fare’,’$class1’,’$pass2’,’$pass2_dest’,’$pass2_fare’,’$class2’,’$pass3’,’$pass3_dest’,’$pass3_fare’,’$class3’,’$total_fare’,NOW(),DATE_ADD(NOW(),INTERVAL 2 HOUR),0)") or die(mysql_error()); if(isset($result)) { echo $Guid; }

28 4.2 Test cases

Figure 4.1: Test Cases

29 4.3 Results Snapshots

Figure 4.2: Registration

Figure 4.2 refers to the registration page for the new user. The user has to fill the required details to make his own account.

30 Figure 4.3: User Login

Figure 4.3 refers to the Login page. The valid users logs into his account using the username and password.

Figure 4.4: User Profile

Figure 4.4 shows the profile of the user. The user can edit his profile and check his balance.

31 Figure 4.5: Edit Profile

Figure 4.5 refers to the edit profile page where the user can edit his personal details and update it.

Figure 4.6: Menu

Figure 4.6 shows the Ticket Menu where the user has the options to book a ticket, to recharge, to view its profile or to check his booking history.

32 Figure 4.7: Application Popup

Figure 4.7 refers to the pop up screen which appears when the user enters in the circumference of the nearby railway station.

Figure 4.8: Book Ticket

Figure 4.8 refers to Book ticket. The source station is directly received using GPS. The other details are entered by the user and ticket is confirmed.

33 Figure 4.9: Book Ticket

Figure 4.9 shows the details of the passenger if more than 1 ticket is being booked. The passenger name and fare of the journey is displayed.

Figure 4.10: Passenger Details

Figure 4.10 refers to Passenger details if more than 1 passenger’s ticket is booked. The passenger details including his name and destination station is entered.

34 Figure 4.11: Journey Tracker

Figure 4.11 shows the Journey Tracker of the passenger’s journey. The journey is tracked using passenger’s source and destination station.

Figure 4.12: QR image

Figure 4.12 refers to the QR image which is created after the ticket is booked. The QR image consists of the transaction ID, passenger details and if the destinatihon is passed the ticket is invalid and QR image is deleted.

35 Chapter 5

Conclusion and Future Work

The existing system has many limitations. With the use of powerful technologies, bottlenecks have been identified. The proposed system uses highly integrated technologies which provide high security and authorization. It uses the smart phone?s ?GPS? facility to validate and delete your ticket automatically after a specific interval of time once the user reaches the destination. User’s ticket information is stored in a distributed database for security purpose which is missing in the present suburban system. Also the ticket checker is provided with a checker application to search for the user’s ticket with the ticket number in distributed database for checking purposes. The application is currently limited to central and western railways and does not support journey via changing train at different stations. The application has future scope for adding this facility. Return ticket and Pass facility can be implemented in the future.

36 Appendix

• Android:Android is a Linux-based operating system designed primarily for touch screen mo- bile devices such as smart phones and tablet computers. Initially developed by Android, Inc., which Google backed financially and later bought in 2005,Android was unveiled in 2007 along with the founding of the Open Handset Alliance: a consortium of hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices.

• Android SDK: The Android SDK provides you the API libraries and developer tools neces- sary to build, test, and debug apps for Android.

• ADT:Android Development Tools (ADT) is a plugin for the Eclipse IDE that is designed to give you a powerful, integrated environment in which to build Android applications.

• Eclipse:In computer programming, Eclipse is a multi-language software development envi- ronment comprising a base workspace and an extensible plug-insystem for customizing the environment. It is written mostly in Java. It can be used to develop applications in Java and, by Means of various plug-ins, other programming languages including Ada, C, C++, COBOL, Fortran, Haskell, Perl, PHP, Python, etc

37 References

[1] Wei - Meng Lee (2011)” Beginning Android Application Development” - Wiley Publishing Inc.

[2] LocationManager—Android Developers: http://developer.android.com/reference/android/location/LocationManager.html

[3] Layouts—Android Developers: http://developer.android.com/guide/topics/ui/declaring- layout.html

[4] Code On Cloud: Android, MySQL, PHP JSON tutorial.

[5] T. Kojm. Clamav. In www.clamav.net, 2004.

[6] Jeff” Java Jeff” Friesen’s (2010) ”Learn Java for Android Development” - Apress Publications.

[7] en.wikipedia.org/wiki/QRimage

[8] 2012 IEEE International Conference on Advanced Communication Control and Computing Technologies (ICACCCT)”Android Suburban Railway Ticketing with GPS as Ticket Checker”

38 2012 IEEE International Conference on Advanced Communication Control and Computing Technologies (ICACCCT)

Android Suburban Railway Ticketing with GPS as Ticket Checker

I 2 Karthick. S ,Velmurugan. A Department of Information Technology Shri Andal Alagar College of Engineering 2 email: [email protected]•• [email protected]

Abstract - One of the biggest challenges in the current ticketing phones "GPS" facility to validate and delete your ticket facility is "QUEUE" in buying our suburban railway tickets. In this automatically after a specific interval of time once the user fast growing world of technology we still stand in the queue or buy reaches the destination. User's ticket information is stored in a & with oyster octopus cards for our suburban tickets, which is cloud database for security purpose which is missing in the more frustrating at times to stand in the queue or if we forget our present suburban system. Also the ticket checker is provided cards. This paper Android Suburban Railway (ASR) ticketing is with a checker application to search for the user's ticket with mainly to buy the suburban tickets which is the most challenging the ticket number in the cloud database for checking purposes. when compared to booking the long journey tickets through 'M­ ticket' which fails with suburban(local travel) tickets. Our ASR HE GROWING IMPORTANCE OF ANDROID ticket can be bought with just a smart phone application, where you II. T can carry your suburban railway tickets in your smart phone as a MOBILE QR (Quick Response) code. It uses the smart phones "GPS" facility to validate and delete your ticket automatically after a specific Android is a software stack for mobile devices that includes an interval of time once the user reaches the destination. User's ticket operating system, middleware and key applications. information is stored in a CLOUD database for securit purpose y The Android SDK provides the tools and APIs necessary to which is missing in the present suburban system. Also the ticket begin developing applications on the Android platform using checker is provided with a checker application to search for the the Java programming language. It is a Linux-based operating user's ticket with the ticket number in the cloud database for checking purposes. system for mobile devices such as Smartphone's and tablet computers. It is developed by the Open Handset Alliance led by Keywords- Android; SQLite; Cloud Database; ASR; QR code; Google. Android has a large community of developers writing applications ("apps") that extend the functionality of the I. INTRODUCTION devices. Developers write primarily in a customized version of In the past few years there were more advancement in the Java. Apps can be downloaded from third-party sites or through field of technology. Considering railway department, e-ticket online stores such as Android Market, the app store run by facility was introduced where users browse through a Google. As of October 2011 there were more than 400,000 governmental website and book their long journey railway apps available for Android, and the estimated number of tickets which can be printed out after confirmation to show it to applications downloaded from the Android Market as of the checker when needed. After which months before a new December 2011 exceeded lO billion. technology called M-ticketing (Mobile Ticketing) was introduced where customers messaged to the web portal through FEATURES: mobile phones after which a complete web page download to the mobile phone where users can do the same booking process as it • Application framework enabling reuse and was in the e-ticketing facility. Also in foreign countries the use replacement of components. & of Oyster cards Octopus card has become mandatory during • Dalvik virtual machine optimized for mobile travel. But we suffer if we forget our travel cards and we stand devices in the Queue for our local suburban tickets, which is a place • Integrated browser based on the open where e-ticketing; m-ticketing was unable lay their foot prints. source Web Kit engine. Android Suburban Railway (ASR) ticketing is mainly to • Optimized graphics powered by a custom 2D buy the suburban tickets which are the most challenging. Our graphics library; 3D graphics based on the ASR ticket can be bought with just a smart phone application, penGL ES 1.0 specification (hardware where you can carry your suburban railway tickets in your acceleration optional). smart phone as a QR (Quick Response) code. It uses the smart

ISBN No. 978-1- 4673-20 48-1112/$31.00©2012 IEEE 63 2012 IEEE Intemational Conference on Advanced Communication Control and Computing Technologies (ICACCCT)

• SQLite for structured data storage a white background. The information encoded can be made up of four standardized kinds ("modes") of data (numeric, • Media support for common audio, video, and alphanumeric, byte/binary, Kanji), or by supported extensions still image formats (MPEG 4, H.264,MP3, AAC, virtually any kind of data. AMR, JPG, PNG, GIF) The amount of data that can be stored in the QR code symbol depends on the data type (mode, or input character set),version • GSM Telephony (hardware dependent) (1,... ,40, indicating the overall dimensions of the symbol), and error correction level (L[ow] , M[edium], Q[uality], H[igh]).

• B1uetooth, EDGE, , and Wi-Fi (hardware The maximum storage capacities occur for 40-L symbols

dependent) Max. 7,089 characters (0,1, 2,3, 4,5, 6, Numeric onl) • Camera, GPS, compass, and 9) accelerometer (hardware dependent) . Max. 4,296 characters (0-9, A-Z [upper· • Rich development environment including a I A p h anumen * . onI y ] ,space, $ ,/0,01 ,+, -,., /,. ) device emulator, tools for debugging, memory and performance profiling,and a plug-in for the Binary/byte Max. 2,953 characters (8-bit bytes) Eclipse IDE Kanji/Kana Max. 1,817 characters (version 40, error correction level L), and are as follows A. SQLlTE (where characterrefers to individual values of the input Sqlite is an ACID -compliant embedded Relational Database mode/data type, as indicated): Management contained in a small C programming library. SQLite implements most of the SQL standard, using a Encryption dynamically and weakly typed SQL syntax that does not Although encrypted QR codes are not very common,there guarantee the domain integrity. In contrast to other database are a few implementations. An Android app,for example, management systems, SQLite is not a separate process that is manages encryption and decryption of QR codes using DES accessed from the client application, but an integral part of it. Algorithm (56 bits). Japanese immigration use encrypted QR SQLite read operations can be multitasked, though writes can codes when placing visas in passports. only be performed sequentially. Error correction The source code for SQLite is in the public domain. SQLite is a Codeword's are 8-bits long and use the Reed-Solomon popular choice for local/client storage on web browsers. It has Error Correction algorithm with four error correction levels. many bindings to programming languages. It is arguably the The higher the error correction level, the less storage capacity. most widely deployed database engine, as it is used today by The following table lists the approximate error correction several widespread browsers, operating systems, and embedded capability at each of the four levels: systems, among others.

B. ANDROIDCLOUD TO DEVICE MESSAGING Level L 7% of codeword's can be restored. FRAMEWORK Level M 15% of codeword's can be restored. Android Cloud to Device Messaging (C2DM) is a service that helps developers sends data from servers to their applications Level Q on Android devices. The service provides a simple, lightweight 25% of codeword's can be restored. mechanism that servers can use to tell mobile applications to Level H 30% of codeword's can be restored. contact the server directly, to fetch updated application or user data. The C2DM service handles all aspects of queuing of Due to the design of Reed-Solomon codes and the use of 8-bit messages and delivery to the target application running on the codeword's, an individual code block cannot be more than 255 target device. codeword's in length. Since the larger QR symbols contain much more data than that, it is necessary to break the message up into C. QR CODE multiple blocks. The largest possible block size is never used, A QR code (abbreviated from Quick Response code) though. The QR specification defmes the block sizes so that no is a type of matrix-barcode (or two-dimensional code) first more than 15 errors can be corrected within each block. This designed for the automotive industry. More recently, the limits the complexity of certain steps in the decoding algorithm. system has become popular outside of the industry due to its The code blocks are then interleaved together, making it less fast readability and comparatively large storage capacity. The code consists of black modules arranged in a square pattern on

64 2012 IEEE International Conference on Advanced Communication Control and Computing Technologies (ICACCCT) likely that localized damage to a QR symbol will overwhelm the 6.) CHECKING QR CODE WITH QR READER: capacity of any single block. In this module the checker will have QR Code reader and scan Thanks to error correction, it is possible to create artistic the QR code with the application in order to validate QR code QR codes that still scan correctly, but contain intentional errors to and verifY the journey details, especially the time and date of the make them more readable or attractive to the human eye, as well ticket. as to incorporate colors, logos and other features into the QR code block. 7.) CHECKING WITH DATABASE: If suppose the user's display is being damaged and not able to III. SYSTEM DESIGN scan the QR code due to other reasons like battery failure, we have Another failsafe option to check the ticket by searching the A. EXPLANATION ticket database with the user's ticket number for validation 1.) Personal Information Gathering: purposes. The work here starts during the fIrst time installation of our application . It gathers the basic customer information like fIrst B. ARCHITECTURE DESCRIPTION name, last name, date of birth, city , state etc., and it will be The structure of system divided into two components (fIg 1.1): stored into user mobile's, SQLite database. So every time when • The customer application which resides personal information the user buys the ticket this customer information is also sent to gathering, buying ticket, pin code validation, generating QR the database for security purpose and used also in the QR code, GPS ticket validation and stored into cloud database. generation. • The checker application is to validate the ticket by entering the ticket number of the user and searching in the cloud 2.) TICKETBUYING: database to check whether the user has bought the ticket. The user selects source, destination, class, no. of Adult and child tickets, ticket type like return or single etc. then the user browse IV. CONCLUSION through the menu option to choose either credit buy option or token buy which simplifIes the buy process by remembering the In this paper we have presented a mobile ticket credit card details. Once the user chooses any of these options the application developed for Android 1.5 using Java, SQLite, application moves on to the pin code validation module. MySQL, and PHP on the server side which can change the way people buy their tickets in future. This kind of ticketing 3.) PIN CODE VALIDATION: application can be applied to any kind of transport system. Once the customer hits the buy button a PHP code in the railway Our android app is one of its kinds and fmds huge application server validates the pin number and passwords, if it is successful to buy sub-urban railway tickets through android mobile. Also it saves both the journey details and customer info in the server's our app saves a huge work for our ticket checkers by GPS MySQL database. After which ticket number and time of buying validation of tickets and also moving from manual ticket is generated by the PHP code and the balance credit value is checking process to digital ticket checking process by just displayed. scanning with his own android mobile to validate the ticket. Hence a huge problem of issuing local train tickets has been 4.) GENERATING QR CODE: solved with our new application. Once the php code generates the ticket number and time of buy the details saved in the MySQL database are sent to Google Chart Knowing at what time trains will be available will also ease API engine in order to generate the QR code. here all the personal the user to allot his time accordingly to reach the station, so in and ticket information are converted into QR codes and sent back our project we will be using GPS here to fmd the location of to the user mobile as HTTP response and saved in the application the user and nearby train station to display the train arrival memory. timings. Still more advance modifIcation can be a Dynamic display of Train locations by fItting GPS devices in trains to 5.) GPS TICKET VALIDATION: show its location in the Google map display which is available In this module (fIg 1.0) the GPS plays the role of the checker, in our application. Also as a station level security we can have where when the user buys the ticket, the source geopoints, Hardware devices to validate the QR codes before the user destination geopoints,ticket type, expiry time & date are stored in enters or leaves the station, where the user can have access a mobile SQLite database. This service checks the user's current towards platform after being validated by the hardware device. location in accordance with the destination geopoints, after which the ticket type is checked and accordingly the ticket is deleted if two is single or updated if type is return.

65 2012 IEEE International Conference on Advanced Communication Control and Computing Technologies (ICACCCT)

V. TABLE OF FIGURES

ANOROID SUR_URBAN RAILWAY TICKET RUYING PROCESS Wlnl GPS AS TICKET CIIECKER

GI'STICh:ET VAUI)ATI01\ AH.CIIITECTURE I>IAGKAM " 'icket'H'" II:;'�:::��:' f:i�, ;�::: �,

A.NI)IlOII)'S N,,:'.'lt'OIlK " IA)(�A'I'ION e l'UOVmEIl t::�:,:::: then.,.· ••,

n"";nan .. ,, .;.-______----1

ANDROID SUB-URBAN RAn.WA Y TICKET BUYING PROCESS WITH DATABASE IN CLOUD

ARCHITECTURE DIAGRAM

REFERENCES

[I] Damon Oehlman and Sebastien Blanc ( 20 II )" Pro Android Web Apps develop for Android using HTML5,CSS3 &JavaScript "-Apress Publications. [2] Dave Smith and JeffFriesen's (2011)" Android Recipes A Problem Solution Approach"- Apress Publications. [3] Jeff" JavaJeff" Friesen's (2010) "LearnJavafor Android

Development" - Apress Publications. [4] Lauren Darcey and Shane Conder (2010)" Sams Teach Yourself

Android Application Development" - Sams Publications. [5] Mark Murphy's (2011)" Beginning Android 3" - Apress Publications. [6] Reto Meier (2009)" Professional Android Application Development"

- Wiley Publishing Inc.

[7] Satya Komatineni (2009) " Pro Android" - Apress Publications. [8] Shawn Van Every's (2009) "Pro Android Media developing Graphics, Music , Video and Rich Media Appsfor Smartphones and Tablets"- Apress Publications. [9] Wallace Jackson's (2011) "Android Appsfor Absolute Beginners"­ Apress Publications. [10] Wei - Meng Lee ( 20 II )" Beginning Android Application

Development" - Wiley Publishing Inc.

66 Smart-phone Local Ticketing Application

Author 1: Bhakti Anekar Author 3: Yash Sanghavi Department: IT Department: IT Organization: Sardar Patel Institute of Technology Organization: Sardar Patel Institute of Technology Email id: [email protected] Email id: [email protected]

Author 2: Neelay Upadhyaya Mentor: Prof Kailas Devadkar Department: IT Department: IT Organization: Sardar Patel Institute of Technology Organization: Sardar Patel Institute of Technology Email id: [email protected] Email id :kailas_devadkar @spit.ac.in

Abstract phone users since studies say that almost 50% of the population in Mumbai between the age group of 18- One of the biggest challenges in the current ticketing 40 makes use of smart-phones and also almost 80% facility is “QUEUE” in buying our suburban railway the same age group makes use of the local trains. tickets. E-Ticketing and M-ticketing are available for This application provides solutions to the current long journey railways. Oyster cards & Octopus card problems and difficulties faced while buying local has become mandatory during travel. In this fast tickets. growing world of technology we still stand in the queue or buy with smart cards or coupons our Literature Survey: Surveying the basic railway- suburban tickets, which is more frustrating at times to based sites like www.mttnow.com, www.irctc.co.in stand in the queue or if we forget our cards. This the following conclusion was derived. The user had application Smart-phone Ticketing Application(STA) the ability of booking tickets through the internet but ticketing is mainly to buy the suburban tickets which the user could not book tickets through their mobile is the most challenging when compared to booking phones directly. Also there was no facility to book the long journey tickets through `M-ticket' which local suburban railway tickets through any websites fails with suburban(local travel) tickets. Our STA .So the understanding from the survey is that even ticket can be bought with just a smart phone though the internet is a medium through which application, where you can carry your suburban people can book their railway tickets but due to lack railway tickets in your smart phone. It uses the smart of facility to book local railway tickets and also phones “GPS” facility to validate and delete your booking tickets using smart-phone there is a need to ticket automatically after a specific interval of time develop a smart-phone application to book railway once the user reaches the destination. User's ticket tickets and also use GPS as ticket checker.[7] information is stored in a distributed database for security purpose which is missing in the present Project Scope: This Smart-phone Local Ticketing suburban system. Also the ticket checker is provided application is build for Android platform. This with a checker application to search for the user's application Smart-phone Ticketing Application(STA) ticket with the ticket number in distributed database ticketing is mainly to buy the suburban tickets which for checking purposes. is the most challenging when compared to booking the long journey tickets through `M-ticket' which I. Introduction fails with suburban(local travel) tickets. It allows the passenger to buy local train ticket for Mumbai Need for Project: Smart-phone Ticketing Suburbs which includes Central, Western and Harbor Application (STA) is mainly to buy the suburban Railways using the application on their smart-phone. ticket. Our Smart-phone ticket can be bought with The GPS facility in the Smart-phone acts as a ticket just a smart phone. It uses the smart phones "GPS" checker. facility to validate ticket automatically with ease. It uses the smart phones “GPS” facility to validate This application is developed specially for smart- and delete your ticket automatically after a specific interval of time once the user reaches the destination. User's ticket information is stored in a distributed The framework divides the application into database for security purpose which is missing in the three kinds of components. It also defines present suburban system. Also the ticket checker is the interactions between them. provided with a checker application to search for the user's ticket with the ticket number in distributed  A controller can send commands to the database for checking purposes. model to update the model's state (e.g., editing a document). It can also send Assumption and Constraints: commands to its associated view to change Constraints the view's presentation of the model (e.g., by scrolling through a document).   It should take less than 2 second for local   A model notifies its associated views and transactions. controllers when there has been a change in its  The network transactions should happen state. This notification allows the views to produce updated output, and the controllers to within 3 seconds. change the available set of commands. A passive  The application should be capable of implementation of MVC omits these notifications, because the application does not providing transaction for 24 hours per day. require them or the software platform does not support them.  Assumptions   The user should have an Android smart-  A view requests information from the model that it needs for phone with an active data plan. generating an output representation to the user   The balance in the user’s account should not  be less than the ticket fare. Technology to be used:

 GPS should be turned ON The various technologies that we will be used: 1. JAVA  Phone battery should be above 20% Java is a set of several computer software products and specifications from Sun II. METHOD DESCRIPTION: Microsystems (which has since merged with Oracle Corporation), that together provide a The framework being used for the implementation system for developing application software is the MVC architecture with the help of the PHP and deploying it in a cross-platform computing environment. Java is used in a framework. The basic structure of MVC is as wide variety of computing platforms from follows: embedded devices and mobile phones on the low end, to enterprise servers and supercomputers on the high end. [4]

2. Android Android is a Linux-based operating system designed primarily for touch screen mobile devices such as smart-phones and tablet computers, developed by Google in conjunction with the Open Handset Alliance. While Android is designed primarily for smart-phones and tablets, the open and customizable nature of the operating system allows it to be used on other electronics, including laptops and net- books, smart-books, e-book readers, and smart TVs (Google TV). Applications are Figure 1:MVC Architecture usually developed in the Java language using the Android Software Development software stack (and other 'AMP' stacks). Kit, but other development tools are LAMP is an acronym for "Linux, Apache, available, including a Native Development MySQL, Perl/PHP/Python." Free-software- Kit for applications. Applications can be open source projects that require a full- acquired by end-users either through an app featured database management system often store such as Google Play or the Amazon use MySQL. App-store, or by downloading and installing the application's APK file from a third-party site.[1] 1.Register User: 3. JSON(JavaScript Object Notation) User has to register before using the application. The JSON or JavaScript Object Notation is a user credentials are verified and account is set up. text-based open standard designed for human-readable data interchange. It is 2.Login User: derived from the JavaScript scripting language for representing simple data User has to login before using the application. The structures and associative arrays, called user credentials are verified and then the user is objects. Despite its relationship to allowed to use the application.[2]

JavaScript, it is language-independent, with 3. Get Current Location: parsers available for many languages. The JSON format is often used for The application uses GPS to track the current serializing and transmitting structured data location , based on that the source of the ticket is over a network connection. It is used detected.[3] primarily to transmit data between a server and web application, serving as an 4. Select Destination:

alternative to XML.[4] The user has to enter the destination to buy ticket and also to get fare. 4. PHP PHP is a server-side scripting language 6.Get fare: designed for web development but also used as a general-purpose programming The user can view the fare of ticket by entering the source and destination. language. PHP is now installed on more than 244 million websites and 2.1 million web 7.Book Ticket: servers. Originally created by Rasmus Lerdorf in 1995, the reference The user has to specify the destination thereby he implementation of PHP is now produced by can book the ticket. Also he has to have sufficient The PHP Group. While PHP originally balance in account. stood for Personal Home Page, it now stands 8. Add into transaction log: for PHP: Hypertext Preprocessor, a recursive acronym.PHP code The record of the ticket is added to the database is interpreted by a web server with a PHP known as the transaction log. processor module, which generates the resulting web page.[4] 9. Generate QR image of the ticket:

5. MySQL The QR image of the ticket is generated using Google The MySQL development project has made QR generator API.[5]

its source code available under the terms of 10.Verify Ticket: the GNU General Public License, as well as under a variety of proprietary agreements. The QR image is scanned and the ticket is verified MySQL was owned and sponsored by a accordingly. single for-profit firm, the Swedish company MySQL AB, now owned by Oracle 11.Journey Tracker:

Corporation. MySQL is a popular choice of Using the phone’s GPS the current location is database for use in web applications, and is updated at every instant, thereby tracking the entire a central component of the widely used journey. LAMP open source web application III. Block Diagram of System

Figure 4: Ticket Menu

Figure 2: Block Diagram

Technology Mapping of Different Blocks:

Login User: Android XML

Get Current Location: GPS

Select Destination: JSON, PHP

Get Fare: JSON, PHP

Database: MySQL

QR image: QR generator API

IV. Results

Figure 5: Book Ticket

Figure 3: Login Page

V. Future Scope

The application is currently limited to central and western railways and does not support journey via changing train at different stations. The application has future scope for adding this facility. Return ticket and Pass facility can be implemented in the future.

VI. Conclusion

The existing system has many limitations. With the use of powerful technologies, bottlenecks have been identified. The proposed system uses highly integrated technologies which provide high security and authorization. It uses the smart phone’s “GPS” facility to validate and delete your ticket automatically after a specific interval of time once the user reaches the destination. User's ticket information is stored in a distributed database for security purpose which is missing in the present Figure 6: Journey Tracker suburban system. Also the ticket checker is provided

with a checker application to search for the user's

ticket with the ticket number in distributed database for checking purposes.

VI. Acknowledgement

We have immense pleasure in presenting the synopsis report for our project entitled “Smartphone Local Ticketing Application”. We would like to take this opportunity to express our gratitude to a number of people who have been sources of help and encouragement during the course of this project. We are very grateful and indebted to our project guide Prof.Kailas Devadkar, for providing his enduring patience, guidance and invaluable suggestions. He was the one who never let our morale down and always supported us through our thick and thin. He is a constant source of inspiration for us and took

Figure 7: QR Image utmost interest in our project. We would also like to thank all the Staff Members for their valuable cooperation and permitting us to work in the I.T. Lab.We are also thankful to all our classmates for

giving us their useful advice and immense cooperation.

VII. REFERENCES

[1] Wei - Meng Lee (2011) "Beginning Android Application Development" - Wiley Publishing Inc.

[2] LocationManager|Android Developers: http://developer.android.com/reference/android/locati on/LocationManager.html

[3] Layouts|Android Developers: http://developer.android.com/guide/topics/ui/declarin g-layout.html

[4] Code On Cloud: Android, MySQL, PHP & JSON tutorial.

[5] B. N. Parlett, The QR algorithm, Computing Sci. Eng., 2 (2000)

[6] Jeff" Java Jeff" Friesen's (2010) "Learn Java for Android Development" - Apress Publications.

[7] 2012 IEEE International Conference on Advanced Communication Control and Computing Technologies (ICACCCT)"Android Suburban Railway Ticketing with GPS as Ticket Checker"

Acknowledgements

We have immense pleasure in presenting the synopsis report for our project entitled Smartphone Local Ticketing Application. We would like to take this opportunity to express our gratitude to a number of people who have been sources of help and encouragement during the course of this project. We are very grateful and indebted to our project guide Prof.Kailas Devadkar, for providing his enduring patience, guidance and invaluable suggestions. He was the one who never let our morale down and always supported us through our thick and thin. He is a constant source of inspiration for us and took utmost interest in our project. We would also like to thank all the Staff Members for their valuable cooperation and permitting us to work in the I.T. Lab.We are also thankful to all our classmates for giving us their useful advice and immense cooperation.

49