Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Create Events with Sound

    Hi all,

    I'm building an app to create events in the device Calendar, but when I have created them all are set default without sound. I need to set the sound ON, when the user wants it.
    How can I set on the alarm in my created events?

    Thanks

  2. #2
    Registered User
    Join Date
    Aug 2011
    Posts
    39

    Re: Create Events with Sound

    I've started wondering the same, no documentation or example about the PIM API that I can find has anything about setting any kind of sound for alarms. Pretty strange. I hope someone can help us out.

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: Create Events with Sound

    Hi oniongrarlic and Javier,

    You cannot access the Alarm from your Java app, but you can use the PIM API to create a Calendar event and add it (or better say import it) to the native Calendar app. The native Calendar application on Series 40 and Asha software platform devices, comes with a Reminder option that specifies how long before the event the user should get a notification sound about the event. This field can get several values (e.g. none, at start time, 5 minutes before, 10 minutes before etc). You can therefore specify a calendar event for a certain date and time and define its reminder attribute to "at start time". The calendar app doesn't allow you to specify the sound used for the reminder but rather uses the reminder tone defined in the device's sound settings under Settings > Sounds and vibra > Reminder tone (on asha software platform devices). The reminder uses the device's volume level. You cannot override neither the selected tone nor the volume level. So if the device is muted, when the reminder is activated there will be no generated sound, but otherwise the reminder should be heard in the tone and volume level set in the device's settings.

    This is how you add an event with a reminder value set to "at start time" (tested on Nokia asha software platform and Nokia 501)
    Code:
                pim = PIM.getInstance();
                try {
                    EventList eventList = (EventList) pim.openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);
                    Event event = eventList.createEvent();
                    // get the current date
                    Date date = new Date();
                    // create a reminder starting 1 minute from now
                    event.addDate(Event.START, Event.ATTR_NONE, date.getTime() + 60000);
                    // and ending in 2 minutes from now
                    event.addDate(Event.END, Event.ATTR_NONE, date.getTime() + 120000);
                    /* 
                     * set the reminder value.  1   = at start time
                     *                          300 = 5 minutes before
                     *                          600 = 10 minutes before
                     *                          900 = 15 minutes before
                     */
                    event.addInt(Event.ALARM, 0, 1);
                    // import the event to calendar
                    Event imported = eventList.importEvent(event);
                    imported.commit();
                    eventList.close();
                } catch (PIMException ex) {
                    System.out.println(ex.getMessage());
                }
    I hope that answers your question.

    Cheers,
    Stratos
    Last edited by skalogir; 2013-12-05 at 14:05.

  4. #4
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: Create Events with Sound

    Thanks a lot! I'm going to try your suggest.

Similar Threads

  1. How to observe events of URL request (Want to create logs of visited URLs)
    By raviksoni in forum Symbian Networking & Messaging (Closed)
    Replies: 15
    Last Post: 2010-08-12, 13:28
  2. Create two sound player
    By eyalmnm in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2009-04-01, 03:57
  3. Sound and game events synchronization
    By yangliu21 in forum Symbian
    Replies: 1
    Last Post: 2007-08-10, 14:50
  4. Multiple sound events
    By balagopalks in forum Mobile Java General
    Replies: 0
    Last Post: 2005-02-21, 10:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×