Some Android phones have an FM radio receiver. Mine does! It requires the wired headphones to be inserted to work as the antenna.
We start by implementing a Radio component:
Radio {
id: radio
The Radio element has a band property that you can use to configure the radio's frequency band use. They are one of the following:
- Radio.AM : 520 - 1610 kHz
- Radio.FM : 87.5 - 108 MHz, Japan 76 - 90 MHz
- Radio.SW : 1.711 to 30 MHz
- Radio.LW : 148.5 to 283.5 kHz
- Radio.FM2 : Range not defined
band: Radio.FM
Component.onCompleted {
if (radio.availability == Radio.Available)
console.log("Good to go!")
else
console.log("Sad face. No radio found. :(")
}
}
The availability property can return the following different values:
- Radio.Available
- Radio.Busy
- Radio.Unavailable...