Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Embedded Systems

Radios, Cell Phones, & Java


Enhancing Listener Interaction

To increase listener interaction with radio stations, a quick-launch interaction shortcut can be included in radio applications. For instance, instead of having to remember a radio station's call-in number, exiting the radio application, then keying in the number to call the radio station, you can configure a phone button for automatic dialing of call-in numbers at the radio station listeners are tuned to:

if (c == CMD_CALLSTATION) 
{
   ...
if (tunerControl.getFrequency()==
   911000) platformRequest("tel:5559110"); 
   ...
}

Similarly, a shortcut for sending SMS "votes" or song requests can be incorporated using the Wireless Messaging API (WMA). This saves users from having to remember SMS codes and formats to key in, as well as SMS numbers to send messages to. In this instance, the radio application has an internal record of that information as well as the radio station's SMS message templates:


if (c == CMD_MESSAGESTATION) 
{
   ...
   if (tunerControl.getFrequency()==9
   11000)
   {
      ...
      textMessage.setPayloadText

         ("vote " + choice);
      ...
   }
   ...
}

Tuner and Station Presets

The preset stations of the mobile phone's native radio tuner application can be set using TunerControl's setPreset() method. The required attributes are the preset number, radio frequency in units of 100 Hertz, AM/FM modulation, and stereo mode for the station. For instance, to preset channel 1 for an FM stereo radio station whose frequency is 91.1 MHz (where 911,000 = 91.1 MHz × 10,000):


tunerControl.setPreset(1, 911000, 
  TunerControl.MODULATION_FM, 
    TunerControl.STEREO);


On a new mobile phone just out of the box, you can assume that none of the radio presets are configured. However, if a phone has been in use, users may have manually configured one or more of the presets. Consequently, it is a good idea to ask/confirm with users before overwriting the presets.

To tune to radio stations in the preset list, simply call TunerControl's usePreset() method with the channel number of the preset:


tunerControl.usePreset(1);


However, if some presets are not set, users may end up hearing static when they tune in to a frequency with no broadcast. To mute those channels, use TunerControl's setSquelch() method with the Boolean parameter true:


tunerControl.setSquelch(true);


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.