Read Modem Firmware Version : Android

早过忘川 提交于 2019-12-23 03:42:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!