×
Namespaces

Variants
Actions
(Difference between revisions)

Using the PIM API to create Medication Reminders

From Nokia Developer Wiki
Jump to: navigation, search
igordsm (Talk | contribs)
(Igordsm -)
igordsm (Talk | contribs)
(Igordsm -)
Line 44: Line 44:
 
In this example we use a simple LCDUI. Our interface will contain fields for the medication name, the frequency it should be taken and the dates to start and stop taking the medicine.  
 
In this example we use a simple LCDUI. Our interface will contain fields for the medication name, the frequency it should be taken and the dates to start and stop taking the medicine.  
  
SCREENSHOT
+
[[File:ss1-med-reminder.png]]
  
 
Add the following variables to our Midlet.
 
Add the following variables to our Midlet.

Revision as of 14:42, 13 November 2013

This article explains how to ... Replace the abstract text with a short paragraph (or sentence) describing what the topic covers.

Enter article metadata as described below. Note that this template can be placed anywhere in the article. Do not remove parameters that you do not use

Article Metadata
CompatibilityArticle
Created: (28 Nov 2013)
Last edited: igordsm (13 Nov 2013)

Note.pngNote: This is an entry in the Nokia Asha Wiki Competition 2013H2.

Contents

Introduction

Mobile and smart phones can be used to improve their owners health. A common problem nowadays is that people often forget to take their medications at the correct time. This reduces the medicine's effect and, sometimes, puts in risk the whole treatment. In this article we describe how to create a Medication Reminder for the new Asha mobile phones.

Medication reminders using Calendar Events

In this example we need to alert our used of the correct time to take their medicine. Calendar events are suited for this task because

  1. they do not depend on an internet connection (as the Notifications API);
  2. push registry notifications disappear completely after they are dismissed (or if the time has passed and the phone is turned off);
  3. they remain on the device and appear on the calendar;
  4. calendar events appear in the fastlane.

Create a new Midlet project in Nokia IDE and open Main.java.

User interface

In this example we use a simple LCDUI. Our interface will contain fields for the medication name, the frequency it should be taken and the dates to start and stop taking the medicine.

Ss1-med-reminder.png

Add the following variables to our Midlet.

Form f;
TextField name;
DateField start;
DateField end;
TextField every;

We build the form in the startApp method and show it to the user.

protected void startApp() throws MIDletStateChangeException {
f = new Form("Medication Reminder");
name = new TextField("Medication name", "", 20, TextField.ANY);
start = new DateField("Start time", DateField.DATE_TIME);
end = new DateField("End time", DateField.DATE);
frequency = new TextField("Frequency (in hours)", "8", 2, TextField.NUMERIC);
 
f.append(name);
f.append(start);
f.append(end);
f.append(frequency);
f.addCommand(new Command("Add", Command.OK, 1));
f.setCommandListener(this);
Display.getDisplay(this).setCurrent(f);
}

Adding events using the PIM API

FASTLANE SCREENSHOT

Conclusions

247 page views in the last 30 days.