Home > Mobile >  How Android get 5 GNR RSRP signal strength
How Android get 5 GNR RSRP signal strength

Time:05-20

Applications can get 4 g signal strength, but can't get 5 g signal strength, by modifying the https://github.com/microg/UnifiedNlp project implementation,
Signal monitoring method using way of phoneStateListener
 
TelephonyManager=((telephonyManager) activity. GetSystemService (Context. TELEPHONY_SERVICE));
TelephonyManager. Listen (phoneStateListener,
PhoneStateListener. LISTEN_CELL_INFO | PhoneStateListener. LISTEN_SIGNAL_STRENGTHS);

Capture onCellInfoChanged implementation
 
If (phoneStateListener==null) {
Handler mainHandler=new Handler (context. GetMainLooper ());
MainHandler. Post (() - & gt; {
PhoneStateListener=new phoneStateListener () {

@ Override
Public void onCellInfoChanged (List CellInfo) {
System. The out. Println (JSON. ToJSONString (cellInfo));
If (cellInfo!=null & amp; & ! CellInfo. IsEmpty ()) {
OnCellsChanged (cellInfo);
{} else if (supportsCellInfoChanged)
SupportsCellInfoChanged=false;
OnSignalStrengthsChanged (null);
}
}

@ Override
Public void onSignalStrengthsChanged (SignalStrength SignalStrength) {
if (! SupportsCellInfoChanged) {
DoScan ();
}
}
};
RegisterPhoneStateListener ();
});
} else {
RegisterPhoneStateListener ();
}

And for 5 GNR signal processing
 
Else if (Build) VERSION) SDK_INT & gt;=Build. VERSION_CODES. Q & amp; & The info instanceof CellInfoNr) {
CellIdentityNr identity=(CellIdentityNr) ((CellInfoNr) info.) getCellIdentity ();
Int Mcc=(identity. GetMccString ()!=null)? Integer. The valueOf (identity. GetMccString ()) : CellInfo. UNAVAILABLE;
Int newsun focus=(identity. GetMncString ()!=null)? Integer. The valueOf (identity. GetMncString ()) : CellInfo. UNAVAILABLE;
//if (Mcc==Integer. MAX_VALUE) return null;
CellSignalStrengthNr strength=(CellSignalStrengthNr) ((CellInfoNr) info.) getCellSignalStrength ();
The return of new Cell (Cell. CellType. NR, Mcc, newsun focus,
Identity. GetTac (), identity. GetNci (), identity, getPci (), strength, getDbm ());
}

To the collected signals, however, only 4 glte signal strength - 76 behind (colon), 5 GNR signal strength as an Integer. MAX, namely no assignment

Use 10 of millet, red rice k40pro and huawei p40 test results are like that, you think where is the problem?
  • Related