1. Java layer call
1. Method encapsulation
private static final int SIGNALSTRENGTH_WEAK = 0;
private static final int SIGNALSTRENGTH_STRONG = 1;
private static final int TYPE_FM = 0;
private static final int TYPE_AM = 1;
public int[] getRadioCurChannelInfo() {
if (mRadioTuner == null) {
mRadioTuner = openSession(mRadioCallback);
}
RadioManager.ProgramInfo[] info = new RadioManager.ProgramInfo[1];
if (mRadioTuner.getProgramInformation(info) == RadioManager.STATUS_OK) {
int freq = info[0].getChannel();
// 获取信号强度
int signalStrength = SIGNALSTRENGTH_STRONG;
if (info[0].getSignalStrength() == SIGNALSTRENTTH_WEAK_HAL) {
signalStrength = SIGNALSTRENGTH_WEAK;
} else if (info[0].getSignalStrength() == SIGNALSTRENGTH_STRONG_HAL) {
signalStrength = SIGNALSTRENGTH_STRONG;
} else {
Log.e(TAG,