问题
I am working on an application which is in iPhone and Android, where I need to read Modem Firmware Version
as iPhone developer does in his side.
I searched on Internet/SO but couldn't find anything related to my problem.
Is it possible to read Modem Firmware Version
in Android? If not what should be equivalent to that? (We read this attribute and more for keeping track of a device)
回答1:
As nandeesh said to use baseband version at the place of Modem firmware, he didn't provided any source code of his custom method.
I did some RnD and got final solution as
private static final String BASEBAND_VERSION = "gsm.version.baseband";
/**
* Returns a SystemProperty
*
* @param propName The Property to retrieve
* @return The Property, or NULL if not found
*/
public static String getSystemProperty(String propName) {
String TAG = "TEst";
String line;
BufferedReader input = null;
try {
Process p = Runtime.getRuntime().exec("getprop " + propName);
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
line = input.readLine();
input.close();
}
catch (IOException ex) {
Log.e(TAG, "Unable to read sysprop " + propName, ex);
return null;
}
finally {
if (input != null) {
try {
input.close();
}
catch (IOException e) {
Log.e(TAG, "Exception while closing InputStream", e);
}
}
}
return line;
}
and call it as
String basebandVersion = getSystemProperty(BASEBAND_VERSION);
All credits goes to cyanogen-updater , custom method taken from this same project SysUtils
回答2:
The about phone on android shows the baseband version by getting the property gsm.version.baseband . You can use SystemProperties.get("gsm.version.baseband","unknown");
来源:https://stackoverflow.com/questions/11796562/read-modem-firmware-version-android