(Difference between revisions)

Using the PIM API to create Medication Reminders

From Nokia Developer Wiki
Jump to: navigation, search
igordsm (Talk | contribs)
(Igordsm - - User interface)
igordsm (Talk | contribs)
(Igordsm - - Adding events using the PIM API)
Line 78: Line 78:
=== Adding events using the PIM API ===
=== Adding events using the PIM API ===
The Nokia Asha platform implements the PIM API (JSR-75), which gives us access to the user's Calendar.
== Conclusions ==
== Conclusions ==

Revision as of 04:52, 14 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
Created: (28 Nov 2013)
Last edited: igordsm (14 Nov 2013)

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



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.

Screenshot of the interface.

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.addCommand(new Command("Add", Command.OK, 1));

Adding events using the PIM API

The Nokia Asha platform implements the PIM API (JSR-75), which gives us access to the user's Calendar.


248 page views in the last 30 days.