Git Product home page Git Product logo

androidromchecker's Introduction

Android Rom 识别库

JCenter Licence MinSDK

效果图

小米 MIX 3 Android 9.0

使用说明

//添加依赖
implementation 'com.walkud.rom.checker:RomChecker:1.0.0'

//读取当前手机ROM
Rom rom = RomIdentifier.getRom();
//打印Rom信息
Log.d("AndroidRomChecker", "Rom:" + rom.toString());

Rom适配

已适配Rom在cc包下都会存在对应的Checker识别器。

public enum Rom {
	//目前已适配
    MIUI("xiaomi"), // 小米
    Flyme("meizu"), // 魅族
    EMUI("huawei"), // 华为
    ColorOS("oppo"), // OPPO
    FuntouchOS("vivo"), // vivo
    SmartisanOS("smartisan"), // 锤子
    AmigoOS("amigo"), // 金立
    EUI("letv"), // 乐视
    Sense("sense"), // HTC
    Google("google"), // 原生
    NubiaUI("nubia"), // 努比亚

    //未适配
    _360OS(""), // 奇酷360
    H2OS(""), // 一加
    YunOS(""), // 阿里巴巴
    YuLong("yulong"), // 酷派
    SamSung("samsung"), // 三星
    Sony("sony"), // 索尼
    Lenovo("lenovo"), // 联想
    LG("lg"), // LG
    ZTE("zte"),//中兴
    Other(""); // 其它
    ……
}

未适配Rom可自行参照已实现的Cheker进行适配
//获取默认识别器
List<Checker> checkers = RomIdentifier.getRom.getChecker();
//checkers.add();//添加自定义识别器
//读取当前手机ROM
Rom rom = RomIdentifier.getRom(checkers);

PS:后续会持续添加未适配Rom的识别器。

原理

执行getprop命令,获取到系统配置文件属性,根据判断不同属性值是否存在,来达到判断Rom的类型;再根据对应Rom的属性值来获取版本信息。

参考

SenhLinsh/Android-ROM-Identifier

License

Copyright [2018] [Walkud]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

androidromchecker's People

Contributors

5468381 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.