Project Peport Pranali
Project Peport Pranali
Project Peport Pranali
PROJECT PEPORT ON
SUBMITTED BY:
PROF.MARIA ACHARY.
UNIVERSITY OF MUMBAI
2015-16
1
Android Mobile Application
This is to certify that the project entitled by The Android Mobile Application
(Fire Alarm Application) Ms. Sayali Berde (13302B312) Ms. Pranali
Bagwe (13302B0075) and in partial fulfillment of BSc IT degree (Sem VI)
examination had not been submitted for any other examination and does
not form any other course undergone by the candidate.
2
Android Mobile Application
“FIRE ALARM”
3
Android Mobile Application
ACKNOWLEDGEMENT
4
Android Mobile Application
We express our deep sense of gratitude to our project guide persons for
their timely encouragement, motivation and appraisal and for the
solitude help and providing a sanctum atmosphere endeavoring to
complete our project.
We express our deep sense of thanks and indebtedness towards our
internal project guide Prof.Maria Achary.
.She has always made president efforts to carve keen interest and
knowledge of subject on our mind.
We express our thanks to Prof.Maria Acharyfor her help, directly and
indirectly in completing our project work.
We would also like to express a feeling of gratitude to our parents and
friends for their help directly or indirectly in completing our project
work.
Sincere thanks
To,
Prof.Maria Achary.
I wish to state that the work embodied in this project titled “THE
ANDROID APPLICATION” forms my own contribution to the project
5
Android Mobile Application
Certified by
Date:
6
Android Mobile Application
Abstract
Mobile a device that has reached all the people it has become
a daily part of people.Android has opened mobile phone development to
thousands of developers for building mobile application. Experienced
mobile developers can now expand into Android platform, leveraging
the unique features to enhance existing products or create innovative
new ones. Applications based on both local and wide distributed
wireless networks are being launched all the time.
In this project we are trying to develop an application where you can
use your mobile as fire alarm and send your name, mobile no instantly
7
Android Mobile Application
and get your current location on the Google map on the system and
intended server by using mobile phone.These include the current
accidents details.We have used Google Places Api, Google Maps Api,
and Google Direction Api for providing location based search
We will use the features provided by the android mobile to implement
this project.
Table of contents
1 Introduction 12
8
Android Mobile Application
2.2 Feasibility 15
3 System development 23
3.11 ER diagram 35
4 Table list 36
9
Android Mobile Application
7 Process involved 44
8 Source code 46
10 Report layouts 84
Annexure
system
1.Introduction
11
Android Mobile Application
It`s Providing automatically emergency call to the particular location. Google map
find distance of the two places. Also know driving direction and time and distance
of the place.
2. SYSTEM STUDY
AND ANALYSIS
13
Android Mobile Application
Today's generation rely on their phones to get through their day. They use it to
make send text messages, checking their emails, music, playing games etc. Due to
this, phones have become more of a personal assistant to people rather than a
device used to send and receive phone calls.
With the invention of the smart phone, the entire world has become accessible
to the person at a touch of a button. This was made possible due to the creation of
the thousands of applications that run on these smart phones. These applications
provide people with current location conditions to allowing them to control
situation. But every good application lacks a small feature that prevents it from
making it a great application. Our group is going to develop an application for the
Android Mobile Operating System that easy to use application.
14
Android Mobile Application
2.2 FEASIBILITY:
Economic feasibility.
Operational feasibility.
Technical feasibility.
Economic Feasibility:
Higher level of automation most often requires more funds. Hence based on the
hardware and software specification a desirable alternative costs and benefits to
see if the investment made in creating / developing a new system is costlier or
more beneficial.
The product is not made for a particular visitor. Thus the economical cost for the
hardware and software and other peripheral devices are thus reduced.
Technical Feasibility:
15
Android Mobile Application
There is requirement for the mentioned software and an expertise for handling
system. Thus in the presence of required hardware, software the proposed system
is technically feasible.
Operational Feasibility:
1. Some kind of graphical user interface changes can be brought to the system
2. Some basic knowledge of how to designing web page will be required for
the developer
3. The website is very functional and can be operated very smoothly and does
not required any special skills to operate it
4. The system is operationally feasible as it very easy for the End users to op-
erate it. It only needs basic information about Windows platform.
16
Android Mobile Application
5. The person using the website feels comfortable to operate the website be-
cause its easy functionality
It consists of initial assessment and feasibility study. During initial assessment and
feasibility study the technical aspects of the hardware and software were
determine as which hardware and software should be used to develop the project.
Also the cost needed to developed project was estimated.
Analysis:
17
Android Mobile Application
During these phase the complete design of the system including all the technical
specification for the screens, menus, reports were made. The system was coded,
the actual database was created and system was customized by the creation of
tables, user authorizations and so on.
Code Generation:
The design must be translated into a machine –readable form. The code generation
step performs this task. If designed is performed in a detailed manner, code
generation can be accomplished mechanistically.
Testing:
Once code has been generated, program testing begins. The testing process
focuses on the logical internals of the software, ensuring that all statements have
been tested, and on the functional externals; that is, conducting tests to uncover
errors and ensure that defined input will produce actual results that agree with
required results.
Maintenance:
The software will definitely undergo change once it is delivered to the customer.
There can be many reasons for this change to occur. Change could happen because
of some unexpected input values into the system. In addition, the changes in the
system could directly affect the software operations. The software should be
developed to accommodate changes that could happen during the post
implementation period.
SYSTEM PLANNING
This process is done manually. The current system is time consuming and also it is
very costly, because it involves a lot of paper work. To manually handle such a
system was very difficult task. But now-a-days because of computerization this
job is becoming easier.
The following are the reasons why the current system should be
computerized:
To save time of management for recording details of each and every request.
Cannot get the exact location- As emergency happened cannot get the
exact location of the accident.
Paper Work- Lot of paper work is involved as the records are maintained in the
files and registers.
Storage Requirements- As files and registers are used the storage space
requirement is increased.
19
Android Mobile Application
Less Reliable- Use of papers for storing valuable data information is not at all
reliable.
Accuracy- As the system is in manual there are lot many chances of human errors.
These cause errors in maintaining user data in registers.
Difficulty in keeping new records- It is difficult for keeping all the new entries of
the user name, phone no and address etc.
To reduce the inconvenience that were found in the current system, it has been
automated so as to provide a user friendly GUI that will help sending a help
request in emergency and maintaining the record and finding the exact location of
the user and get the correct direction to reached their.
The developed system will be a Time saving application for the user.
Also the system is intended to take very few inputs form the user.
Creating a database for containing the information present with them
on the paper in existing system.
Send immediate request for the help in emergency.
20
Android Mobile Application
Get exact Location of the user and get proper direction to reach their.
Time saving since all the details information is stored in this system, it enables in
significance reduction in the number of man-hours taken up for the storage and the
retrieval of the information as it removes the large registers from the scene. Send
immediate request for the help in emergency. Get exact Location of the user and
get proper direction to reach their.
OPERATING SYSTEMS
o Windows XP (32-bit)
o Vista (32- or 64-bit)
o Windows 7 (32- or 64-bit)
21
Android Mobile Application
HARDWARE SPECIFICATIOS
22
Android Mobile Application
3. SYSTEM
DEVELOPMENT
Gantt chart is a type of bar chart that illustrates a project schedule. Gantt charts
illustrate the start and finish dates of the terminal elements and summary elements
of a project. Gantt charts can be used to show current schedule status using
percent-complete shadings.
23
Android Mobile Application
Date
July Aug Sep Oct Nov Dec Jan Feb Mar
Phase
Preliminary
Investigation
System Analysis
System Design
System Coding
System
Implementation /
Uploading
Future
Enhancements
References and
Bibliography
Estimate Timing
Actual Timing
24
Android Mobile Application
25
Android Mobile Application
06 Request for Sending request Android Request to call System Android user
the call call user system
07 Retrieving Collect user Android Get details Web user Android user
data details user
terms of actors, their goals (represented as use cases), and any dependencies
between those use cases.
27
Android Mobile Application
The class diagram is the main building block in object oriented modelling. It is
used both for general conceptual modelling of the systematics of the application,
and for detailed modelling translating the models into programming code. The
29
Android Mobile Application
classes in a class diagram represent both the main objects and or interactions in the
application and the objects to be programmed. In the class diagram these classes
are represented with boxes which contain three parts:
A State chart diagram describes a state machine. Now to clarify it state machine
can be defined as a machine which defines different states of an object and these
states are controlled by external or internal events. State chart diagram is one of
the five UML diagrams used to model dynamic nature of a system. They define
different states of an object during its lifetime. And these states are changed by
events. So State chart diagrams are useful to model reactive systems. Reactive
systems can be defined as a system that responds to external or internal events.
32
Android Mobile Application
which can later be elaborated.[2] Data flow diagram can also be used for the visual-
ization of data processing
A Data Flow Diagram shows what kind of information will be input to and output
from the system, where the data will come from and go to, and where the data will
be stored. It does not show information about the timing of process or information
about whether processes will operate in sequence or in parallel
Help Request
Response Server
Data base
33
Android Mobile Application
Component Diagram Nodes are the important building block in modeling the
physical aspects of a system.
3.11 ER Diagram
An entity–relationship model (ER model) is a data model for describing the data
or information aspects of a business domain or its process requirements, in an
abstract way that lends itself to ultimately being implemented in a database such
34
Android Mobile Application
35
Android Mobile Application
4.table list
36
Android Mobile Application
the user
37
Android Mobile Application
5. SYSTEM TESTING
AND CONCLUSION
must be well-defined standard for what constitute a defect. The developers can test
products by reviewing their constructions and compositions or by exercising their
functions and examining the results.
The three types of testing are correlated to specific phase of SDLC. A system text
examines the behavior of entire system with respect to technical and user. These
requirements are determined during analysis phase of SDLC. During high level
design, the division of the system into high level components and structural design
of those components are determined. Integration testing tests the behavior of
variable group of software components. Unit testing test each individual software
components in isolation.
Unit Testing:
This is a process of testing individual code modules before they integrate with
other modules. Unit testing being tested may be a function, sub routine, procedure,
or method. Unit testing may be relatively small groups of inter related modules
that are always executes as group. The goal of unit testing is to identify and fix as
many errors as possible before modules and expensive to locate and fix when
many modules are combined.
Integrated Testing:
Interface Compatibility.
Parameter Values.
Runtime Exception.
System Testing:
After integration, the whole program will again be tested. Case studies will again
be applied with integrated software.
The testing methodology implemented for testing of the project is Black Box
testing.
In the black box testing, the internal logic of the system under testing is not
considered and the test cases are decided form the specification or the
requirements. It is often called functional testing. It aims to test functionality
according to the requirements. Equivalence class portioning, boundary value
analysis, and because effecting graphing are examples of methods for selecting
test cases for black box testing. State-based testing is another approach in which
the system is modeled as a state machine and then this model is used to select test
cases using some transaction or path based coverage criteria, state-based testing
can also be viewed as grey-box testing in that it often requires more information
than just the requirements.
The testing methodology implemented for testing of the project is the black box
testing. Refer the above paragraph for explanation.
Test Cases:
The forms were tested for their functionality and error messages displayed
wherever the input does not meet the required requirements.
5.2 Conclusion
40
Android Mobile Application
This was our project of System Design Lab about “THE ANDROID
APPLICATION” (FIRE ALARM APPLICATION). Development of this System
takes a lot of efforts from us. We think this system gave a lot of satisfaction to all
of us. Though every task is never said to be perfect in this development field even
more improvement may be possible in this system. We learned so many things and
gained a lot of knowledge about development field. We hope this will prove
fruitful to us.
41
Android Mobile Application
42
Android Mobile Application
43
Android Mobile Application
7 .Process involved
Main Activity
My Receiver
• When user click the power button three times then it retrieve the all user data
and send call to the website
• And also send the latitude and longitude of location.
FrmRequestList
44
Android Mobile Application
HelpRequest
8. SOURCE CODE
45
Android Mobile Application
activity_main.xml
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="fill"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/detail"
android:layout_gravity="center"
android:gravity="center"
android:textColor="#00BFFF"
android:textSize="30sp"
46
Android Mobile Application
android:textColorHighlight="#FFFF00"
/>
<EditText
android:id="@+id/edit_Firstname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_msg1"
android:inputType="text"
/>
<EditText
android:id="@+id/edit_lastname"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_msg2"
android:inputType="text"
/>
<EditText
android:id="@+id/edit_ph"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/edit_msg3"
android:inputType="phone"
/>
<Button
android:layout_width="250dp"
android:id="@+id/btnsave"
android:layout_height="wrap_content"
android:text="@string/b_save"
android:layout_gravity="center"
/>
<Button
android:id="@+id/btnexit"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="@string/b_Exit"
android:layout_gravity="center"
/>
47
Android Mobile Application
</LinearLayout>
MainActivity.java
package com.example.myapp;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.View;
import android.view.WindowManager;
import android.widget.*;
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYG
UARD);
setContentView(R.layout.activity_main);
editText1=(EditText)findViewById(R.id.edit_Firstname);
editText2=(EditText)findViewById(R.id.edit_lastname);
editText3=(EditText)findViewById(R.id.edit_ph);
btn1=(Button)findViewById(R.id.btnsave);
btn2=(Button)findViewById(R.id.btnexit);
LoadPreferences();
btn1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
boolean hasError = false;
if( editText1.getText().toString().length() == 0 )
{
editText1.setError( "First name is required!!!" );
hasError = true;
}
if( editText2.getText().toString().length() == 0 )
{
editText2.setError( "Last name is required!!!" );
hasError = true;
}
if(editText3.getText().toString().trim().length()!=10)
{
editText3.setError("please enter 10 digits !!!");
hasError=true;
49
Android Mobile Application
}
if(hasError) return;
SavePreferences("FirstName", editText1.getText().toString());
SavePreferences("LastName", editText2.getText().toString());
SavePreferences("Phone",editText3.getText().toString());
Toast.makeText(getBaseContext(),"Data saved successfully !!!",
Toast.LENGTH_LONG).show();
startService(new Intent(getBaseContext(),MyService.class));
});
btn2.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
// TODO Auto-generated method stub
finish();
//System.exit(0);
}
});
}
private void SavePreferences(String key, String value)
{
// TODO Auto-generated method stub
SharedPreferences sharedPreferences =
getSharedPreferences("MyAppPref", MODE_PRIVATE);
//getPreferences(MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.commit();
}
private void LoadPreferences()
{
// TODO Auto-generated method stub
50
Android Mobile Application
SharedPreferences sharedPreferences =
getSharedPreferences("MyAppPref",
MODE_PRIVATE);//getPreferences(MODE_PRIVATE);
String strFirstname = sharedPreferences.getString("FirstName","");
String strLastname = sharedPreferences.getString("LastName","");
String strph = sharedPreferences.getString("Phone","");
editText1.setText(strFirstname);
editText2.setText(strLastname);
editText3.setText(strph);
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Myreceiver.java
package com.example.myapp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
51
Android Mobile Application
import android.content.Intent;
import android.content.SharedPreferences;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.widget.Toast;
import android.location.*;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.*;
52
Android Mobile Application
if(location == null)
Log.d("MyApp", "Location is null");
try {
lat = location.getLatitude();
lon = location.getLongitude();
}
catch (NullPointerException e)
{
Log.d("MyApp", e.getClass().getName(), e.getCause());
lat = 19.21061;//-1.0;
lon = 72.976445;//-1.0;
}
//Toast.makeText(getApplicationContext(), "Location is Thane(w)...!!!",
Toast.LENGTH_LONG)
// .show();
}
public void Notify()
{
NotificationManager notificationManager = (NotificationManager)
context.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(0, mBuilder.build());
}
public void postData(Context context)
{
//Create a new HttpClient and Post Header
HttpClient httpclient=new DefaultHttpClient();
HttpPost httppost=new
HttpPost("http://10.0.2.2:4073/WebSite/Default.aspx");
try
{
Log.d("MyApp", "Calling web app");
SharedPreferences sharedPreferences =
context.getSharedPreferences("MyAppPref",android.content.Context.MODE_PRI
VATE);
//getPreferences(MODE_PRIVATE);
String strFirstname =
sharedPreferences.getString("FirstName","");
String strLastname =
sharedPreferences.getString("LastName","");
String strph = sharedPreferences.getString("Phone","");
//Add your data
_getLocation(context);
List<NameValuePair> nameValuePairs = new
ArrayList<NameValuePair>(2);
nameValuePairs.add(new
BasicNameValuePair("id_Firstname",strFirstname));
nameValuePairs.add(new
BasicNameValuePair("id_Lastname",strLastname));
nameValuePairs.add(new
BasicNameValuePair("id_ph",strph));
nameValuePairs.add(new
BasicNameValuePair("id_lon",Double.toString(lon)));
nameValuePairs.add(new
BasicNameValuePair("id_lat",Double.toString(lat)));
httppost.setEntity(new
UrlEncodedFormEntity(nameValuePairs));
}
54
Android Mobile Application
catch(ClientProtocolException e)
{
Log.d("MyApp", e.getMessage(),e.getCause());
}
catch(IOException e)
{
Log.d("MyApp", e.getMessage(), e.getCause());
}
catch(Exception e)
{
Log.d("MyApp", e.getClass().getName(), e.getCause());
}
}
public void onReceive(Context arg0, Intent arg1)
{
// TODO Auto-generated method stub
Intent intent=arg1;
Log.e("MyReceiver","In OnReceive");
if(intent.getAction().equals(Intent.ACTION_SCREEN_OFF))
{
Log.e("In on receive","In Method:ACTION_SCREEN_OFF");
countPowerOff++;
// message();
}
else if(intent.getAction().equals(Intent.ACTION_SCREEN_ON))
{
Log.e("In on receive","In Method : ACTION_SCREEN_ON");
try
{
urlConnection.setDoOutput(true);
urlConnection.setChunkedStreamingMode(0);
URL url=new URL("http://localhost:4381/WebSite1/Default.aspx");
urlConnection=(HttpURLConnection)url.openConnection();
OutputStream out= new
BufferedOutputStream(urlConnection.getOutputStream());
writeStream(out);
}
55
Android Mobile Application
catch(IOException e)
{
e.printStackTrace();
}
finally
{
urlConnection.disconnect();
}**/
}
else if(intent.getAction().equals(Intent.ACTION_USER_PRESENT))
{
Log.e("In on receive",Double.toString(countPowerOff));
if(countPowerOff<=1)
{
countPowerOff=0;
/* Context context = null;
Toast.makeText(context, "MAIN ACTIVITY IS BEING
CALLED ", Toast.LENGTH_LONG).show();
Intent i = new Intent(context, MainActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|
Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(i);*/
postData(arg0);
// ringtone();
}
Notify();
}
}
{
// TODO Auto-generated method stub
}
* @return **/
/* public void ringtone()
{
try
{
Uri notification =
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
Ringtone r = RingtoneManager.getRingtone(getApplicationContext(),
notification);
r.play();
}
catch (Exception e) {}
}
/*notificationManager = (NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri
.parse(myBlog));
PendingIntent pi = PendingIntent.getActivity(MainActivity.this, 0, myIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
Notification note = new Notification(R.drawable.ic_launcher, "Alarm",
System.currentTimeMillis());
note.setLatestEventInfo(getApplicationContext(), "Alarm", "sound" + "
(alarm)", pi);
Uri alarmSound =
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
if(alarmSound == null){
alarmSound =
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
if(alarmSound == null){
alarmSound =
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
57
Android Mobile Application
}
}
note.sound = alarmSound;
note.defaults |= Notification.DEFAULT_VIBRATE;
note.flags |= Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(MY_NOTIFICATION_ID, note);*/
//This sets the sound to play
//Display notification
Myservice.java
package com.example.myapp;
import java.lang.annotation.Target;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.os.StrictMode;
import android.util.Log;
import android.widget.Toast;
publicvoid onCreate()
{
super.onCreate();
IntentFilter filter=new IntentFilter(Intent.ACTION_SCREEN_ON);
filter.addAction(Intent.ACTION_SCREEN_OFF);
filter.addAction(Intent.ACTION_USER_PRESENT);
filter.addAction(CONNECTIVITY_SERVICE);
mReceiver= new MyReceiver();
registerReceiver(mReceiver,filter);
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.build());
}
publicvoid message()
{
NotificationManager mNotificationManager =(NotificationManager)
getSystemService(Context.NOTIFICATION_SERVICE);
Notification notification = newNotification((Integer)
R.drawable.ic_launcher,"This is the android example Notification
message!!!",System.currentTimeMillis());
Intent notificationIntent = new
Intent(getBaseContext(),Target.class);
PendingIntent contentIntent =
PendingIntent.getActivity(getApplicationContext(),0,notificationIntent,0);
notification.setLatestEventInfo(getApplicationContext(),"Notification","message
from system !!!", contentIntent);
notification.flags=Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(143, notification);
}
publicvoid onDestroy()
{
unregisterReceiver(mReceiver);
Log.i("onDestroy Receiver","Called");
super.onDestroy();
}
59
Android Mobile Application
@Override
public IBinder onBind(Intent arg0)
{
// TODO Auto-generated method stub
returnnull;
}
60
Android Mobile Application
frmRequestList.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.Configuration;
using System.Security.Permissions;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using System.Diagnostics;
namespace HelpRequestViewer
{
public partial class frmRequestList : Form
61
Android Mobile Application
public frmRequestList()
{
InitializeComponent();
}
Control.CheckForIllegalCrossThreadCalls = false;
SqlDependency.Stop(ConnectionString);
SqlDependency.Start(ConnectionString);
if (connection == null)
connection = new SqlConnection(ConnectionString);
//connection.Open();
if (command == null)
command = new SqlCommand("select
Id,First_name,Last_name,Contact_no,
[DateTime],Longitude,Latitude,Address,Responded from dbo.HelpRequests
where Responded = 0 order by [DateTime] desc", connection);
//SqlDependency dep = new SqlDependency(comm);
//dep.OnChange += new OnChangeEventHandler(dep_OnChange);
dependency.OnChange -= dep_OnChange;
dependency.OnChange += new
OnChangeEventHandler(dep_OnChange);
adapter.Fill(dataToWatch);
if (!dataToWatch.Tables[0].Columns.Contains("Link"))
dataToWatch.Tables[0].Columns.Add("Link");
foreach (DataRow dr in dataToWatch.Tables[0].Rows)
{
dr["Link"] = "https://maps.google.com/maps?z=16&t=k&q=loc:" +
dr["Latitude"] + "+" + dr["Longitude"] + "";
}
dgList.DataSource = dataToWatch.Tables[0];
}
Process.Start(dgList.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
}
}
}
}
command.ExecuteNonQuery();
GetData();
}
}
else
{
MessageBox.Show("Please select row");
}
}
}*/
}
}
MyAppDataSet.xsd
<xs:schema id="MyAppDataSet"
targetNamespace="http://tempuri.org/MyAppDataSet.xsd"
attributeFormDefault="qualified" elementFormDefault="qualified">
<xs:annotation>
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
<DataSource DefaultConnectionIndex="0"
FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout,
AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema">
<Connections>
<Connection AppSettingsObjectName="Settings"
AppSettingsPropertyName="MyAppConnectionString"
ConnectionStringObject="" IsAppSettingsProperty="true" Modifier="Assembly"
Name="MyAppConnectionString (Settings)" ParameterPrefix="@"
PropertyReference="ApplicationSettings.HelpRequestViewer.Properties.Settings.
GlobalReference.Default.MyAppConnectionString"
Provider="System.Data.SqlClient"/>
</Connections>
<Tables>
<TableAdapter BaseClass="System.ComponentModel.Component"
DataAccessorModifier="AutoLayout, AnsiClass, Class, Public"
DataAccessorName="HelpRequestsTableAdapter"
GeneratorDataComponentClassName="HelpRequestsTableAdapter"
67
Android Mobile Application
Name="HelpRequests"
UserDataComponentName="HelpRequestsTableAdapter">
<MainSource>
<DbSource ConnectionRef="MyAppConnectionString (Settings)"
DbObjectName="MyApp.dbo.HelpRequests" DbObjectType="Table"
FillMethodModifier="Public" FillMethodName="Fill" GenerateMethods="Both"
GenerateShortCommands="true" GeneratorGetMethodName="GetData"
GeneratorSourceName="Fill" GetMethodModifier="Public"
GetMethodName="GetData" QueryType="Rowset"
ScalarCallRetval="System.Object, mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="true"
UserGetMethodName="GetData" UserSourceName="Fill">
<InsertCommand>
<DbCommand CommandType="Text" ModifiedByUser="false">
<CommandText>INSERT INTO [dbo].[HelpRequests] ([Name], [Phno],
[Longitude], [Latitude], [Location], [Responded], [DateTime]) VALUES
(@Name, @Phno, @Longitude, @Latitude, @Location, @Responded,
@DateTime)
</CommandText>
<Parameters>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName=""
DbType="String" Direction="Input" ParameterName="@Name" Precision="0"
ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Name"
SourceColumnNullMapping="false" SourceVersion="Current"/>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName=""
DbType="String" Direction="Input" ParameterName="@Phno" Precision="0"
ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Phno"
SourceColumnNullMapping="false" SourceVersion="Current"/>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName=""
DbType="String" Direction="Input" ParameterName="@Longitude"
Precision="0" ProviderType="NVarChar" Scale="0" Size="0"
SourceColumn="Longitude" SourceColumnNullMapping="false"
SourceVersion="Current"/><Parameter AllowDbNull="false"
AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input"
ParameterName="@Latitude" Precision="0" ProviderType="NVarChar"
Scale="0" Size="0" SourceColumn="Latitude"
SourceColumnNullMapping="false" SourceVersion="Current"/>
<Parameter AllowDbNull="false" AutogeneratedName="" DataSourceName=""
DbType="String" Direction="Input" ParameterName="@Location" Precision="0"
ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Location"
SourceColumnNullMapping="false" SourceVersion="Current"/>
68
Android Mobile Application
msprop:Generator_DataSetName="MyAppDataSet"
msprop:Generator_UserDSName="MyAppDataSet">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="HelpRequests"
msprop:Generator_TableClassName="HelpRequestsDataTable"
msprop:Generator_TableVarName="tableHelpRequests"
msprop:Generator_TablePropName="HelpRequests"
msprop:Generator_RowDeletingName="HelpRequestsRowDeleting"
msprop:Generator_UserTableName="HelpRequests"
msprop:Generator_RowChangingName="HelpRequestsRowChanging"
msprop:Generator_RowEvHandlerName="HelpRequestsRowChangeEventHandle
r" msprop:Generator_RowDeletedName="HelpRequestsRowDeleted"
msprop:Generator_RowEvArgName="HelpRequestsRowChangeEvent"
msprop:Generator_RowChangedName="HelpRequestsRowChanged"
msprop:Generator_RowClassName="HelpRequestsRow">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" msdata:ReadOnly="true" msdata:AutoIncrement="true"
msdata:AutoIncrementSeed="-1" msdata:AutoIncrementStep="-1"
msprop:Generator_ColumnVarNameInTable="columnID"
msprop:Generator_ColumnPropNameInRow="ID"
msprop:Generator_ColumnPropNameInTable="IDColumn"
msprop:Generator_UserColumnName="ID" type="xs:int"/>
<xs:element name="Name"
msprop:Generator_ColumnVarNameInTable="columnName"
msprop:Generator_ColumnPropNameInRow="Name"
msprop:Generator_ColumnPropNameInTable="NameColumn"
msprop:Generator_UserColumnName="Name">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Phno"
msprop:Generator_ColumnVarNameInTable="columnPhno"
msprop:Generator_ColumnPropNameInRow="Phno"
msprop:Generator_ColumnPropNameInTable="PhnoColumn"
msprop:Generator_UserColumnName="Phno">
<xs:simpleType>
70
Android Mobile Application
<xs:restriction base="xs:string">
<xs:maxLength value="50"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Longitude"
msprop:Generator_ColumnVarNameInTable="columnLongitude"
msprop:Generator_ColumnPropNameInRow="Longitude"
msprop:Generator_ColumnPropNameInTable="LongitudeColumn"
msprop:Generator_UserColumnName="Longitude">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Latitude"
msprop:Generator_ColumnVarNameInTable="columnLatitude"
msprop:Generator_ColumnPropNameInRow="Latitude"
msprop:Generator_ColumnPropNameInTable="LatitudeColumn"
msprop:Generator_UserColumnName="Latitude">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Location"
msprop:Generator_ColumnVarNameInTable="columnLocation"
msprop:Generator_ColumnPropNameInRow="Location"
msprop:Generator_ColumnPropNameInTable="LocationColumn"
msprop:Generator_UserColumnName="Location">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Responded"
msprop:Generator_ColumnVarNameInTable="columnResponded"
msprop:Generator_ColumnPropNameInRow="Responded"
71
Android Mobile Application
msprop:Generator_ColumnPropNameInTable="RespondedColumn"
msprop:Generator_UserColumnName="Responded">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="2147483647"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="DateTime"
msprop:Generator_ColumnVarNameInTable="columnDateTime"
msprop:Generator_ColumnPropNameInRow="DateTime"
msprop:Generator_ColumnPropNameInTable="DateTimeColumn"
msprop:Generator_UserColumnName="DateTime" type="xs:dateTime"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
frmRequestList.Designer.cs
namespace HelpRequestViewer
{
partial class frmRequestList
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed;
otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
72
Android Mobile Application
{
components.Dispose();
}
base.Dispose(disposing);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.dgList = new System.Windows.Forms.DataGridView();
this.colName = new System.Windows.Forms.DataGridViewTextBoxCol-
umn();
this.colFirst_Name = new System.Windows.Forms.DataGridView-
TextBoxColumn();
this.colLastName = new System.Windows.Forms.DataGridViewTextBox-
Column();
this.colNumber = new System.Windows.Forms.DataGridViewTextBox-
Column();
this.colLat = new System.Windows.Forms.DataGridViewTextBoxCol-
umn();
this.colLon = new System.Windows.Forms.DataGridViewTextBoxCol-
umn();
this.colLocation = new System.Windows.Forms.DataGridViewTextBox-
Column();
this.colDateTime = new System.Windows.Forms.DataGridViewTextBox-
Column();
this.Column2 = new System.Windows.Forms.DataGridViewTextBoxCol-
umn();
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuS-
trip(this.components);
this.respondedToolStripMenuItem = new System.Windows.Forms.Tool-
StripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.dgList)).BeginInit();
this.contextMenuStrip1.SuspendLayout();
this.SuspendLayout();
73
Android Mobile Application
//
// dgList
//
this.dgList.AllowUserToAddRows = false;
this.dgList.AllowUserToDeleteRows = false;
this.dgList.ColumnHeadersHeightSizeMode = System.Windows.Forms.-
DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgList.Columns.AddRange(new System.Windows.Forms.DataGrid-
ViewColumn[] {
this.colName,
this.colFirst_Name,
this.colLastName,
this.colNumber,
this.colLat,
this.colLon,
this.colLocation,
this.colDateTime,
this.Column2});
this.dgList.ContextMenuStrip = this.contextMenuStrip1;
this.dgList.Location = new System.Drawing.Point(7, 58);
this.dgList.Name = "dgList";
this.dgList.RowHeadersVisible = false;
this.dgList.SelectionMode = System.Windows.Forms.DataGridViewSelec-
tionMode.FullRowSelect;
this.dgList.Size = new System.Drawing.Size(1109, 512);
this.dgList.TabIndex = 0;
this.dgList.CellClick += new System.Windows.Forms.DataGridView-
CellEventHandler(this.dgList_CellClick);
this.dgList.CellDoubleClick += new System.Windows.Forms.DataGrid-
ViewCellEventHandler(this.dgList_CellDoubleClick);
this.dgList.CellMouseClick += new System.Windows.Forms.DataGrid-
ViewCellMouseEventHandler(this.dgList_CellMouseClick);
this.dgList.MouseClick += new System.Windows.Forms.MouseEven-
tHandler(this.dgList_MouseClick);
//
// colName
//
this.colName.DataPropertyName = "Id";
this.colName.Frozen = true;
this.colName.HeaderText = "ID";
this.colName.Name = "colName";
74
Android Mobile Application
this.colName.ReadOnly = true;
//
// colFirst_Name
//
this.colFirst_Name.DataPropertyName = "First_name";
this.colFirst_Name.HeaderText = "FirstName";
this.colFirst_Name.Name = "colFirst_Name";
this.colFirst_Name.ReadOnly = true;
//
// colLastName
//
this.colLastName.DataPropertyName = "Last_name";
this.colLastName.HeaderText = "LastName";
this.colLastName.Name = "colLastName";
this.colLastName.ReadOnly = true;
//
// colNumber
//
this.colNumber.DataPropertyName = "Contact_no";
this.colNumber.HeaderText = "Contact No";
this.colNumber.Name = "colNumber";
this.colNumber.ReadOnly = true;
//
// colLat
//
this.colLat.DataPropertyName = "Datetime";
this.colLat.HeaderText = "DateTime";
this.colLat.Name = "colLat";
this.colLat.ReadOnly = true;
//
// colLon
//
this.colLon.DataPropertyName = "Longitude";
this.colLon.HeaderText = "Longitude";
this.colLon.Name = "colLon";
this.colLon.ReadOnly = true;
//
// colLocation
//
this.colLocation.DataPropertyName = "Latitude";
this.colLocation.HeaderText = "Latitude";
75
Android Mobile Application
this.colLocation.Name = "colLocation";
this.colLocation.ReadOnly = true;
//
// colDateTime
//
this.colDateTime.DataPropertyName = "Address";
this.colDateTime.HeaderText = "Address";
this.colDateTime.Name = "colDateTime";
this.colDateTime.ReadOnly = true;
//
// Column2
//
this.Column2.DataPropertyName = "Responded";
this.Column2.HeaderText = "Responded";
this.Column2.Name = "Column2";
this.Column2.ReadOnly = true;
//
// contextMenuStrip1
//
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.-
ToolStripItem[] {
this.respondedToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(140, 26);
//
// respondedToolStripMenuItem
//
this.respondedToolStripMenuItem.Name = "respondedToolStripMenu-
Item";
this.respondedToolStripMenuItem.Size = new System.Drawing.Size(152,
22);
this.respondedToolStripMenuItem.Text = "Responded";
this.respondedToolStripMenuItem.Click += new
System.EventHandler(this.respondedToolStripMenuItem_Click);
//
// frmRequestList
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1128, 582);
this.Controls.Add(this.dgList);
76
Android Mobile Application
this.Name = "frmRequestList";
this.Text = "Request List";
this.FormClosed += new System.Windows.Forms.FormClosedEven-
tHandler(this.frmRequestList_FormClosed);
this.Load += new System.EventHandler(this.frmRequestList_Load);
((System.ComponentModel.ISupportInitialize)(this.dgList)).EndInit();
this.contextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
#endregion
77
Android Mobile Application
9.SCREEN LAYOUT
WITH TEST DATA
AND TEST RESULTS
78
Android Mobile Application
79
Android Mobile Application
80
Android Mobile Application
81
Android Mobile Application
Data saved
82
Android Mobile Application
10.REPORT
LAYOUTS
Request list
83
Android Mobile Application
Gps location
84
Android Mobile Application
Delete update
85
Android Mobile Application
11.REFERENCES/
BIBLIOGRAPHY/
WEBSITE USED
86
Android Mobile Application
References:
Beginning Android
Website:
www.google.com
www.developer.android.com
www.stackoverflow.com
www.codeproject.com
87
Android Mobile Application
88