简体   繁体   中英

Xamarin C# How get from android CellSignalStrengthLte.Rsrp

How to get CellSignalStrengthLte.Rsrp value from Android? Please give me some examples

I tried with TelephonyManager but I only have SignalStrength available, I don't see SignalStrengthLTE available.

https://docs.microsoft.com/en-us/dotnet/api/android.telephony.cellsignalstrengthlte.rsrp?view=xamarin-android-sdk-9#Android_Telephony_CellSignalStrengthLte_Rsrp

TelephonyManager mTel;
mTel = (TelephonyManager)GetSystemService(TelephonyService);
return mTel.GetImei(0).ToString()+" " + mTel.SignalStrength.Level.ToString();

You could get the SignalStrengthLTE like below.

TelephonyManager mTel;
mTel = (TelephonyManager)GetSystemService(TelephonyService);

CellInfoLte cellInfoLte = (CellInfoLte)mTel.AllCellInfo[0];
        CellSignalStrengthLte cellSignalStrengthLte = cellInfoLte.CellSignalStrength;
    TelephonyManager tm = (TelephonyManager)this.GetSystemService(Context.TelephonyService);
var cellInfoList = tm.AllCellInfo;
foreach (var item in cellInfoList)
{
    if (item.GetType() == typeof(CellInfoLte))
    {
        var value = ((CellInfoLte)item).CellSignalStrength.Rsrp;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM