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 kHzRadio.FM
: 87.5 - 108 MHz, Japan 76 - 90 MHzRadio.SW
: 1.711 to 30 MHzRadio.LW
: 148.5 to 283.5 kHzRadio.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
Radio.ResourceMissing
The first thing the user will do with a radio is scan for stations, which can be accomplished by using the searchAllStations
method, which takes one...