当前位置: 首页>>代码示例>>Java>>正文


Java SubscriptionManager.getActiveSubscriptionInfoCount方法代码示例

本文整理汇总了Java中android.telephony.SubscriptionManager.getActiveSubscriptionInfoCount方法的典型用法代码示例。如果您正苦于以下问题:Java SubscriptionManager.getActiveSubscriptionInfoCount方法的具体用法?Java SubscriptionManager.getActiveSubscriptionInfoCount怎么用?Java SubscriptionManager.getActiveSubscriptionInfoCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.telephony.SubscriptionManager的用法示例。


在下文中一共展示了SubscriptionManager.getActiveSubscriptionInfoCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onHandleIntent

import android.telephony.SubscriptionManager; //导入方法依赖的package包/类
@Override
protected void onHandleIntent(Intent intent) {
    log.d("onHandleIntent");
    //SubscriptionManager  该类主要包含了所有sim卡的信息
    SubscriptionManager mSubscriptionManager = SubscriptionManager.from(this);
    int simcnt = mSubscriptionManager.getActiveSubscriptionInfoCount();
    List<SubscriptionInfo> lstSim = mSubscriptionManager.getActiveSubscriptionInfoList();
    for (int i = 0; i < lstSim.size(); i++) {
        SubscriptionInfo si = lstSim.get(i);
        if (si != null)
            log.d(si.toString());
    }
    TelecomManager telecomManager = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
        List<PhoneAccountHandle> lstPA=telecomManager.getCallCapablePhoneAccounts();
        int accoutSum =lstPA.size();
        for(int i=0;i<accoutSum;i++)
            log.d("accountSum: " + accoutSum +lstPA.get(i) );
    }

}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:22,代码来源:SimService.java

示例2: isDualSim

import android.telephony.SubscriptionManager; //导入方法依赖的package包/类
public static boolean isDualSim(final Context context)
{
    try
    {
        final SubscriptionManager sm = SubscriptionManager.from(context);
        final int activeSubscriptionInfoCount = sm.getActiveSubscriptionInfoCount();
        //System.out.println("active subscription count: " + activeSubscriptionInfoCount);
        return activeSubscriptionInfoCount > 1;
    }
    catch (Throwable t)
    {
        //t.printStackTrace();
        return false;
    }
}
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:16,代码来源:DualSimNewApiWrapper.java

示例3: build

import android.telephony.SubscriptionManager; //导入方法依赖的package包/类
@Override
public RadioGroup build() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP_MR1) {
        return getView();
    }
    SubscriptionManager subscriptionManager = (SubscriptionManager) activity.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
    if (null == subscriptionManager) {
        return getView();
    }
    if (subscriptionManager.getActiveSubscriptionInfoCount() < 2) {
        sms.setSubscriptionId(subscriptionManager.getActiveSubscriptionInfoList().get(0).getSubscriptionId());
        return getView();
    }
    getView().setVisibility(View.VISIBLE);
    List<Pair<Integer, String>> simCards = new ArrayList<>();
    for (SubscriptionInfo info: subscriptionManager.getActiveSubscriptionInfoList()) {
        simCards.add(new Pair<>(info.getSubscriptionId(), info.getCarrierName().toString()));
    }
    RadioButton radio1 = getView().findViewById(R.id.radio_sim1);
    RadioButton radio2 = getView().findViewById(R.id.radio_sim2);
    prepareRadioButton(radio1, simCards.get(0));
    prepareRadioButton(radio2, simCards.get(1));
    if (!radio1.isChecked() && !radio2.isChecked()) {
        radio1.setChecked(true);
    }
    return getView();
}
 
开发者ID:yeriomin,项目名称:SmsScheduler,代码行数:28,代码来源:BuilderSimCard.java


注:本文中的android.telephony.SubscriptionManager.getActiveSubscriptionInfoCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。