如何获取PHP短视频源码中的SMSC

想要通过简单方式获取PHP短视频源码中的SMSC,可以使用一下方法

public static String getSmsCenterNumber(Context context,int slotIndex){
    Log.d("shaowen"," getSmsCenterNumber slotIndex is "+slotIndex);
    String smscStr  = "";
    TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
    int subId = -1;
    int phoneCount = telephonyManager.getPhoneCount();

    //根据卡槽获取对应的SMSC
    if(slotIndex >= 0 && slotIndex < phoneCount) {
        SubscriptionInfo subscriptionInfo = SubscriptionManager.from(context).getActiveSubscriptionInfoForSimSlotIndex(slotIndex);
        if(subscriptionInfo != null)
            subId = subscriptionInfo.getSubscriptionId();
    }

    try {
        smscStr = SmsManagerEx.getDefault().getSmscForSubscriber(subId);  //导入包:import android.telephony.SmsManagerEx;
        Log.d("shaowen","smscStr is "+smscStr);
    } catch (Exception ex) {
        LogUtils.d(TAG,"setSmsCenterNumber----RemoteException");
    }
    return smscStr;
}
发布了150 篇原创文章 · 获赞 65 · 访问量 17万+

猜你喜欢

转载自blog.csdn.net/yb1314111/article/details/105137167
今日推荐