This native Android library is built from two components. The first one is an API that supports the driver of the Silicon Lab Si4709 fm receiver . The API is used to control the receiver and to start/stop the playback of audio. Unfortunately, this chip set does not seem to be very common on Android devices. To our current knowledge, only the Samsung Galaxy S has this chipset.
The second component is the API that provides FM-RDS decoding functionality. At the moment, the library can decode the PI code, the PS name and the Radio Text fields. The RDS data is available as soon as the FM radio receiver is launched. To support devices that don't have an embedded FM receiver, the API features a "testing mode" which decodes raw RDS data received through Wifi. The corresponding RDS fields will be displayed as soon as they become available.
The API documentation of the library is available here for reference.
The library can be used to create new applications that make use of the FM-RDS features or to add this capability to an existing application. Here are some potential uses:
- Add over-the-air FM support to internet radio apps, so local stations can be accessed directly by FM to lower bandwidth requirements and battery usage (when compared to 3G network).
- FM search that automatically scans the available channels and Radio Text to find a song or some other user defined information.
- Advanced radio recorder; the Radio Text feed can be used to separate and index the content for easier listening. Note that recording capability may not be available due to the way the audio is connected inside the device (i.e. It is never available in digital form).
How to Integrate the CRC FM-RDS Android Library Into your Application ?
The CRC FM-RDS Library for Android is an archive with the following content: - libfmrds.so, a dynamic library to access the radio chip and to decode RDS - libfmrds.jar, a Java archive containing the ca.gc.crc.libfmrds package, that you can import into your Androdi project to start implementing FM-RDS functionalities - /doc folder, a javadoc to document all the functionnality that this library provides - Readme.txt, a file containing the following procedure - Licence.txt, the licence attached to this library - /demoApp, a sample FM-RDS Android project for Eclipse, that uses our FM-RDS Android Library (see video below)
Procedure to Integrate this Library in your Android Project
1) Create a new android project.
2) Download and decompress the "CRC FM-RDS Android Library.zip" archive into your project's root ($PROJ_ROOT).
3) Copy and paste the libfmrds.so file in the following location: $PROJ_ROOT/libs/armeabi/<here> Only then it will be included in the APK of your application, which is installed on your device in order to run the application. If the .so file is stored elsewhere in your project structure, it will not be included in the APK package, resulting in linker errors when running the application. When cleaning your project, make sure that the .so file remains in /libs/armeabi (in some configurations it was getting deleted/cleaned for no apparent reason).
4) In Eclipse, go in your project properties (Project-> Properties->Java Build Path->Libraries) and click "Add JARs...". Select the JAR file in the folder $PROJ_ROOT/CRC FM-RDS Android Library that you just decompressed.
5) Expand the JAR item in the menu (click on the "plus" sign) and set the javadoc location to the /doc folder in $PROJ_ROOT/CRC FM-RDS Android Library.
6) In the AndroidManifest.xml file of your application, add this permission in the the "manifest" tag: <manifest> ... <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"></uses-permission> ... </manifest>
7) In your own Android application's code, you can now import ca.gc.crc.libfmrds.FMinterface and instantiate one FMinterface object. All the functionalities are accessible via the FMinterface object. You are now ready to use our FM-RDS radio library!
Video: Step by Step, Building a Basic FM-RDS Android Application!
Within minutes, we will create a new Android project in Eclipse and integrate the CRC FM-RDS Android Library in it. Then, using the code snippet below, we will control the FM-RDS receiver of the phone (Samsung Galaxy S) to retreive and display RDS data and, of course, to play the radio.
The resulting demo Android project is included in the CRC FM-RDS Android Library package (in /demoApp), so you can also download it, compile it and try it right away. Note that in order to buid the application, you must have installed the Android SDK .