Professional Documents
Culture Documents
alert
Synopsis
In this system, we develop android smart phone application to assists elderly
people for independent living with their wishes. It reduces the burden of allotting
health care professionals in homes to monitor elder persons. Smartphone application
gives services and assists the elderly person to complete their daily life activities as
others. This application Patients need not remember their medicine dosage timings
as they can set their dosage timings. Voice based Remainder notification alert can
be set for multiple medicines and timings including date, time and medicine
description, this application will remind their user about the medicine in-take
schedule. This mobile application integrates with multiple color button option.
Whenever the user click on the emergency color button based on color pattern action
will be performed. For example if user click red button “Emergency ”this message
automatically send to register members mobile number .By pressing the color button
based on color this mobile application automatically send the service message to
particular register mobile number and mail id. It is quite possible you can
communicate effectively to explain your position to family members. This helps to
identify protect and call on resources to help the one out of dangerous situations.
Elder people can able select disease details based on this disease application
automatically shows Home Remedies details effectively. So this application is
having both safety and security.
Introduction
In day-to-day life most of the people need to take medicines which was not
there in past couple of years and the reason behind this is diseases are increasing in
large amount. So sooner or later many people come in contact with these diseases.
Some diseases are temporary diseases while many are permanent life threatening
diseases. Life threatening diseases gets mixes with the human body in such a way
that they can’t leave the body ever and they increases in rapid time. Life span of
humans became less because of such diseases and to overcome or to live a better life
we need to take medicines regularly and also in large amount. We need to be in
advice of Doctor who tells us to take desired pills in desired way so that patients face
problems like forgetting pills to take at right time and also when Doctor changes the
prescription of medicine patients have to remember the new schedule of medicine.
This problem of forgetting to take pills at right time, taking wrong medicines and
accidentally taking of expired medicine causes health issues of patient and this leads
to suffer from unhealthy life. Our project is to made android based Smart phone
which uses Real time clock. Our system takes up the prescription details from the
user such as the duration of the prescription, the names of the medicines, the times
they are to be taken and the amount of each medicine which is to be taken. After all
this data has been entered, our system will remind the user at the prescribed time of
which medicine is to be taken in form of a mobile notification and a physical
reminder. The patients can leave taking medicines to just our app. Whenever the
time for the medicine is up, they will be notified and they only have to take their
prescriptions during that time, and no other time. If implemented properly, this will
drastically decrease overdose of medicines due to forgetfulness and the patients will
also be reminded to take their medicines.
Problem Statement
The main problem of this application is patients may forget to intake
of medicines right time. So it is important to take legitimate prescriptions
in appropriate amount at legitimate time. So it is necessary to take proper
medicines in proper time interval. Existing system is more time
consuming processes some persons should be there in the house to
monitor the elder people.
Existing system
A large portion of times patients may neglect to take the meds at
legitimate time according to the predetermined in the solution which may
cause in late recuperation from the ailment/disease. So it is important to
take legitimate prescriptions in appropriate amount at legitimate time. So
it is necessary to take proper medicines in proper time interval. Existing
system is more time consuming processes some persons should be there
in the house to monitor the elder people.
Disadvantage
Advantage
SYSTEM REQUIREMENT
HARDWARE REQUIREMENT
➢ Ram size : 4 GB
SOFTWARE REQUIREMENT
➢ Language : JAVA
➢ Documentation : Ms-Office
Modules
1. User Register/Authentication
This module is mainly based on mobile user. Using this module user can
register in the registration form he has to fill with personal details such as name,
address, mobile number mail id and username, password etc. This will maintain in a
separate table. Using this password user can log on this mobile application. After the
successful login they can use app feature effective manner.
In this module helps to intially user they can able to store customize voice in
folder. Based on the storage application automatically check
This module completed based on user. User can view remainder details and
he has a right to add and edit medicine and reminder details easy and effective
manner.
This module helps to send service message related information whenever the
elder people click on the emergency color button such as red button “Emergency
”this message automatically send to register members mobile number .By pressing
the color button based on color this mobile application automatically send the service
message to particular register mobile number.
7. Home Remedies
This module helps user to know complete home remedies details. Elder people
can able select disease details based on this disease application automatically shows
Home Remedies details effectively. Elder people they can view remedies effectively.
Medical
User Remain Elder People
der
Level 1
Register
User User register
/Login
Add
reminder Reminder info
Level 2
Emergenc
Elder people Number table
y
Intimation
User
Get emergency
Notification
Elder people
Table name: Register
Reminder info
Number info
Fields Data Type Description Constraints
Contact Addres
s
Passwor
Passwor U id
Name d
d
Email id
User
id
Registration Log Login
in
1 to 1
to1details
Aler
t
1 to m
Reminder
Name of Date
Medicine
Time Dosage
Architecture diagram
4
1 2 3 Set
Medicine Database
Register/Login
Reminder
6
5
Voice Based Time
Medicine
checking
Reminder Alert
process
Elder people
FEASIBILITY STUDY
➢ Technical Feasibility
➢ Behavioral Feasibility
➢ Economical Feasibility
➢ Operational Feasibility
Technical Feasibility
The consideration those are normally associated with the technical feasibility
include the following
➢ Development risk
➢ Resource availability
➢ Technology
The development risk concerns the probability, the function of all elements
and its performance should be same in all platforms and in the system that is being
developed. This system is developed according to the standards and the development
software tools are selected in such a way to avoid the problems cited above.
The software used to develop this system is Windows XP, visual studio Dot net is
done efficiently, and the concept of SQL helps to create the application backend.
These components are also helpful in providing interactivity to Java applications.
Behavioral Feasibility
Economical Feasibility
This is the most frequently used method for evaluating the effectiveness of a
user system. More commonly, know as cost analysis the procedure is to determine
the benefits and savings that are expected from a candidate system and compare
them with costs.
Operational Feasibility deals with the study of prospects of the system. This
system operationally eliminates all the tensions of the administrator and helps in
effectively tracking the project progress. This kind of automation will surely reduce
the time and energy, which previously consumed in manual work. Based on the
study, the system proved to be operationally feasible.
LANGAUGE SPECIFICATION
Android
Features of Android
1. Beautiful UI
2. Connectivity
GSM/EDGE, IDEN, CDMA, EV-DO, UMTS, Bluetooth, Wi-Fi, LTE, NFC and
WiMAX.
3 Storage
4. Media support
H.263, H.264, MPEG-4 SP, AMR, AMR-WB, AAC, HE-AAC, AAC 5.1,
MP3, MIDI, Ogg Vorbis, WAV, JPEG, PNG, GIF, and BMP.
5. Messaging
6 .Web browser
7. Multi-touch
Android has native support for multi-touch which was initially made available
in handsets such as the HTC Hero.
8. Multi-tasking
User can jump from one task to another and same time various applications
can run simultaneously.
9. Resizable widgets
Widgets are resizable, so users can expand them to show more content or
shrink them to save space.
10. Multi-Language
Linux Kernel
The basic layer is the Linux kernel. The whole Android OS is built on top of
the Linux 2.6 Kernel with some further architectural changes made by Google. It is
this Linux that interacts with the hardware and contains all the essential hardware
drivers. Drivers are programs that control and communicate with the hardware. For
example, consider the Bluetooth function. All devices has a Bluetooth hardware in
it. Therefore the kernel must include a Bluetooth driver to communicate with the
Bluetooth hardware. The Linux kernel also acts as an abstraction layer between the
hardware and other software layers. Android uses the Linux for all its core
functionality such as Memory management, process management, networking,
security settings etc.As the Android is built on a most popular and proven
foundation, it made the porting of Android to variety of hardware, a relatively
painless task.
Libraries
The next layer is the Android’s native libraries. It is this layer that enables the device
to handle different types of data. These libraries are written in c or c++ language and
are specific for a particular hardware.
Media framework: Media framework provides different media codecs allowing the
recording and playback of different media formats
SQLite: SQLite is the database engine used in android for data storage purposes
Android Runtime
Android Runtime consists of Dalvik Virtual machine and Core Java libraries.
It is a type of JVM used in android devices to run apps and is optimized for low
processing power and low memory environments. Unlike the JVM, the Dalvik
Virtual Machine doesn’t run .class files, instead it runs .dex files. .dex files are built
from .class file at the time of compilation and provide hifger efficiency in low
resource environments. The Dalvik VM allows multiple instance of Virtual machine
to be created simultaneously providing security, isolation, memory management and
threading support. It is developed by Dan Bornstein of Google. Libraries:
These are different from Java SE and Java ME libraries. However these libraries
provide most of the functionalities defined in the Java SE libraries.
Application Framework
These are the blocks that our applications directly interact with. These programs
manage the basic functions of phone like resource management, voice call
management etc. As a developer, you just consider these are some basic tools with
which we are building our applications.
Applications
Applications are the top layer in the Android architecture and this is where our
applications are gonna fit. Several standard applications comes pre-installed with
every device, such as:
▪ Dialer
▪ Web browser
▪ Contact manager
As a developer we are able to write an app which replace any existing system app.
That is, you are not limited in accessing any particular feature. You are practically
limitless and can whatever you want to do with the android (as long as the users of
your app permit it). Thus Android is opening endless opportunities to the developer.
Android Applications
Android applications are usually developed in the Java language using the
Android Software Development Kit.
Once developed, Android applications can be packaged easily and sold out either
through a store such as Google Play, Slide ME, Opera Mobile Store, Mobango, F-
droid and the Amazon Appstore.Android powers hundreds of millions of mobile
devices in more than 190 countries around the world. It's the largest installed base
of any mobile platform and growing fast. Every day more than 1 million new
Android devices are activated worldwide.
2) Android IDE
1. Android Studio
Android Studio’s job is to provide the interface for you to create your apps
and to handle much of the complicated file-management behind the scenes. The
programming language you will be using is Java and this will be installed separately
on your machine. Android Studio is simply where you will write, edit and save your
projects and the files that comprise said projects. At the same time, Android Studio
will give you access to the Android SDK or ‘Software Development Kit’. Think of
this as an extension to the Java code that allows it to run smoothly on Android
devices and take advantage of the native hardware. Java is needed to write the
programs, the Android SDK is needed to make those programs run on Android and
Android Studio has the job of putting it all together for you. At the same time,
Android Studio also enables you to run your code, either through an emulator or
through a piece of hardware connected to your machine. You’ll then also be able to
‘debug’ the program as it runs and get feedback explaining crashes etc. so that you
can more quickly solve the problem.
3. Android Emulator
Android Emulator is used to run, debug and test the android application. If you don't
have the real device, it can be the best way to run, debug and test the application.
Genymotion
There are premium versions of this app that add features, but with a little elbow
grease one can manage on one’s own with the free version. It does not come with
ARM support, so you will need to install it manually, which makes it a little less
convenient to use
Features
Robust Environment.
Visually appealing.
XML
Android layouts are written in eXtensible Markup Language, also known as XML.
Much like HTML (or Hypertext Markup Language), XML is also a markup
language. It was created as a standard way to encode data in internet-based
applications. However, unlike HTML, XML is case-sensitive, requires each tag is
closed properly, and preserves whitespace.
Much like creating an HTML layout and later altering it with jQuery, as we've done
in previous courses, we can create XML layouts in Android, and later alter them
using Java logic. Android XML layouts are also part of a larger umbrella of Android
files and components called resources. Resources are the additional files and static
content an application needs, such as animations, color schemes, layouts, menu
layouts.
Layout Attributes
Every type of layout has attributes that define the way its elements appear.
There are both common attributes that all layouts share, and attributes specific to
some of the layout types listed above. The following are attributes that apply to all
layouts:
Android: layout_width: The width of the layout. (Required for every view)
Android: layout_height: The height of the layout. (Required for every view).
SQLite
SQLite is free to use for any purpose commercial or private. In other words, "SQLite
is an open source, zero-configuration, self-contained, stand alone, transaction
relational database engine designed to be embedded into an application".
SQLite is different from other SQL databases because unlike most other SQL
databases, SQLite does not have a separate server process. It reads and writes
directly to ordinary disk files. A complete SQL database with multiple tables,
indices, triggers, and views, is contained in a single disk file.
SQLite Features
SQLite Advantages
SQLite is a very popular database which has been successfully used with on
disk file format for desktop applications like version control systems, financial
analysis tools, media cataloging and editing suites, CAD packages, record keeping
programs etc.
1) Lightweight
2) Better Performance
o Reading and writing operations are very fast for SQLite database. It is almost
35% faster than File system.
o It only loads the data which is needed, rather than reading the entire file and
hold it in memory.
o If you edit small parts, it only overwrite the parts of the file which was
changed.
3) No Installation Needed
o SQLite is very easy to learn. You don’t need to install and configure it. Just
download SQLite libraries in your computer and it is ready for creating the
database.
4) Reliable
o SQLite is less bugs prone rather than custom written file I/O codes.
o SQLite queries are smaller than equivalent procedural codes so, chances of
bugs are minimal.
5) Portable
o SQLite is portable across all 32-bit and 64-bit operating systems and big- and
little-endian architectures.
o Multiple processes can be attached with same application file and can read
and write without interfering each other.
6) Accessible
o It reduces application cost because content can be accessed and updated using
concise SQL queries instead of lengthy and error-prone procedural queries.
o SQLite can be easily extended in in future releases just by adding new tables
and/or columns. It also preserves the backwards compatibility.
SYSTEM DESIGN
FILE DESIGN
The file system is used to control how data is stored and retrieved. Without a
file system, information placed in a storage area would be one large body of data
with no way to tell where one piece of information stops and the next begins. By
separating the data into individual pieces, and giving each piece a name, the
information is easily separated and identified. Taking its name from the way paper-
based information systems are named, each group of data is called a file. The
structure and logic rules used to manage the groups of information and their names
are called a "file system”. There are many different kinds of file systems. Each one
has different structure and logic, properties of speed, flexibility, security, size and
more. Some file systems have been designed to be used for specific applications
INPUT DESIGN
Outputs are the most important and direct source of information to the customer
and management. Intelligent output design will improve the system's relationship
with the user and help in decision making. Outputs are used to make permanent hard
copy of the results for later consultation. The output generated by the system is often
regarded as the criteria for evaluating the performance of the system. The output
design was based on the following factors.
➢ Usefulness determining the various outputs to be printed to the system
user.
➢ Differentiating between the outputs to be displayed and those to be printed.
➢ The format for the presentation of the output.
For the proposed system, it is necessary that the output should be compatible with
the existing manual reports. The outputs have been formatted with this consideration
in mind. The outputs are obtained after all the phase, from the system can be
displayed or can be produced in the hard copy. The hard copy is highly preferred
since it can be used by the controller section for future reference and it can be used
for maintaining the record.
DATABASE DESIGN
Objectives of Testing
Test Plan
Testing is the process of executing a program with the intent of finding any
errors. A good test of course has the high probability of finding a yet undiscovered
error. A successful testing is the one that uncovers a yet undiscovered error.
A test is vital to the success of the system; system test makes a logical
assumption that if all parts of the system are correct, then goal will be successfully
achieved. The candidate system is subjected to a verity of tests online like
responsiveness, its value, stress and security. A series of tests are performed before
the system is ready for user acceptance testing.
Testing Methods
• Unit Testing
• Integration Testing
• Validation Testing
• Output Testing
UNIT TESTING
Unit testing focuses verification efforts on the smallest unit of software
design, the module. This is also known as “Module Testing” The modules are tested
separately this testing is carried out during programming stage itself. In this step
each module is found to be working satisfaction as regard to the expected output
from the module.
INTEGRATION TESTING
VALIDATION TESTING
Thus the proposed system under consideration has been tested by using
validation testing and found to be working satisfactory.
OUTPUT TESTING
After performing the validation testing, the next step is the output testing of
the proposed system, since no system could be useful if it does not produce required
output in the specific format. Tested asking the users about the format required by
them, the output is considered into two ways: one is on the screen and the other is
printed format.
The output format on the screen is found to be correct as the format designed
according to the user needs, for the hard copy also, the output comes as specified by
the user. Hence output testing does not result in correction in the system.
SYSTEM IMPLEMENTATION
The more complex the system being implemented, the more involved will be
the systems analysis and design effort required just for implementation. The
implementation phase comprises of several activities. The required hardware and
software acquisition is carried out. The system may require some software to be
developed. The mobile application is implemented in android as front end sqlite as
back end.
System Development
After the successful completion of the design phase, the next important step,
which comes into account, is the development of the system according to the
specified design. The main procedure of this phase is the coding of the designed
system, in order to satisfy the requirements. The detailed input/output, text
manipulation, logic comparison and storage/retrieval operation during system
analysis stage provide the input for program preparation. Coding was carried out in
a step-by-step manner. One or more programmers convert these operations into a
program of instructions return a language and form acceptable to the computer
hardware. User inter activeness was given stress and the system use maximum
flexibility. Proper validations are done for every user-defined function
Conclusion
Implementation is the stage of the project when the theoretical design is turned
out into a working system. Thus it can be considered to be the most critical stage in
achieving a successful new system and in giving the user, confidence that the new
system will work and be effective. Proposed system successfully implements an
automatic medicine Remainder alert process. Its automatically gives Remainder
notification alert based on time interval. Any person who has android mobile phone
can use this application. This brings a smart appointment booking system that
provides patients or any user an easy way of booking a doctor’s appointment via
mobile phone. Doctor can view the requested appointment details through this
mobile application and doctor can able to give conformation/rejection which gives
a direct reply to user mobile phone when the appointment is made conform or reject.
This proposed mobile application providing a robust, user friendly solution for the
patient and doctor.
Every application has its own merits and demerits. The project has covered
almost all the requirements. Further requirements and improvements can easily be
done since the coding is mainly structured or modular in nature. Changing the
existing modules or adding new modules can append improvements. Further
enhancements can be made to the application with IOT interface, The patient can
store the respective time of the unique medicine by a matrix keypad. Based on an
RTC (Real Time Clock) interfaced to the microcontroller, the programmed time for
medicinal drug is displayed on the LCD in conjunction with a buzzer sound to alert
the patient approximately taking the best medicine.
BIBLIOGRAPHY
[1] Programming Android: Java Programming for the New Generation of
Mobile Devices.
[2] Elias. M. Award, 1991, ‘System Analysis and Design’ Galgotia Publication
Pvt. Ltd.
[5] The Busy Coder's Guide to Advanced Android Development by Mr. Mark L
Murph 20 Jul 2011
Sample code
import android.app.Activity;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.telephony.SmsManager;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Timer;
import java.util.TimerTask;
getWindow().addFlags(
WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
setContentView(R.layout.notification);
readPreferences();
start(getIntent());
}
@Override
protected void onDestroy()
{
super.onDestroy();
Log.i(TAG, "AlarmNotification.onDestroy()");
stop();
}
@Override
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
Log.i(TAG, "AlarmNotification.onNewIntent()");
addNotification(mAlarm);
stop();
start(intent);
}
mTextView.setText(mAlarm.getTitle());
SmsManager sms;
//play alarm
if(mAlarm.getTitle().equalsIgnoreCase("Aspirin"))
{
String outputFile =
Environment.getExternalStorageDirectory().getAbsolutePath() + "/androidplay.mp3";
try {
Thread.sleep(5000);
//Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Aspirin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//second
if(mAlarm.getTitle().equalsIgnoreCase("Biotin"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Biotin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.);
//third
if(mAlarm.getTitle().equalsIgnoreCase("Gas-x"))
{
try {
Thread.sleep(5000);
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Gas-x.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
}
}
//four
if(mAlarm.getTitle().equalsIgnoreCase("Insulin"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Insulin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//five
if(mAlarm.getTitle().equalsIgnoreCase("K-Tab"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/K-Tab.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//six
if(mAlarm.getTitle().equalsIgnoreCase("penicillin"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/penicillin.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//seven
if(mAlarm.getTitle().equalsIgnoreCase("Smallpox_Vaccine"))
{
try {
Thread.sleep(5000);
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Smallpox_Vaccine.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
}
}
//eight
if(mAlarm.getTitle().equalsIgnoreCase("Sodium_Chloride"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Sodium_Chloride.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//nine
if(mAlarm.getTitle().equalsIgnoreCase("Vitamin_B12"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Vitamin_B12.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//ten
if(mAlarm.getTitle().equalsIgnoreCase("Vitamin_c"))
{
try {
Thread.sleep(5000);
Toast.makeText(getApplicationContext(), "playing "+outputFile,
Toast.LENGTH_SHORT).show();
mediaPlayer.setDataSource("/storage/emulated/0/DCIM/voice/Vitamin_c.m4a");
mediaPlayer.prepare();
mediaPlayer.start();
} catch (Exception e) {
// myAudioManager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
// myAudioManager.setRingerMode(AudioManager.);
//mRingtone.play();
//for vibrate
// if (mVibrate)
//mVibrator.vibrate(mVibratePattern, 0);
}
mTimer.cancel();
mRingtone.stop();
if (mVibrate)
mVibrator.cancel();
}
mediaPlayer1.stop();
finish();
}
notificationManager.notify((int)alarm.getId(), notification);
}
@Override
public void onBackPressed()
{
finish();
}
Log.i(TAG, "AlarmNotification.PalyTimerTask.run()");
addNotification(mAlarm);
finish();
}
}
}
/**************************************************************************
*
* Copyright (C) 2012-2015 Alex Taradov<alex@taradov.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*************************************************************************/
package com.taradov.alarmme;
import java.lang.System;
import java.util.Arrays;
import java.util.GregorianCalendar;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MenuInflater;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.widget.Toast;
import android.widget.Button;
import android.widget.ListView;
import android.widget.AdapterView;
import android.content.Intent;
import android.content.Context;
import android.content.BroadcastReceiver;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import com.taradov.alarmme.Alarm;
import com.taradov.alarmme.AlarmReceiver;
import com.taradov.alarmme.AlarmListAdapter;
import com.taradov.alarmme.About;
import android.app.AlarmManager;
import android.app.PendingIntent;
private ListViewmAlarmList;
private AlarmListAdaptermAlarmListAdapter;
private Alarm mCurrentAlarm;
private final intNEW_ALARM_ACTIVITY = 0;
private final intEDIT_ALARM_ACTIVITY = 1;
private final intPREFERENCES_ACTIVITY = 2;
private final intABOUT_ACTIVITY = 3;
@Override
public void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setContentView(R.layout.main);
Log.i(TAG, "AlarmMe.onCreate()");
mAlarmList= (ListView)findViewById(R.id.alarm_list);
mCurrentAlarm= null;
}
@Override
public void onDestroy()
{
super.onDestroy();
Log.i(TAG, "AlarmMe.onDestroy()");
// mAlarmListAdapter.save();
}
@Override
public void onResume()
{
super.onResume();
Log.i(TAG, "AlarmMe.onResume()");
mAlarmListAdapter.updateAlarms();
}
AlarmMe.this.startActivityForResult(intent, NEW_ALARM_ACTIVITY);
}
@Override
protected void onActivityResult(intrequestCode, intresultCode, Intent data)
{
if (requestCode == NEW_ALARM_ACTIVITY)
{
if (resultCode == RESULT_OK)
{
mCurrentAlarm.fromIntent(data);
mAlarmListAdapter.add(mCurrentAlarm);
}
mCurrentAlarm= null;
}
else if (requestCode == EDIT_ALARM_ACTIVITY)
{
if (resultCode == RESULT_OK)
{
mCurrentAlarm.fromIntent(data);
mAlarmListAdapter.update(mCurrentAlarm);
}
mCurrentAlarm= null;
}
else if (requestCode == PREFERENCES_ACTIVITY)
{
mAlarmListAdapter.onSettingsUpdated();
}
}
@Override
public booleanonCreateOptionsMenu(Menu menu)
{
MenuInflatermenuInflater = getMenuInflater();
menuInflater.inflate(R.layout.menu, menu);
return true;
}
@Override
public booleanonOptionsItemSelected(MenuItem item)
{
if (R.id.menu_settings== item.getItemId())
{
Intent intent = new Intent(getBaseContext(), Preferences.class);
startActivityForResult(intent, PREFERENCES_ACTIVITY);
return true;
}
else if (R.id.menu_about== item.getItemId())
{
Intent intent = new Intent(getBaseContext(), About.class);
startActivity(intent);
return true;
}
else
{
return super.onOptionsItemSelected(item);
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfomenuInfo)
{
if (v.getId() == R.id.alarm_list)
{
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)menuInfo;
menu.setHeaderTitle(mAlarmListAdapter.getItem(info.position).getTitle());
menu.add(Menu.NONE, CONTEXT_MENU_EDIT, Menu.NONE, "Edit");
menu.add(Menu.NONE, CONTEXT_MENU_DELETE, Menu.NONE, "Delete");
menu.add(Menu.NONE, CONTEXT_MENU_DUPLICATE, Menu.NONE, "Duplicate");
}
}
@Override
public booleanonContextItemSelected(MenuItem item)
{
AdapterView.AdapterContextMenuInfo info =
(AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
intindex = item.getItemId();
if (index == CONTEXT_MENU_EDIT)
{
Intent intent = new Intent(getBaseContext(), EditAlarm.class);
mCurrentAlarm= mAlarmListAdapter.getItem(info.position);
mCurrentAlarm.toIntent(intent);
startActivityForResult(intent, EDIT_ALARM_ACTIVITY);
}
else if (index == CONTEXT_MENU_DELETE)
{
mAlarmListAdapter.delete(info.position);
}
else if (index == CONTEXT_MENU_DUPLICATE)
{
Alarm alarm = mAlarmListAdapter.getItem(info.position);
Alarm newAlarm = new Alarm(this);
Intent intent = new Intent();
alarm.toIntent(intent);
newAlarm.fromIntent(intent);
newAlarm.setTitle(alarm.getTitle() + " (copy)");
mAlarmListAdapter.add(newAlarm);
}
return true;
}
mCurrentAlarm= mAlarmListAdapter.getItem(position);
mCurrentAlarm.toIntent(intent);
AlarmMe.this.startActivityForResult(intent, EDIT_ALARM_ACTIVITY);
}
};
/**************************************************************************
*
* Copyright (C) 2012-2015 Alex Taradov<alex@taradov.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*************************************************************************/
package com.taradov.alarmme;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TimePicker;
import java.util.Calendar;
import java.util.GregorianCalendar;
private GregorianCalendarmCalendar;
private intmYear;
private intmMonth;
private intmDay;
private intmHour;
private intmMinute;
@Override
public void onCreate(Bundle bundle)
{
super.onCreate(bundle);
setContentView(R.layout.edit);
mTitle= (EditText)findViewById(R.id.title);
mAlarmEnabled= (CheckBox)findViewById(R.id.alarm_checkbox);
mOccurence= (Spinner)findViewById(R.id.occurence_spinner);
mDateButton= (Button)findViewById(R.id.date_button);
mTimeButton= (Button)findViewById(R.id.time_button);
mTitle.setText(mAlarm.getTitle());
mTitle.addTextChangedListener(mTitleChangedListener);
mOccurence.setSelection(mAlarm.getOccurence());
mOccurence.setOnItemSelectedListener(mOccurenceSelectedListener);
mAlarmEnabled.setChecked(mAlarm.getEnabled());
mAlarmEnabled.setOnCheckedChangeListener(mAlarmEnabledChangeListener);
updateButtons();
}
@Override
protected Dialog onCreateDialog(intid)
{
if (DATE_DIALOG_ID == id)
return new DatePickerDialog(this, mDateSetListener, mYear, mMonth, mDay);
else if (TIME_DIALOG_ID == id)
return new TimePickerDialog(this, mTimeSetListener, mHour, mMinute,
mDateTime.is24hClock());
else if (DAYS_DIALOG_ID == id)
return DaysPickerDialog();
else
return null;
}
@Override
protected void onPrepareDialog(intid, Dialog dialog)
{
if (DATE_DIALOG_ID == id)
((DatePickerDialog)dialog).updateDate(mYear, mMonth, mDay);
else if (TIME_DIALOG_ID == id)
((TimePickerDialog)dialog).updateTime(mHour, mMinute);
}
mAlarm.toIntent(intent);
setResult(RESULT_OK, intent);
finish();
}
updateButtons();
}
};
updateButtons();
}
};
Home page