安卓MTK手机获取SIM卡相关信息

本文介绍了一种在安卓MTK系统环境下无需特殊权限即可读取SIM卡信息的方法。通过特定provider可以直接获取包括ICCID、显示名称等在内的多项SIM卡数据。此方法适用于双卡双待设备。

本文方法在以下环境中测试过并证实可行:

软件:安卓MTK系统, 版本4.4.2

硬件:双卡双待

方法:在mtk系统某个provider中存有sim卡相关信息,可以通过provider直接获取,无需权限。内容如下:

/** @internal */
    public static final Uri CONTENT_URI = 
            Uri.parse("content://telephony/siminfo");


    /** @internal */
    public static final String DEFAULT_SORT_ORDER = "name ASC";
    
    /**
     * <P>Type: TEXT</P>
     */
    public static final String ICC_ID = "icc_id";
    /**
     * <P>Type: TEXT</P>
     * @internal
     */
    public static final String DISPLAY_NAME = "display_name";
    /** @internal */
    public static final int DEFAULT_NAME_MIN_INDEX = 01;
    /** @internal */
    public static final int DEFAULT_NAME_MAX_INDEX= 99;
    /** @internal */
    public static final int DEFAULT_NAME_RES = com.mediatek.internal.R.string.new_sim;


    /**
     * <P>Type: INT</P>
     */
    public static final String NAME_SOURCE = "name_source";
    /** @internal */
    public static final int DEFAULT_SOURCE = 0;


    public static final int SIM_SOURCE = 1;
    /** @internal */
    public static final int USER_INPUT = 2;


    /**
     * <P>Type: TEXT</P>
     */
    public static final String NUMBER = "number";
    
    /**
     * 0:none, 1:the first four digits, 2:the last four digits.
     * <P>Type: INTEGER</P>
     * @internal
     */
    public static final String DISPLAY_NUMBER_FORMAT = "display_number_format";
    /** @internal */
    public static final int DISPALY_NUMBER_NONE = 0;
    /** @internal */
    public static final int DISPLAY_NUMBER_FIRST = 1;


    public static final int DISPLAY_NUMBER_LAST = 2;
    /** @internal */
    public static final int DISLPAY_NUMBER_DEFAULT = DISPLAY_NUMBER_FIRST;
    
    /**
     * Eight kinds of colors. 0-3 will represent the eight colors.
     * Default value: any color that is not in-use.
     * <P>Type: INTEGER</P>
     * @internal
     */
    public static final String COLOR = "color";
    /** @internal */
    public static final int COLOR_1 = 0;
    /** @internal */
    public static final int COLOR_2 = 1;
    /** @internal */
    public static final int COLOR_3 = 2;
    /** @internal */
    public static final int COLOR_4 = 3;
    /** @internal */
    public static final int COLOR_DEFAULT = COLOR_1;
    
    /**
     * 0: Don't allow data when roaming, 1:Allow data when roaming
     * <P>Type: INTEGER</P>
     * @internal
     */
    public static final String DATA_ROAMING = "data_roaming";
    /** @internal */
    public static final int DATA_ROAMING_ENABLE = 1;
    /** @internal */
    public static final int DATA_ROAMING_DISABLE = 0;
    /** @internal */
    public static final int DATA_ROAMING_DEFAULT = DATA_ROAMING_DISABLE;
    
    /**
     * <P>Type: INTEGER</P>
     */
    public static final String SLOT = "slot";
    /** @internal */
    public static final int SLOT_NONE = -1;
    
    public static final int ERROR_GENERAL = -1;
    public static final int ERROR_NAME_EXIST = -2;


    /**
     * <P>Type: TEXT</P>
     */
    public static final String OPERATOR = "operator";
    /// add by mtk80601 for CT Dual SIM Indicator Feature start
    /** @internal */
    static final int typeBackground = 0;
    /** @internal */
    static final int typeBackgroundDark = 1;
    /** @internal */
    static final int typeBackgroundLight = 2;
    /** @internal */
    static final int typeBackgroundDarkSmall = 3;
    /** @internal */
    static final int typeBackgroundLightSmall = 4;


评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

番茄大圣

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值