is MIUI - Android android.system

Android examples for android.system:Os Version

Description

is MIUI

Demo Code

import android.os.Build;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class Main{

    private static final String PROP_NAME_MIUI_VERSION_CODE = "ro.miui.ui.version.code";
    private static final String BUILD_PROP_FILE = "/system/build.prop";
    public static boolean isMIUI() {
        BufferedReader bufferedReader = null;
        try {//w  w  w . ja  v  a 2  s.c o m
            bufferedReader = new BufferedReader(new FileReader(new File(
                    BUILD_PROP_FILE)));
            String readLine;
            do {
                readLine = bufferedReader.readLine();
                if (readLine == null) {
                    return false;
                }
            } while (!readLine.startsWith(PROP_NAME_MIUI_VERSION_CODE));
            return true;
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {

            if (bufferedReader != null) {
                try {
                    bufferedReader.close();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
        }
        return false;
    }

}

Related Tutorials