Vous êtes sur la page 1sur 63

GP BASE MOBI PS ED ILE TRA ACKING USING WEB P G G PORTAL IN CLIEN NT-SERV VER EN NVIRONM MENT

BY M. NOMAN KHALID N K OW WAIS AHM MED FARO OOQUI MUS SLAH UD DDIN Su upervisor
MOHAM MMAD WASE EEM

07A A-019-BS 07B B-025-BS 08B B-015-BS

A rep submi port itted to the Usman In e nstitute of T Technolog gy in confo ormity with the requir h rements fo the or degr of Bach ree helor of Sc cience in th he Faculty of Computer Science F C

DEPART TMENT OF COMPU F UTER SCIE ENCE USMAN INSTITU OF TE N UTE ECHNOLO OGY HAMDAR UNIVE H RD ERSITY KA ARACHI 2012

USMAN INSTITUTE OF TECHNOLOGY

The undersigned certify that they have read and accepted the final year project report entitled GPS Based Mobile Tracking Using Web Portal In Client-Server Environment submitted by Muhammad Noman Khalid (07A-BS-019), Owais Ahmed Farooqui (07B-BS-025) and Muslah Uddin (08B-BS-015) in conformity with the requirements for the degree of Bachelor of Science.

Supervisor Dated:___________

External Examiner Dated:___________

CERTIFICATE

This is to certify that Muhammad Nauman Khalid (07A-BS-019), Owais Ahmed Farooqui (07B-BS-025) and Muslah Uddin (08B-BS-015) have successfully completed their dissertation entitled GPS Based Mobile Tracking Using Web Portal In ClientServer Environment under my supervision and guidance.

_________________________________ Muhammad Waseem, MCS, M.Sc (Electronics), Project Coordinator, Assistant Professor, Dept. of Computer Science Usman Institute of Technology

Dated: _____________

DEDICATED AFFECTIONATELY TO OUR BELOVED FAMILY FRIENDS AND MENTORS WHO ALWAYS PRAYED FOR OUR SUCCESS

ABSTRACT
The GPS Based Mobile Tracking Using Web Portal In Client-Server Environment is a system used for tracking mobiles phone using their built-in GPS and displaying the result on the web portal. The purpose of this project is to develop a web portal in such a way that it tracks down any mobile in the world and maintains its location from time to time, and utilizes the location by displaying it on a web portal and implementing this in a transportation system. This project works in a Client-Server environment. The client is installed on mobile phone which has built-in GPS, the client application is designed in ANDROID and it is installed on the mobile. Our Client Application captures the relevant GPS data from mobile and sends that data without any physical connection through internet. The Server is designed in ASP.NET which will be running on the Laptop. It will be receiving the GPS Data sent from its client installed on mobile. After receiving the data from client onto server, the data is shown on web portal effectively; the web portal is connected to a SQL based database. The data received is stored in database, which can be edited and updated easily. This system getting GPS techniques can be implemented in a Transportation System, carpooling, vehicle management, road traffic control and also for individual movement monitoring.

ACKNOWLEDGEMENT

I feel great pleasure in acknowledging my heartiest gratitude to my supervisor, Mr._________________,Dept. of Computer science, Usman Institute of Technology.. He has been the main source of encouragement and inspiration besides all the guidance and the supervision in conducting this study and technical matters of preparation of this report. This work could never have been completed without his lucid instruction, consistent help and watchful checking.

I also acknowledge the valuable help and support given to me by Chairman, Department of Computer Science Dept. of Computer Science, Usman Institute of Technology.

I wish to express gratitude to Mr.___________________, Professor, Dept. of _____________, Usman Institute of Technology, to whom I am indebted for his inspiring guidance. It would be the height of ungratefulness if I do not appreciate the valuable support and help given to me by Mr. _______________, who assisted me in taking clinical observations.

Finally, I am thankful to my family members for their love, affection and encouragement throughout my studies.

_____________________ Muhammad Noman Khalid, Owais Ahmed Farooqui & Muslah Uddin Department of Computer Science Usman Institute of Technology

Dated: __________

TABLE OF CONTENTS

Chapters Abstract Acknowledgment Chapter No. 01 1. Introduction

Page No.

1
2

Chapter No. 02 2. Background of selected Project

Chapter No. 03 3. Requirement Specification 3.1. Introduction 3.1.1. Purpose of the Project 3.1.2. Scope of the Project 3.1.3. Intended Audience 3.2. Business Objectives & Scope 3.2.1. Detail & Scope of Work 3.3. Type of Users 3.3.1. System Users 3.4. Application Architecture & Information Flow 3.4.1. System Overall View 3.4.2. System Internal Processes 3.4.3. Business Needs 8

3.5. System Requirements 3.5.1. Performance 3.5.2. Maintainability 3.5.3. Reliability 3.5.4. Hardware Requirement 3.5.5. Software Requirement Chapter No. 04 4. Phases of a Software Model 4.1. The Analysis Phase 4.2. The Definition Phase 4.3. The Development Phase 4.4. The Maintenance Phase Chapter No. 05 5. System Activities 5.1. Introduction 5.2. Purpose 5.3. Relation to other Workflows Chapter No. 06 6. Software Process Model Used 6.1. The model used in project Chapter No. 07 7. Installation Guide (Optional)

Chapter No. 08 8. Conclusion

Chapter No. 09

9.

Future Enhancements (1-3 pages)

Appendix A (Interfaces) Appendix B (Data Dictionary) Appendix C (Glossary) Appendix D (References)

CHAPTER 1 Introduction

1. Introduction As we are seeing now a days that the Businessmen are finding its business in each and every corner of the world. The emergence of internet and mobile phones and latest technology has made this world a global village. any person in any corner of the world can not only find business in any other corner of the world but also he can do the business without any physical travelling. The future trends of the business are greatly changing, the businessmen does not need any physical office or does not need to meet its contact person physical .Just by a webpage you can sell any item irrespective of its size or cost and can be delivered to any corner of the world. Moreover the companies with offices in different parts of the world ,and their employees being not only working in different countries of the world but also travelling throughout different countries of the world. So employees and their movement with companys goods and their journeys and arrivals and departures and their current location are very important for the companys progress and safety. Mostly employees remain in contact with head office of the company with emails or international roaming Mobile phones, and those businessmen having offices locally within the country their logistics and goods are transported from one city to other city by heavy vehicles and their vehicles are tracked by GPS based trackers installed in them. GPS is a Global Positioning System, and is a collection of 24 satellites in the space that are continuously orbiting the earth and calculating their locations and sending the data on the earth. GPS-receivers are continuously receiving the GPS data from satellites. Rather buying special and costly GPS based hardware and installing in the vehicles, why dont we take advantage of the GPS which is built-in mobile. We would just need to install a client for the mobile phone that will send the data on the server installed on a

laptop, and the server is connected to database and database not only stores the location of the devices but also maintains the history of the devices attached, moreover it can also assign any task to the devices attached to it. After receiving the data from the client-server it is effectively shown on a web portal. The web portal not only displays the data but also it maintains the current location of the device ,and by monitoring the location we can assign any task to the device We have implemented this system in a transportation system, which have a number of employees. The transportation company supplies the logistics to the different countries of the world. Employees have our client application installed on their mobile phones and where ever they take the logistics and goods of the company their current location and history with relevant data is shown on the web portal. So by the help of web portal we can monitor and assign any task to the employee of our company.

CHAPTER 2 Background

2. Background GPS is a Global Positioning System, and is a collection of 24 satellites in the space that are continuously orbiting the earth and calculating their locations and sending the data on the earth. GPS-receivers are continuously receiving the gps data from satellites. The Global Positioning System (GPS) is a space-based global navigation satellite system (GNSS) that provides location and time information in all weather, anywhere on or near the Earth, where there is an unobstructed line of sight to four or more GPS satellites. It is maintained by the United States government and is freely accessible by anyone with a GPS receiver. Rather buying special and costly GPS based hardware and installing in the vehicles, why dont we take advantage of the GPS which is built-in mobile. We would just need to install a client for the mobile phone that will send the data on the server installed on a laptop, and the server is connected to database and database not only stores the location of the devices but also maintains the history of the devices attached, moreover it can also assign any task to the devices attached to it.

CHAPTER 3 Requirement Specification

3.1. Introduction The aim of the project is to provide a solution to those companies that have offices in different countries of the world. And their employees travel and carry the logistics to the different parts of the world. Especially in this transportation business, the current location of the logistics and the time travelled from the initial city and remaining time for reaching the destination city of the world it matters a lot. So tracking our employees by their mobiles phones and showing the result on a effective web portal is a very efficient solution of tracking and viewing the progress of our shipment. GPS based tracking using web portal in client-server environment is a system that is divided into four parts the client is installed into the mobile phone and is receiving the data from the GPS and then it transmits the data to the server installed on the laptop and the server is connected to a web portal and the web portal is connected to the database and the database is storing them and updating the data received from the client-server. The web portal is responsible for implementing the system into the transportation system, a transportation company is having a number of employees and their basic information, task assigned and their current location with future and past locations are also maintained in it.

3.1.1. Purpose of the Project The purpose of this project is to explore the mobile technology for the newly users or the users which are having some kind of difficulty to use. The intention at the back of this report is to disclose all the problems that occur and the processes which are enabling the

users to crack the solutions and though which phases or models we are facilitating the users to get their goals.

3.1.2. Scope of the Project The scope of our project consists of applicability and utilization. This system consists of easy to use interface which can be used by any kind of organization which involves acr pools, traffic management, individual tracking and fleet management.

3.1.3. Intended Audience The application defines its values as its made for the managers, drivers, sales and marketing personnel even live tracking of student in any particular universities. can be used in both commercial and non commercial topology.

3.2. Business Objectives & Scope A business objective is information that is visible to the top level managers and to those individuals who like to keep track of a particular movement and keep them updated about their where about.

3.2.1. Detail & Scope of Work UFONE is working on utrack technology in which u dial a code with a cell number which you want to track. When acknowledged, the UFONE server generates a sms which includes the approximated location of the user through EDGE technology.

We are moving 1 step forward and providing interactive GUI using GOOGLE MAPS and ANDROID phones making it much easier for the user to locate the desired personnel.

3.3. Type of Users Following are the defined users. Managers Teachers CEO/CIO/SPO Drivers

3.4. Application Architecture & Information Flow

Web Portal

Internet

Laptop Database e

Client (a android phone)

S Server (PC / laptop)

st tart

check on connectio

no

yes s

connect to o GPS

accknowledg gment

ex xit

3.4.1. System Ov verall View Some features are as follows: e e Androida applicationo onceinstalle edwillnotn eedrunning gagainand againuntilo or unlessthe ecellphoneisswitchedoff. Searching gwillbeperf formedonthebasisoft thenamesandcellnumber. Websitew willshowthe elocationof fthespecific cuserthroughgoogleAPI. deandlatitu Locations swillbegivenintheform moflongitud ude.

3.4.2. System Internal Processes 3.4.3. Business Needs Architectural aspect of this project is also important for the business aspect b/c it defines the user friendly aspect the whole architecture is a simple one and highly reliable for the user that increases the market value of the software. In the market there are some software available but the disadvantage of that software is really hard and complex interface which somewhat effects on the market values but in our project its reliable b/c it can secure data, easy access and just like plug and play which assure that this software has a great value.

3.5. System Requirements System requirements are more detailed descriptions of the user requirements. They may serve as the basis for a contract for the implementation of the system and should therefore be a complete and consistent specification of the whole system. Software engineers use them as the starting point for the system design. The system requirement may include different models of the system such as an object model or data flow model. The system requirement should state what the system should do and not how it should be implemented.

3.5.1. Performance Performance is a critical requirement; this suggests that the architecture should be designed to localize critical operations within a small number of sub-systems with as little communication as possible between these sub-systems. This may mean using

relatively large grain rather than fine-grain components to reduce component communication. The system should be a GUI based user friendly and easy to understand. The system should support unlimited numbers of user at a time logged on to the system.

3.5.2. Maintainability Maintainability is a critical requirement; this suggests that the system architecture should be designed using fine-grain, self contained component that may readily be changed. Producers of the data should be separated from consumers and shared data structures should be avoided. The system should be designed in such a way that it can be easily maintained. If after the software has been delivered, the client discovers some of their requirements not fulfilled then we will have to evaluate the software and make necessary changes.

3.5.3. Reliability The reliability is the probability that system services will be delivered. Reliability subsumes availability b/c if a specified services is not delivered then the system is obviously not behaving according to its specification.

3.5.4. Hardware Requirement The system is based on modern database technology and client/server environment. These systems needs modern technology base takes full advantages of these technical opportunities, for this reason the hardware we need is as follows: Personal Computer [P IV] / LAPTOP

External Modem 1GB RAM 10 GB HDD GPS based Cellular phone 3.5.5. Software Requirement This application will be developed on the Microsoft Products as follows: Windows Operating system Language: ASP.NET & ANDROID SDK Database: MS SQL 2008

CHAPTER 4 Phases of a Software Model

4.1. The Analysis Phase Engineering is the analysis, design, construction, verification and management of technical entities. Regardless of the entity to be engineered, the following queries must be answered: Whatistheproblemtobesolved? Whatcharacteristicsoftheentityareusedtosolvetheproblem? Howwilltheentityberealized? Howwilltheentitybeconstructed? Whatapproachwillbeusedtouncoverandfixerrors? How will the entity be supported over the long run, when users of the entity requestcorrections,adaptationsandenhancements? 4.2. The Definition Phase The software engineer attempts to identify what information is to be processed, what function and performances are desired. What system behaviors can be expected, what interfaces are to be established, what design constraints exist, and what validation criteria are required to define a successful system.

4.3. The Development Phase 4.3.1 Global Positioning System (GPS) TheGlobalPositioningSystem(GPS)isaspacebasedglobalnavigationsatellite system (GNSS) that provides location and time information in all weather,

anywhereonorneartheEarth,wherethereisanunobstructedlineofsightto fourormoreGPSsatellites. It is maintained by the United States government and is freely accessible by anyonewithaGPSreceiver.

4.3.2 Basic concept of GPS: AGPSreceivercalculatesitspositionbypreciselytimingthesignalssentbyGPS satelliteshighabovetheEarth.Eachsatellitecontinuallytransmitsmessagesthat include Thetimethemessagewastransmitted Preciseorbitalinformation(theephemeris) ThegeneralsystemhealthandroughorbitsofallGPSsatellites(thealmanac).

Thereceiverusesthemessagesitreceivestodeterminethetransittimeofeach messageandcomputesthedistancetoeachsatellite.

Thesedistancesalongwiththesatellites'locationsareusedwiththepossibleaid oftrilateration,dependingonwhichalgorithmisused,tocomputetheposition ofthereceiver.

This position is then displayed, perhaps with a moving map display or latitude andlongitude;elevationinformationmaybeincluded.

Many GPS units show derived information such as direction and speed, calculatedfrompositionchanges.

Three satellites might seem enough to solve for position since space has three dimensions and a position near the Earth's surface can be assumed. However, even a very small clock error multiplied by the very large speed of light. The speed at which satellite signals propagate results in a large positional error. Thereforereceiversusefourormoresatellitestosolveforthereceiver'slocation andtime.

The very accurately computed time is effectively hidden by most GPS applications,whichuseonlythelocation.

AfewspecializedGPSapplicationsdohoweverusethetime;theseincludetime transfer,trafficsignaltiming,andsynchronizationofcellphonebasestations.

1. What is Latitude and Longitude? Latitude and longitude are angles that uniquely define points on a sphere. Together, the angles comprise a coordinate scheme that can locate or identify geographicpositionsonthesurfacesofplanetssuchastheearth. 4.1 LATITUDE: Latitude is defined with respect to an equatorial reference plane. This plane passes through the center C of the sphere, and also contains the great circle representingtheequator.

The latitude of a point P on the surface is defined as the angle that a straight line, passing through both P and C, subtends with respect to the equatorial

plane.IfPisabovethereferenceplane,thelatitudeispositive(ornortherly);ifP isbelowthereferenceplane,thelatitudeisnegative(orsoutherly).

Latitudeanglescanrangeupto+90degrees(or90degreesnorth),anddownto 90degrees(or90degreessouth).Latitudesof+90and90degreescorrespond tothenorthandsouthgeographicpolesontheearth,respectively.

4.2

LONGITUDE: Longitude is defined in terms of meridians, which are halfcircles running from pole to pole. A reference meridian, called the prime meridian, is selected, and thisformsthereferencebywhichlongitudesaredefined. On the earth, the prime meridian passes through Greenwich, England; for this reasonitisalsocalledtheGreenwichmeridian.ThelongitudeofapointPonthe surface is defined as the angle that the plane containing the meridian passing throughPsubtendswithrespecttotheplanecontainingtheprimemeridian.IfP istotheeastoftheprimemeridian,thelongitudeispositive;ifPistothewest oftheprimemeridian,thelongitudeisnegative. Longitudeanglescanrangeupto+180degrees(180degreeseast),anddownto 180degrees(180degreeswest).The+180and180degreelongitudemeridians coincidedirectlyoppositetheprimemeridian.

Lat titude phi () and Longitud lambda () de

Thisisthe estandardla atitudeandl longitudeof fKarachi,Pakistan.


24 52' 0 0" N / 67 3' 0" E

1.2

PIMN NAVIGATION N: APIMnav vigationdev viceisreceive esGlobalPo ositioningSy ystem(GPS)signalsfor thepurpo oseofdeterm miningthed device'scurr rentlocation nonEarth. W OGLEMAPS? ? 1. WHATISGOO GoogleM Mapsisaserv viceapplicat tionandtech hnologyprovidedbyGo oogle,free (fornonc commercialuse),thatpo owersmany ymapbased dservices,includingthe GoogleM Mapswebsite e,GoogleRid deFinder,G oogleTransit,andmaps sembedded onthirdp partywebsit tesviatheGoogleMaps API.

GoogleM Mapssatellite eimagesare enotupdate edinrealtim me;theyareseveral monthso oryearsold.

1.1 Google Maps API

GooglelaunchedtheGoogleMapsAPIinJune2005toallowdevelopersto integrateGoogleMapsintotheirwebsites.Itisafreeservice,andcurrentlydoes notcontainads.

ByusingtheGoogleMapsAPI,itispossibletoembedGoogleMapssiteintoan externalwebsite,ontowhichsitespecificdatacanbeoverlaid.

Over350,000websitesusetheGoogleMapsAPI,makingitthemostheavily usedwebapplicationdevelopmentAPI.

TheGoogleMapsAPIisfreeforcommercialuseprovidingthatthesiteonwhich itisbeingusedispubliclyaccessibleanddoesnotchargeforaccess.

1.2 EMBEDDING GOOGLE API IN ASP.NET:

WhenintegratingGoogleMapsinourapplicationweusetheGoogleMapsAPI, whichisinfactjustasetofJavaScriptfunctions.

AsaresultwedontinteractdirectlywiththeGoogleMapsAPIinASP.NETbut insteadweplacethespecificJAVASCRIPTcodetoclientsideandworkwithit.

oogleMapscanbeused dwithinanywebsitecon ntaininglang guagelike So,theGo ASP.NET Googlem mapsfunction nalitycanbe ereducedas sitprovidesanoptionto oacquire specificfu unctionsina awebsite.

1.3 CUS STOMIZIN THE FU NG UNCTIONA ALITY: Wehaveembeddeds somediffere entfeatureswhichisreq quiredforou ur onwhilesearchingthrou ughweb. applicatio

Themapisinitiatedfromthemid dpointofGu ulshaneIqb bal,aswesetthelatitud de tudevaluesofitontheloadingofm map. andlongit

Alsowealreadysetth heappropria atezooming gwhenthem mapisinitiat tedbythe usertose eethedesire edlocationa andthewildsearch.

Weadded duptwoma arkerstopointoutthelo ocationandthewildsea arch. NormallyGoogleMap pspinpointatonlyaspe ecificlocatio onsoithaso onlyone markerin ntegrated.

BILEPHONES SWITHGPSCAPABILITY Y: MOB Dueinparttoregulat tionsencour ragingmobillephonetra acking,them majorityof GPSreceiversarebuiltintomobiletelephone es,withvary yingdegrees sofcoverage e andusera accessibility. Commerc cialnavigatio onsoftwareisavailablef formost21s stcenturysm martphones s aswellas ssomeJavaenabledpho onesthatall owthemto useaninternalor externalG GPSreceiver r(inthelatte ercase,conn nectingvias serialorBlue etooth).

,anddonot Somepho oneswithGP PScapability yworkbyassistedGPS(A AGPS)only, t functionw whenoutofrangeofthe eircarrier'sc celltowers.

Othersca annavigatew worldwidew withsatellite GPSsignals sasadedicatedportable e GPSreceiverdoes,up pgradingthe eiroperation ntoAGPSm modewheninrange.

Th hisishowsendmobiled devicethelat titudeandlo ongitudeval luestothe GP PSSatellite.

4.4. The Maintenance Phase Inthisphasemaintenanceisperformed.Itfocusesonerrorcontrol,changesthateffect thesoftwareoperationsanditsscopethatmaybeduetoenhancementorchangingthe functionalitiesorrequirements.Themaintenancephasereappliesthestepsofthe definitionanddevelopmentphasesontheexistingsoftware.

Chapter 5 (System Activity)

Dat Flow Diagram ta D m

Client (a android phone)

S Server (PC / laptop)

s tart

check on connectio

no

yes s

connect t to GPS

accknowledg gment

exit

ER Diagram D

Chapter 6 (Software Process Model Used)

The Water Fall Model W The wate erfall model is a seque l ential desig process, often used in softwar gn d re developm mentprocess ses,inwhich hprogressis sseenasflow wingsteadily ydownward ds (like a wa aterfall) thro ough the ph hases of Con nception, Ini itiation, Ana alysis, Design n, Construct tion,Testing g,Production n/Implemen tationandM Maintenance e.

The waterfall deve elopment model origi nates in t m the manufa acturing an nd tructured ph hysical envir ronments in which afte n er construction industries: highly st
thefact ch hanges are prohibitively costly, if not impossible. Since no fo p t ormal softwar re developme methodo ent ologies existe at the tim this hard ed me, dwareoriente model wa ed as simplyada aptedforsoft twaredevelop pment

The following phases are followed in order: 1. Requirementsspecification 2. Design 3. Construction(AKAimplementationorcoding) 4. Integration 5. Testinganddebugging(AKAValidation) 6. Installation 7. Maintenance

CHAPTER 8 Conclusion

8. Conclusion: GPS BASED MOBILE TRACKING USING WEB PORTAL IN CLIENT SERVER ENVIRONMENT may consist of many users but the server user can only be one under top level management. After numerous tests and debugging, we have come to the conclusion to design the system that the people with very little knowledge of computer can take advantage of our system. All you have to do is run the application in your android phones and roam freely where ever you want while your superior will always keep an eye on you on their pcs or laptops. Report generation is also an imperative feature of the system. The data can also be maintained manually incase of any replication occurs of which the probability is quite low. This system is mainly the result of main session with supervisor and other faculty members and also with time to time guideline with respectable teachers. in the some functional mentoring we also get the great help of supervisor Mohammad Waseem who not only supported us but show us the way to achieve our goals with a lot of determination and results the system as completed.

CHAPTER 9 Future Enhancement

9. Future Enhancement: We cant ignore the fact that our softwares does not ware out. It always can have many upgrades as we have developed the system we are intending to the upgrades as per request an organization. Following are the self evaluated upgrades we are looking into: Timeframing Bulkacknowledgment Notificationofmonitoring

Appendix A (Interfaces)

Andr roid Simula ator

Web Site

PIM Navigator

Appendix B (Data Dictionary)

DATABASE COLUMN
ID Longitude Latitude Date

DATA TYPES
int varchar varchar varchar

Appendix C (References)

List of References References should be ordered alphabetically according to the surname of the first author (use the editors name or the organizations name when the authors name is absent). A list of references is the last section of each chapter. Journal Articles R. A. Barry and P. A. Humblet, Models of blocking probability in all-optical networks with and without wavelength changers, IEEE JSAC/SAC/LT Special issue on Optical Networks, 14(5) pp 858-867, June 1996. Conference Paper
Gouda, M.G. and Dayal, U. (1971). Optimal semi-join schedules for query processing in local Distributed database systems. In Proceedings of ACM SIGMOD International Conference on The Management of Data, (Ann Arbor, Michigan, April 29 May 1, 1980.) ACM, New York, 1981, pp. 164 165.

Books Papoulis, Probability, Random Variables, and Stochastic Processes. McGraw-Hill, New York, 1984 Manuals
IBM. (1984). Information Systems Planning Guide. Fourth Edition, July 1984. SPSS Inc. (1983). SPSS-X Users Guide. McGraw Hill Book Company, New York, 1983.

Unpublished Reports and Theses Thorpe, A. (1982). Stability tests on a tender-price prediction model. M.Sc. Thesis, Loughborough University of Technology, UK. 1982. Web Based http//www.westwords.com/guffey/apa.html, introduction of information technology, West world technologies , last visited on 12 November 2008.

CODE: 10. Client Code (Mobile App)


package proactive.sms.com; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.telephony.SmsManager; import android.widget.Toast; public class SendsmsActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* Use the LocationManager class to obtain GPS locations */ LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); LocationListener mlocListener = new MyLocationListener(); mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener); } public class MyLocationListener implements LocationListener { public void onLocationChanged(Location loc) { loc.getLatitude(); loc.getLongitude(); String Text ="@@"+loc.getLatitude() + "," + loc.getLongitude()+"##"; Toast.makeText( getApplicationContext(), Text, Toast.LENGTH_SHORT).show(); /* Use the SmsManager to send SMS */ SmsManager sm = SmsManager.getDefault(); sm.sendTextMessage("03422078692", null, Text, null, null); finish(); System.exit(0);

} public void onProviderDisabled(String provider) { Toast.makeText( getApplicationContext(), "Gps Disabled", Toast.LENGTH_SHORT ).show(); } public void onProviderEnabled(String provider) { Toast.makeText( getApplicationContext(), "Gps Enabled",Toast.LENGTH_SHORT).show(); } public void onStatusChanged(String provider, int status, Bundle extras) { } }/* End of Class MyLocationListener */ }

Layout file
<?xmlversion="1.0"encoding="utf8"?> <LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello"/> </LinearLayout>

PIM Navigator(Nokia API) using System; using System.Collections.Generic; //using System.Linq; using System.Data; using System.Data.Sql; using System.Data.SqlClient; using System.Configuration; using System.IO; using System.Drawing; using System.Drawing.Imaging; using System.Text;

namespace CSPimNavigator.NET { class Common { public SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["con"]. ConnectionString);

public string GetData(string query, string ret) { string output = ""; DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(query, con); con.Open();

da.Fill(dt); try { if (dt.Rows.Count > 0) { output = dt.Rows[0][ret].ToString(); } else { output = "No"; } } catch { throw; } finally { con.Close(); } return output; }

public string Execute(string SPName, params SqlParameter[] Parameters) { string msg = ""; con.Open(); SqlCommand cmd = new SqlCommand(SPName, con); cmd.CommandText = SPName; cmd.CommandType = CommandType.StoredProcedure;

if (Parameters != null) foreach (SqlParameter item in Parameters) cmd.Parameters.Add(item); try { cmd.ExecuteNonQuery(); msg = "Record Saved Successfully"; } catch { msg = "Record NOT Saved Successfully"; } finally { con.Close(); cmd = null; } return msg; }

public string DeleteData(string sp, string par, string val) { string output = ""; con.Open(); SqlCommand cmd = new SqlCommand(sp, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@" + par, val); try { cmd.ExecuteNonQuery(); output = "Record Deleted";

} catch { output = "Record Not Deleted"; } finally { con.Close(); cmd = null; } return output; }

public Parameters) {

DataTable LoadControl(string SPName, params SqlParameter[]

con.Open(); SqlCommand cmd = new SqlCommand(SPName, con); DataTable dt = new DataTable(); IDataReader dr; cmd.CommandType = CommandType.StoredProcedure; if (Parameters != null) foreach (SqlParameter item in Parameters) cmd.Parameters.Add(item); try { dr = cmd.ExecuteReader(); if (dr != null) { dt.Load(dr); }

} catch { // If we fail to return the SqlDatReader, we need to close the connection throw; } finally { cmd = null; con.Close(); } return dt; } public DataTable LoadControlQry(string SPName, params SqlParameter[] Parameters) { con.Open(); SqlCommand cmd = new SqlCommand(SPName, con); DataTable dt = new DataTable(); IDataReader dr; cmd.CommandType = CommandType.Text ; if (Parameters != null) foreach (SqlParameter item in Parameters) cmd.Parameters.Add(item); try { dr = cmd.ExecuteReader(); if (dr != null) { dt.Load(dr);

} } catch { // If we fail to return the SqlDatReader, we need to close the connection throw; } finally { cmd = null; con.Close(); } return dt; }

public Parameters) {

string GetValueFromSP(string SPName, params SqlParameter[]

string output = ""; con.Open(); SqlCommand cmd = new SqlCommand(SPName, con); cmd.CommandType = CommandType.StoredProcedure; if (Parameters != null) foreach (SqlParameter item in Parameters) cmd.Parameters.Add(item); try { output = cmd.ExecuteScalar().ToString(); } catch (Exception ex) {

if (con != null) { throw ex; } } finally { con.Close(); cmd = null; } return output; } public string UpDelete(string sp, string par, string val) { string output = ""; con.Open(); SqlCommand cmd = new SqlCommand(sp, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@" + par, val); try { cmd.ExecuteNonQuery(); output = "Record Updated Successfully"; } catch (Exception ex) { if (con != null) { throw ex; } output = "Record Updation Fails"; } finally { con.Close();

cmd = null; } return output; } public string UpdateData(string Query) { string output = ""; con.Open(); SqlCommand cmd = new SqlCommand(Query, con); cmd.CommandType = CommandType.Text; try { cmd.ExecuteNonQuery(); output = "Record Updated Successfully"; } catch (Exception ex) { if (con != null) { throw ex; } output = "Record Updation Fails"; } finally { cmd = null; con.Close(); } return output; }

public string GetIDWithSingleWord(string Table, string Format, string Order, string Col, string OrderCol) { string ID = ""; //ID = GetData("select " + Col + " from " + Table + " where " + Col + " like 'File%' order by " + Col + " " + Order + "", con, Col); ID = GetData("select " + Col + " from " + Table + " where " + Col + " like '" + Format + "%' order by " + OrderCol + " " + Order + "", Col); if (ID == "No") { ID = Format + "1"; } else { ID = ID.Substring(Format.Length); ID = Convert.ToString(Convert.ToInt32(ID) + 1); ID = Format + ID; } return ID; }

public string GetIDWithSingleWord(string Table, string Format, string Col) { string ID = ""; //ID = GetData("select " + Col + " from " + Table + " where " + Col + " like 'File%' order by " + Col + " " + Order + "", con, Col); ID = GetData("select " + Col + " from " + Table + " where " + Col + " like '" + Format + "%' order by " + Col + " Desc ", Col); if (ID == "No") { ID = Format + "0000001"; } else {

ID = ID.Substring(Format.Length); ID = Convert.ToString(Convert.ToInt32(ID) + 1); if (ID.Length == 1) { ID = Format + "000000" + ID; } else if (ID.Length == 2) { ID = Format + "00000" + ID; } else if (ID.Length == 3) { ID = Format + "0000" + ID; } else if (ID.Length == 4) { ID = Format + "000" + ID; } else if (ID.Length == 5) { ID = Format + "00" + ID; } else if (ID.Length == 6) { ID = Format + "0" + ID; } else if (ID.Length == 6) { ID = Format + ID; } //ID = Format + ID; } return ID; }

//public static string SaveImage(FileUpload FU, string FileName, decimal SizeLimitKB, string path, string Tbl, string col, string ColN, string ColV) //{ // // // // // // // // // // string msg = ""; string fName = ""; string FN = ""; SizeLimitKB = SizeLimitKB * 1024; SqlCommand cmd = new SqlCommand(); try if (FU.HasFile) { if (FU.PostedFile.ContentLength <= SizeLimitKB) {

// {

// FU.FileName.Substring(FU.FileName.IndexOf(".")); // fName FU.FileName.Substring(FU.FileName.IndexOf(".")); // // // FU.SaveAs(fName); msg = fName; =

FN path

= +

FileName FileName

+ +

if (File.Exists(fName)) { File.Delete(fName); }

// cmd = new SqlCommand("update " + Tbl + " set " + col + " = '" + FN + "' where " + ColN + " = " + ColV + "", con); // // // // // // // // // // // // // // } // // // } // finally // { // cmd = null; catch (Exception ex) throw ex; // { } } else { msg = "No File Selected"; } } else { msg = "File is larger than limit"; if (con.State == ConnectionState.Closed) { con.Open(); } cmd.ExecuteNonQuery(); msg = "File saved Successfully";

// // } // //} } }

con.Close(); return msg;

Database Connection <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> </configSections> <connectionStrings> <add name="con" connectionString="Data Source=.;Initial Catalog=Location;Persist Security Info=True;User ID=sa;Password=sa123" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>

Vous aimerez peut-être aussi