Professional Documents
Culture Documents
Submitted by
Guided by
of
APRIL,2021
Ⅰ
DEPARTMENT OF COMPUTER
SCIENCE AND
APPLICATIONS
Periyar Nagar, Vallam Thanjavur - 613 403, Tamil Nadu, India
Phone: +91 - 4362 - 264600Fax: +91- 4362 - 264660
Email: headmca@pmu.edu Web: www. pmu.edu
BONAFIDE CERTIFICATE
Certified that this Project report “DESIGN AND DEVELOPMENT OF AN
SMART ELECTRICITY BILL PAYMENT MANAGEMENT SYSTEM” is
the bonafide work of “Name (Reg.No)” who carried out the Project work
under my supervision.
Signature :
Name :
Date :
Signature :
Name :
Date :
Ⅱ
ACKNOWLEDGEMENT
Ⅲ
INDEX
ABSTRACT
CHAPTER INTRODUCTION 1
1 Existing System
Proposed System
CHAPTER MODULES 14
4 Admin mode
User mode
Fingerprint sensing
Ⅳ
22-12-2020
To
Name
Reg.No –
BCA
PMIST, Vallam.
Dear R.K.Manisha,
On behalf of the Scion Research and Development, we would like to notify you of this
opportunity for a project. On your acceptance of this offer, you can continue a project
(DESIGN AND DEVELOPMRNT OF AN SMART ELECTRICITY BILL
PAYMENT MANAGEMENT SYSTEM) with the company from January 2021 to
April 2021.
We assure you that the details of your particulars we have collected during your
program should be saved in our covert privately.
Director
Ⅴ
ABSTRACT
The project is a web based application where users can get instant electricity bill and pay them
online via credit card. The system automates the conventional process of paying electricity bill by
visiting the place. Users have to stand in queue for paying bill and wait for their turn. The process is
tiresome and time consuming. They even have to wait for the bill being delivered to their place which
sometimes can be delivered late by the delivery boy. Hence the system is developed to automate the
The system would be having two logins admin and user login. Admin can view user account
details and can even add or updates things in their account. Admin has to feed the system with
electricity usage data into respective users account. The system then calculates the electricity bill for
every user and updates the information into their account every month. User can view their electricity
bill and then the user can get the information like how voltages are used in individual home appliances.
Then the system is used to calculate the voltage level of particular home appliance and how much of
cost is used in that particular appliance and also individually pay on the spot before month end. If user is
incapable of paying the bill before month end, it then calculates fine for each day.
INTRODUCTION
Electricity is one of the vital requirements for sustainment of comforts of life. IT should be used
very judiciously for its proper utilization. But in our country we have lot of localities where we have
surplus supply for the electricity while many areas do not even have access to it. Our policies of its
distribution are also partially responsible for this because we are still not able to correctly estimate our
exact requirements and still how much of power units are used at a particular home appliances is
prevailing.
On the other hand consumers are also not satisfied with the services of power companies. Most
of the time they have complaints regarding statistical errors in their monthly bills. Thus we are trying to
present an idea towards the minimization of technical errors and to reduce human dependency at the
same time. With the help of this project we are aiming to receive the monthly energy consumption from
a remote location directly to a centralized office. In this way we can reduce human efforts needed to
record the meter readings which are till now recorded by visiting every home individually. This results
in considerable loss of human hours and also provides considerable details regarding the average
consumption of a locality so that power supply can be made according to these data. This will help the
officials in deciding the specifications of transformers and other instruments required in power
transmission.
This idea is economically efficient as well because we can get the meter reading at a very low
cost. The implementation is done in such a way that a SMS is delivered to the Modem whose reading is
to be noted and then that meter replies to the server in the SMS format and it is known that SMS costs
are very low.The purpose of this project is to remote monitoring and control of the Domestic Energy
meter. This system enables the Electricity Department to read the meter readings regularly without the
person visiting each house. This can be achieved by the use of Microcontroller unit that continuously
monitors and records the Energy Meter readings in its permanent (non-volatile) memory location.
This system is made to keep the records about the bills of the customers. The admin can manage
all the accounts and the registered users like employees and customers can only manage their own
accounts. This system helps in maintaining the bills and the payments. A different module is there for
employees to check the customer’s details if their job requires. Admin, employees, and customers all
have a different interface and different privileges according to their need. Like a customer can only
manage his account and cannot see any details of other customers, employees can see the details of all
the customer’s accounts and admin can manage all the accounts including the customers and employees
account. This system also has the option for customers to pay their electricity bills by online mode.
Either through internet banking or by debit card.
This system also has the feature to add and delete customer and employee’s accounts in case a
customer wants to cut the connection or an employee wants to leave the job. All the employees are
divided into different departments according to their job profile and the customers are divided according
to their wards. The rest of the modules are explained in the further sections with the detailed
explanation.
This application is used to continuously record the readings and the live meter reading can be
send to the Electricity department on request. This system also can be used to disconnect the power
supply to the house in case of non-payment of electricity bills. Then this system is used to pay the
electricity charge through the online payment. Then this system is also used to find calculation of how
much of units and amount are used at a particular home appliance at the month usage
2
SYSTEM ANALYSIS
Existing System
In the presented system all the jobs of the electricity board is prepared by hand, it is very
complicated to the operators and needs to keep the objects records of the office and a separate record for
the billing and customer details. Many irregularities exist in the present system, which is manually
maintained. It requires high processing time.
Errors may also occur in this system. These details are all stored in special records. Though all the most
importance, tedious a care needed job is the bill calculation. Any one of mistakes may cause severe
consequence. The firm handles all of the work manually, which is very tedious and mismanaged.
DISADVANTAGE:
That is not user friendly.
Existing system requires lot of paper work and even a small transaction require many papers fill.
3
Proposed System
All these factors are verified for the authentication purpose of the user along with
ATM scanning and biometric verification. If any of the above said, parameter are
differing and then the link is generated to the User’s Mobile number for further more
secure authentication system. In the modification phase, an automation user Internet
(Bank server) recognition model using mobile is designed to enhance the user
comfort and detection of the time span spend by the user in the ATM machine. The
system improves the security of ATM’s. Use of Biometric and link provides second level
of security. The system is cost effective and cheaper than usual ATM systems.
Advantage
4
SYSTEM REQUIREMENTS
Hardware Requirement
Hard disk : 1 TB
RAM : 4 GB
Processor : Core i3
Monitor : 15’’Color Monitor
Software Requirement
Front-End : Java
Back end : Fire Base DB
Operating System : Windows 10
IDE : Android
Studio
5
CHAPTER 2
SYSTEM CONFIGURATION
2.1 System Architecture
6
CHAPTER 3
DIAGRAMATIC REPRESENTATION
UML Diagrams
Use Case
Diagram
7
Class Diagram
8
Sequence Diagram
9
Activity diagram
10
ER Diagram
11
Data Flow Diagram
12
Database Structure
TBL_USER="user";
String id;
String
account;
String name;
String mobile;
String password;
int amount;
String otp;
int status;
long createdTime;
long modifedTime;
TBL_TRANSACTION="transaction";
int type;
int amount;
13
CHAPTER
4 MODULES
4 Module
Admin mode: In this mode the user finger print and mobile number are collected and
saved at the time of opening the account.
User mode: In this mode, the user fingerprint is validated with saved fingerprint for
the identification, which is required to perform transactions. This software system is
designed as follows In next step, the system is initialized to check specific task, such
as checking ATM terminal, GSM module and so on, and then each module is reset
for ready to run commands. Before accessing ATM system, the mobile number and
fingerprint of the customer are needed to be authenticated.
Fingerprint sensing, in which the fingerprint of an individual is acquired by a
fingerprint scanner to produce a raw digital representation
4..4 Pre-processing, in which the input fingerprint is enhanced and adapted to simplify
the task of feature extraction
4..5 Feature extraction, in which the fingerprint is further processed to generate
discriminative properties, also called feature vectors
4.6 Matching, in which the feature vector of the input fingerprint is compared against one
or more existing templates.
The first step is to the user enters finger in fingerprint sensor and the sensor verify the
currently entered finger print with registered finger print that already registered in bank
database at the time of account opening. If the two fingerprints get matched, then
SESSION LINK will send to respective mobile number that we have registered in the
bank. After getting SESSION LINK, we have to enter in ATM and we can draw the
money. And the SESSION LINK used only once at a time. From this we can give more
security to the cash holder’s.
CHAPTER 5
DESIGN AND DEVELOPMENT
SYSTEM TESTING
Type of Testing
Testing is the process of trying to discover every conceivable fault or weakness in a work
product. The different type of testing is given below:
Unit Testing:
Unit testing involves the design of test cases that validate that the internal program
logic is functioning properly, and that program inputs produce valid outputs. All decision
branches and internal code flow should be validated. It is the testing of individual
software units of the application .it is done after the completion of an individual unit
before integration.
This is a structural testing, that relies on knowledge of its construction and is invasive.
Unit tests perform basic tests at component level and test a specific business process,
application, and/or system configuration. Unit tests ensure that each unique path of a
business process performs accurately to the documented specifications and contains
clearly defined inputs and expected results.
Integration Testing:
15
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically
aimed at exposing the problems that arise from the combination of components.
Functional Test:
Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and user
manuals.
Performance Testing:
System testing ensures that the entire integrated software system meets requirements.
It tests a configuration to ensure known and predictable results. An example of system
testing is the configuration oriented system integration test. System testing is based on
16
process descriptions and flows, emphasizing pre-driven process links and integration
points.
White Box Testing is a testing in which in which the software tester has knowledge
of the inner workings, structure and language of the software, or at least its purpose. It is
purpose. It is used to test areas that cannot be reached from a black box level.
Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most other
kinds of tests, must be written from a definitive source document, such as specification or
requirements document, such as specification or requirements document. It is a testing in
which the software under test is treated, as a black box .you cannot “see” into it. The test
provides inputs and responds to outputs without considering how the software works.
Acceptance Testing:
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.
Test Results: All the test cases mentioned above passed successfully. No
defects encountered
Validation Testing
Validation testing is the process of ensuring if the tested and developed software
satisfies the client /user needs. The business requirement logic or scenarios have to be
tested in detail. All the critical functionalities of an application must be tested here.
17
As a tester, it is always important to know how to verify the business logic or scenarios
that are given to you. One such method that helps in detail evaluation of the
functionalities is the Validation Process.
Whenever you are asked to perform a validation test, it takes a great responsibility as you
need to test all the critical business requirements based on the user needs. There should
not be even a single miss on the requirements asked by the user. Hence a keen knowledge
on validation testing is much important.
As a tester, you need to evaluate if the test execution results comply with that mentioned
in the requirements document. Any deviation should be reported immediately and that
deviation is thus called a bug.
From a company perspective, the validation test in simple is carried out by the
following steps:
You gather the business requirements for validation testing from the end user.
Prepare the business plan and send it for the approval to the
onsite/stakeholders involved.
On approval of the plan, you begin to write the necessary test cases and send
them for approval.
Once approved you begin to complete testing with the required
software, environment and send the deliverables as requested by the
client.
Upon approval of the deliverables, UAT testing is done by the client.
After that, the software goes for production.
18
Fields Testing
This testing is done in the last phase when the regression is done for the
application and the application is called stable by the ‘Team’ before the release. There
may or may not be a requirement given for this from the customer. The type of testing
mainly include the functional and usability of the application. This is strictly done on
Mobile Networks. QA's need to step out and test while walking around or at home or
driving. Testing is done only on real devices.
19
CHAPTER
7 APPENDIX
APPENDIX
Sample Code
package com.example.secureatm.ui.activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.secureatm.R;
import com.example.secureatm.model.UserData;
import com.example.secureatm.utils.CommonUtils;
import com.example.secureatm.utils.DatabaseUtils;
import com.example.secureatm.utils.FilePathUtils;
import com.example.secureatm.utils.LogUtils;
import
com.example.secureatm.utils.PreferenceUtils;
import com.example.secureatm.utils.SMSUtils;
import com.example.secureatm.utils.WebFramework;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.example.secureatm.R;
import com.example.secureatm.model.UserData;
import com.example.secureatm.utils.CommonUtils;
import com.example.secureatm.utils.DatabaseUtils;
import com.example.secureatm.utils.FilePathUtils;
import com.example.secureatm.utils.LogUtils;
import
com.example.secureatm.utils.PreferenceUtils;
import com.example.secureatm.utils.SMSUtils;
import com.example.secureatm.utils.WebFramework;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
24
import com.google.firebase.database.ValueEventListener;
25
import com.google.firebase.storage.FirebaseStorage;
import java.io.File;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
@BindView(R.id.til_username)
TextInputLayout til_username;
@BindView(R.id.til_password)
TextInputLayout til_password;
@BindView(R.id.ed_username)
EditText ed_user_name;
@BindView(R.id.ed_password)
EditText ed_password;
@BindView(R.id.btn_login)
Button btn_login;
@BindView(R.id.llay_forget_password)
LinearLayout llay_forget_password;
26
@BindView(R.id.llay_register)
LinearLayout llay_register;
@BindView(R.id.tv_new_user)
TextView tv_new_user;
@BindView(R.id.tv_admin)
TextView tv_admin;
@BindView(R.id.iv_sign)
ImageView iv_sign;
@BindView(R.id.tv_logo_instruction)
TextView tv_logo_instruction;
@BindView(R.id.llay_admin)
LinearLayout llay_admin;
Dialog dialog;
FirebaseStorage storage;
Uri selectedUri;
boolean isUploading=false;
int REQUEST_ID_STORAGE_PERMISSIONS=1;
Context context;
SharedPreferences prefs;
27
FirebaseDatabase database;
Bitmap bmSelected;
int LOGIN_TYPE=USER_LOGIN;
Handler hh=new
Handler(); String
strErrorMsg="";
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_screen);
try{
getSupportActionBar().hide();
ButterKnife.bind(this);
context = this;
prefs = getSharedPreferences(PreferenceUtils.PREF_NAME,
storage=FirebaseStorage.getInstance();
tv_new_user.setPaintFlags(tv_new_user.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG);
28
tv_admin.setPaintFlags(tv_admin.getPaintFlags() |
Paint.UNDERLINE_TEXT_FLAG);
btn_login.setOnClickListener(new View.OnClickListener()
{ @Override
{ try{
if(LOGIN_TYPE==USER_LOGIN){
String strUserName =
ed_password.getText().toString().trim();
if (selectedUri!=null&&strUserName.length() == 10 ) {
loginRequest(strUserName, strPassword);
} else {
if(selectedUri==null){
tv_logo_instruction.setVisibility(View.VISIBLE);
tv_logo_instruction.setTextColor(Color.RED);
if (strUserName.length() !=10) {
til_username.setError(getResources().getString(R.string.valid_mobile));
// if (strPassword.length() == 0) {
29
// til_password.setError( getResources().getString(R.string.empty_validation_field));
30
}
}else{
String strUserName =
ed_password.getText().toString().trim();
{ loginTransactionRequest(strUserName, strPassword);
} else {
if (strUserName.length() !=10) {
til_username.setError(getResources().getString(R.string.valid_mobile));
if (strPassword.length() != 6) {
LogUtils.printException(e);
iv_sign.setOnClickListener(new View.OnClickListener()
{ @Override
31
public void onClick(View view) {
32
try{
boolean isGranted =
CommonUtils.isStoragePermissionGranted(context,
REQUEST_ID_STORAGE_PERMISSIONS);
if (isGranted) {
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select
Finger Print"), PICK_IMAGE);
LogUtils.printException(e);
llay_admin.setOnClickListener(new View.OnClickListener()
{ @Override
{ try{
LOGIN_TYPE=ADMIN_LOGIN;
iv_sign.setVisibility(View.GONE);
tv_logo_instruction.setVisibility(View.GONE);
til_password.setVisibility(View.VISIBLE);
// til_username.setHint("User name");
33
ed_user_name.setHint("User name");
btn_login.setText("Submit");
LogUtils.printException(e);
// llay_forget_password.setOnClickListener(new View.OnClickListener() {
// @Override
// try{
// CommonUtils.goNextScreen(LoginScreen.this, ForgetPasswordScreen.class);
// LogUtils.printException(e);
llay_register.setOnClickListener(new View.OnClickListener() {
@Override
{ try{
startActivity(i);
LogUtils.printException(e);
29
// boolean isLogin=prefs.getBoolean(PreferenceUtils.LOGIN_STATUS,false);
// if(isLogin){
// String nUserType=prefs.getString(PreferenceUtils.USER_TYPE,null);
// CommonUtils.goNextScreen(LoginScreen.this,HomeScreen.class);
// finish();
LogUtils.printException(e);
} }
/**
*/
try{
CommonUtils.showProgress(context);
Query query=myRef.orderByChild("mobile").equalTo(strUsername);
30
query.addListenerForSingleValueEvent(new ValueEventListener()
{ @Override
CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
if(bd!=null){
if(bd.getMobile().equals(strUsername)){
try {
CommonUtils.showProgress(context);
@Override
{ try{
String strOriginalFinger=bd.getImage();
31
URL urlFinger = new URL(strOriginalFinger);
Bitmap imageFinger =
BitmapFactory.decodeStream(urlFinger.openConnection().getInputStream());
final boolean
isFingerValid=CommonUtils.compareImages(imageFinger,bmSelected);
LogUtils.i("LoginValidation","LoginValidation :
"+isFingerValid);
try {
if (isFingerValid) {
String strMobile=bd.getMobile();
LogUtils.i("MsgLength",strMobile+" MsgLength
"+strContent.length());
sendSMSMessage("91",strMobile,strContent,null);
myRef.child(bd.getId()).child("otp").setValue(pwd).addOnSuccessListener(new
OnSuccessListener<Void>() {
32
@Override
PreferenceUtils.saveBoolean(PreferenceUtils.LOGIN_STATUS,true,prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_ID,bd.getId(),prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_CODE,strUsername,prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_NAME,bd.getName(),prefs);
PreferenceUtils.saveText(PreferenceUtils.ACCOUNT, bd.getAccount(),prefs);
if(!bd.getId().equals("admin")){
String
strFcmToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);
sendFCMToken(strFcmToken,bd.getId());
hh.postDelayed(new Runnable()
{ @Override
CommonUtils.hideProgress();
33
finish();
},100);
} else {
hh.postDelayed(new Runnable()
{ @Override
CommonUtils.hideProgress();
CommonUtils.showErrorToast(strErrorMsg,
context);
},100);
LogUtils.printException(e);
} catch(Exception e) {
LogUtils.printException(e);
34
}
}).start();
} catch(Exception e) {
LogUtils.printException(e);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCredentials),cont
ext);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCredentials),cont
ext);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCredentials),cont
ext);
@Override
35
// Query queryRef = ref.orderByChild("arrivalDate_code").equalTo("2016-
06- 21_GOT");
// queryRef.addListenerForSingleValueEvent(new ValueEventListener() {
// @Override
// @Override
// CommonUtils.hideProgress();
// UserData bd = dataSnapshot.getValue(UserData.class);
//// @Override
// CommonUtils.hideProgress();
// LogUtils.e("DBError", "Error....");
// }
// });
LogUtils.printException(e);
36
private void sendSMSMessage(final String countryCode,final String mobile,final
String messag,final String from) {
try {
{ @Override
{ try{
=null&&from.length()>0){
mapParameters.put("sender", from);
}else{
mapParameters.put("sender", SMSUtils.SENDER);
mapParameters.put("route", ""+SMSUtils.ROUTE);
mapParameters.put("mobiles", mobile);
mapParameters.put("authkey", SMSUtils.AUTH_KEY);
mapParameters.put("message", message);
String authStringEnc="";
37
mapHeaders.put("Authorization", "Basic " + authStringEnc);
String strResponse =
objWebFramework.doHttpRequest(SMSUtils.URL, WebFramework.HttpMethod.GET,
mapParameters, mapHeaders);
LogUtils.e("sendWhatsAppMessage","onCompleted Response :
"+strResponse);
LogUtils.printException(e);
}).start();
} catch (Exception e)
{ e.printStackTrace(
);
try{
CommonUtils.showProgress(context);
Query query=myRef.orderByChild("mobile").equalTo(strUsername);
query.addListenerForSingleValueEvent(new ValueEventListener() {
38
@Override
39
public void onDataChange(DataSnapshot dataSnapshot) {
CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
final UserData bd =
issue.getValue(UserData.class); if(bd!=null){
if(bd.getMobile().equals(strUsername)&&bd.getOtp().equals(strPassword)&&bd.getStatu
s()==1){
myRef.child(bd.getId()).child("otp").setValue("").addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
PreferenceUtils.saveBoolean(PreferenceUtils.LOGIN_STATUS,true,prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_ID,bd.getId(),prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_CODE,strUsername,prefs);
PreferenceUtils.saveText(PreferenceUtils.USER_NAME,bd.getName(),prefs);
40
PreferenceUtils.saveText(PreferenceUtils.ACCOUNT, bd.getAccount(),prefs);
CommonUtils.goNextScreen(LoginScreen.this,
TransactionScreen.class);
finish();
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCredentials),cont
ext);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCredentials),cont
ext);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.invalidCredentials),cont
ext);
@Override
41
}
LogUtils.printException(e);
{ try {
myRef.child("fcmToken").setValue(fcmtoken);
LogUtils.printException(e);
@Override
super.onRequestPermissionsResult(requestCode, permissions,
grantResults); try{
_ID_STORAGE_PERMISSIONS&&grantResults[0]==
PackageManager.PERMISSION_GRANTED){
42
LogUtils.i("permission","onRequestPermissionsResult permisssion
granted... permission : "+permissions.toString()+" result :
"+grantResults.toString());
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
LogUtils.printException(e);
@Override
try {
43
LogUtils.i("Logo","Logo Uri : "+path);
File file=new
File(path);
if(file.exists()){
LogUtils.i("Logo","Logo : "+file.getAbsolutePath());
long length=file.length();
if(length<=CommonUtils.MAX_LOGO_SIZE){
selectedUri=uri;
tv_logo_instruction.setTextColor(Color.BLACK);
tv_logo_instruction.setVisibility(View.GONE);
try {
Bitmap bitmap =
MediaStore.Images.Media.getBitmap(getContentResolver(), uri);
44
// Log.d(TAG, String.valueOf(bitmap));
45
bmSelected=bitmap;
iv_sign.setImageBitmap(bitmap);
} catch (Exception e) {
LogUtils.printException(e);
}else{
CommonUtils.showErrorToast(getResources().getString(R.string.select5mb),context);
} catch (Exception e) {
LogUtils.printException(e);
package com.example.secureatm.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
46
import android.provider.MediaStore;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.secureatm.R;
import com.example.secureatm.model.UserData;
import com.example.secureatm.utils.CommonUtils;
import com.example.secureatm.utils.DatabaseUtils;
import com.example.secureatm.utils.FilePathUtils;
import com.example.secureatm.utils.LogUtils;
import com.example.secureatm.utils.PreferenceUtils;
47
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.Query;
import com.google.firebase.database.ValueEventListener;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import com.google.firebase.storage.UploadTask;
import java.io.File;
import butterknife.BindView;
import butterknife.ButterKnife;
{ Context context;
SharedPreferences prefs;
@BindView(R.id.til_name)
TextInputLayout til_name;
@BindView(R.id.ed_name)
48
EditText ed_name;
@BindView(R.id.til_mobile)
TextInputLayout til_mobile;
@BindView(R.id.ed_mobile)
EditText ed_mobile;
@BindView(R.id.til_password)
TextInputLayout til_password;
@BindView(R.id.ed_password)
EditText ed_password;
@BindView(R.id.til_id)
TextInputLayout til_id;
@BindView(R.id.ed_id)
EditText ed_id;
@BindView(R.id.btn_register)
Button btnRegister;
@BindView(R.id.iv_sign)
ImageView iv_sign;
@BindView(R.id.tv_logo_instruction)
TextView tv_logo_instruction;
49
FirebaseDatabase database;
int isMobileNumberAvailable=0;
int isAccountAvailable=0;
long createdTime=0;
FirebaseStorage storage;
Uri selectedUri;
boolean isUploading=false;
int REQUEST_ID_STORAGE_PERMISSIONS=1;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registration_screen);
try{
ButterKnife.bind(this);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context=this;
prefs=getSharedPreferences(PreferenceUtils.PREF_NAME,MODE_PRIVATE);
database = FirebaseDatabase.getInstance();
50
storage= FirebaseStorage.getInstance();
getSupportActionBar().setTitle(getResources().getString(R.string.sign_up));
btnRegister.setText(getResources().getString(R.string.sign_up));
btnRegister.setOnClickListener(new View.OnClickListener()
{ @Override
{ try{
// String strCountryCode =
ed_mobile.getText().toString().trim();
if (selectedUri!
=null&&strId.length()==10&&isAccountAvailable==0&&strName.length()
> 0 && strMobile.length() > 0&&isMobileNumberAvailable==0 &&
strMobile.length()==10
&&strPassword.length()>0&&CommonUtils.isValidPassword(strPassword)) {
uploadSign(strId,strName,strMobile,strPassword);
} else {
if(selectedUri==null){
49
tv_logo_instruction.setVisibility(View.VISIBLE);
tv_logo_instruction.setTextColor(Color.RED);
if (strName.length() == 0) {
til_name.setError(getResources().getString(R.string.empty_validation_field));
if (strId.length() != 10) {
til_id.setError(getResources().getString(R.string.id_validation_field));
}else if(isAccountAvailable==1){
til_id.setError(getResources().getString(R.string.alreadyExist));
if (strMobile.length() == 0) {
il_mobile.setError(getResources().getString(R.string.empty_validation_field));
}else if(strMobile.length()!=10 ){
til_mobile.setError(getResources().getString(R.string.valid_mobile));
}else if(isMobileNumberAvailable==1){
til_mobile.setError(getResources().getString(R.string.mobile_already_exist));
if (strPassword.length() == 0) {
til_password.setError(getResources().getString(R.string.empty_validation_field));
50
}else if(!CommonUtils.isValidPassword(strPassword)){
til_password.setError(getResources().getString(R.string.valid_password_error));
LogUtils.printException(e);
iv_sign.setOnClickListener(new View.OnClickListener()
{ @Override
try{
boolean isGranted =
CommonUtils.isStoragePermissionGranted(context,
REQUEST_ID_STORAGE_PERMISSIONS);
if (isGranted) {
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
51
LogUtils.printException(e);
ed_mobile.addTextChangedListener(new TextWatcher()
@Override
@Override
{ if(CommonUtils.isValid(ed_mobile)){
til_mobile.setError(null);
handler.removeCallbacks(runnableMobile);
handler.postDelayed(runnableMobile,CommonUtils.EDITBOX_DELAY);
@Override
});
ed_id.addTextChangedListener(new TextWatcher() {
@Override
52
@Override
{ if(CommonUtils.isValid(ed_id)){
til_id.setError(null);
handler.removeCallbacks(runnableAccountId);
handler.postDelayed(runnableAccountId,CommonUtils.EDITBOX_DELAY);
@Override
CommonUtils.initTextChangeEvent(ed_name,til_name);
// CommonUtils.initTextChangeEvent(ed_countrycode,til_countrycode);
CommonUtils.initTextChangeEvent(ed_password,til_password);
LogUtils.printException(e);
{ @Override
{ try{
String strMobile=ed_mobile.getText().toString().trim();
if(CommonUtils.isValidMobile(strMobile)){
53
checkMobileNumberExist();
}else{
til_mobile.setError(getResources().getString(R.string.valid_mobile));
LogUtils.printException(e);
{ @Override
{ try{
String strId=ed_id.getText().toString().trim();
if(strId.length()==10){
checkAccountIdExist();
}else{
til_id.setError(getResources().getString(R.string.id_validation_field));
54
LogUtils.printException(e);
try {
isMobileNumberAvailable=0;
Query query=myRef.orderByChild("mobile").equalTo(strMobile);
query.addListenerForSingleValueEvent(new ValueEventListener()
@Override
// CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
UserData bd = issue.getValue(UserData.class);
if(bd!=null){
55
if(bd.getMobile()!=null&&bd.getMobile().equals(strMobile)){
56
isMobileNumberAvailable=1;
il_mobile.setError(getResources().getString(R.string.mobile_already_exist));
}else{
}else{
}else{ @
Override
});
} catch (Exception e) {
LogUtils.printException(e);
{ try {
56
isAccountAvailable=0;
Query query=myRef.orderByChild("account").equalTo(strAccountId);
query.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
// CommonUtils.hideProgress();
if (dataSnapshot.exists()) {
UserData bd = issue.getValue(UserData.class);
if(bd!=null){ if(bd.getAccount()!
=null&&bd.getAccount().equals(strAccountId)){
isAccountAvailable=1;
til_id.setError(getResources().getString(R.string.alreadyExist));
}else{
}else{
}else{
57
@Override
} catch (Exception e) {
LogUtils.printException(e);
@Override
{ switch (item.getItemId()) {
case android.R.id.home:
goBack();
return true;
return super.onOptionsItemSelected(item);
/**
*/
{ try{
58
finish();
LogUtils.printException(e);
@Override
{ try{
if (keyCode == KeyEvent.KEYCODE_BACK)
{ goBack();
return true;
LogUtils.printException(e);
@Override
{ super.onPause();
59
@Override
{ super.onResume();
@Override
super.onRequestPermissionsResult(requestCode, permissions,
grantResults); try{
if(requestCode==REQUEST_ID_STORAGE_PERMISSIONS&&grantResults[0]==
PackageManager.PERMISSION_GRANTED){
LogUtils.i("permission","onRequestPermissionsResult permisssion
granted... permission : "+permissions.toString()+" result : "+grantResults.toString());
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
LogUtils.printException(e);
private void uploadSign(final String strId, final String strName, final String strMobile,
final String strPwd){
60
try{
File("path/to/images/rivers.jpg")); isUploading=true;
CommonUtils.showProgress(context);
StorageReference ref=storage.getReference();
StorageReference riversRef =
ref.child("FingerPrint/"+strMobile+"/images/"+selectedUri.getLastPathSegment());
uploadTask.addOnFailureListener(new OnFailureListener() {
@Override
// Handle unsuccessful
uploads isUploading=false;
CommonUtils.hideProgress();
}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>()
{
@Override
isUploading=false;
61
CommonUtils.hideProgress();
registerRequest(strId,strName,strMobile,
strPwd,taskSnapshot.getDownloadUrl().toString());
// ...
});
LogUtils.printException(e);
/**
*/
private void registerRequest(final String strId, String strName, final String strMobile,
String strPwd, String fingerPath){
try {
62
DatabaseReference myRef =
database.getReference(DatabaseUtils.TBL_USER); String
id=myRef.push().getKey();
if(createdTime==0){
createdTime=modifiedTime;
String strFCMToken=prefs.getString(PreferenceUtils.FCM_TOKEN,null);
UserData bd=new
UserData(id,strId,strName,strMobile,strPwd,fingerPath,strFCMToken,0,"",createdTime,
modifiedTime);
CommonUtils.showProgress(context);
myRef.child(id).setValue(bd).addOnSuccessListener(new
OnSuccessListener<Void>() {
@Override
CommonUtils.hideProgress();
CommonUtils.showSuccessToast(getResources().getString(R.string.saveSuccess),context
);
goBack();
63
}).addOnFailureListener(new OnFailureListener()
{ @Override
{ CommonUtils.hideProgress();
LogUtils.printException(e);
@Override
data) try {
File file=new
File(path);
if(file.exists()){
64
LogUtils.i("Logo","Logo : "+file.getAbsolutePath());
long length=file.length();
if(length<=CommonUtils.MAX_LOGO_SIZE){
selectedUri=uri;
tv_logo_instruction.setTextColor(Color.BLACK);
tv_logo_instruction.setVisibility(View.GONE);
try {
Bitmap bitmap =
MediaStore.Images.Media.getBitmap(getContentResolver(), uri);
// Log.d(TAG,
String.valueOf(bitmap));
iv_sign.setImageBitmap(bitmap);
} catch (Exception e) {
LogUtils.printException(e);
}else{ CommonUtils.showErrorToast(getResources().getString(R.string.select5mb),con
text);
65
} catch (Exception e) {
LogUtils.printException(e);
package com.example.secureatm.ui.activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.design.widget.TextInputEditText;
import android.support.design.widget.TextInputLayout;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import com.example.secureatm.R;
66
import com.example.secureatm.model.TransactionData;
import com.example.secureatm.model.UserData;
import com.example.secureatm.utils.CommonUtils;
import com.example.secureatm.utils.DatabaseUtils;
import com.example.secureatm.utils.LogUtils;
import com.example.secureatm.utils.PreferenceUtils;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import butterknife.BindView;
import butterknife.ButterKnife;
{ Context context;
SharedPreferences prefs;
@BindView(R.id.tv_amount)
TextView tv_amount;
67
@BindView(R.id.til_amount)
TextInputLayout til_amount;
@BindView(R.id.ed_amount)
TextInputEditText ed_amount;
@BindView(R.id.btn_deposit)
Button btn_deposit;
@BindView(R.id.btn_withdraw)
Button btn_withdraw;
FirebaseDatabase database;
long createdTime=0;
String strUserId;
int nAmount=0;
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_transaction_screen);
try{
ButterKnife.bind(this);
getSupportActionBar().setTitle("Account");
68
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
context=this;
prefs=getSharedPreferences(PreferenceUtils.PREF_NAME,MODE_PRIVATE);
strUserId=prefs.getString(PreferenceUtils.USER_ID,null);
database = FirebaseDatabase.getInstance();
getEditDetails(strUserId);
btn_deposit.setOnClickListener(new View.OnClickListener()
{ @Override
String strAmount=ed_amount.getText().toString().trim();
int nVal=0;
if(strAmount.length()>0){
nVal= Integer.parseInt(strAmount);
if(nVal>0){
updateTransactionData(td);
}else{
btn_withdraw.setOnClickListener(new View.OnClickListener()
69
{
70
@Override
String strAmount=ed_amount.getText().toString().trim();
int nVal=0;
if(strAmount.length()>0){
nVal= Integer.parseInt(strAmount);
if(nVal>0){
TransactionData td=new
TransactionData(2,nVal);
updateTransactionData(td);
}else{
LogUtils.printException(e);
{ try {
DatabaseReference myRef =
database.getReference(DatabaseUtils.TBL_TRANSACTION);
CommonUtils.showProgress(context);
myRef.child(strUserId).setValue(data).addOnSuccessListener(new
OnSuccessListener<Void>() {
71
@Override
{ try{
CommonUtils.hideProgress();
handler.postDelayed(new Runnable()
{ @Override
{ goBack();
},2000);
LogUtils.printException(e);
}).addOnFailureListener(new OnFailureListener()
{ @Override
{ CommonUtils.hideProgress();
LogUtils.printException(e);
72
myRef =
database.getReference(DatabaseUtils.TBL_USER).child(strUserID);
CommonUtils.showProgress(context);
myRef.addValueEventListener(new ValueEventListener() {
boolean isFirst=true;
@Override
try {
CommonUtils.hideProgress();
if (data != null)
{ if (isFirst) {
tv_amount.setText("Rs." + data.getAmount());
nAmount = data.getAmount();
} else {
if (data.getStatus() == 0) {
CommonUtils.showErrorToast("Session Closed!",
context); goBack();
if (isFirst) {
73
isFirst =
false;
74
handler.postDelayed(runnableBack, 60000 * 3);
LogUtils.printException(e);
@Override
{ CommonUtils.hideProgress();
LogUtils.e("DBError", "Error.
....................................................")
LogUtils.printException(e);
{ @Override
{ goBack();
@Override
{ switch (item.getItemId()) {
75
// Respond to the action bar's Up/Home button
case android.R.id.home:
76
goBack();
return true;
return super.onOptionsItemSelected(item);
@Override
{ super.onDestroy();
try{
handler.removeCallbacks(runnableBack);
LogUtils.printException(e);
/**
*/
{ try{
CommonUtils.goNextScreen(TransactionScreen.this,LoginScreen.class);
finish();
LogUtils.printException(e);
74
Screen Shot
75
76
77
78
79
80
CHAPTER 8
CONCLUSION AND FUTURE
WORK
CONCLUSION AND FUTURE WORK
Conclusion
The system also contains the original verifying methods which was inputting
owner's password which is send by the controller. The security features were enhanced
largely for the stability and reliability of owner recognition. The whole system was built
on the fingerprint technology which makes the system more safe, reliable and easy to use.
As we know that fingerprint are the most acceptable biometrics all over the world in
identifying a person. Some government in the world are still implementing fingerprints
technique to identify their citizens and the criminal from the scene of crimes in forensic
work.
81
Future Work
82