posted 4 years ago
I am working on two Android studio project.
In both the projects I have called the function **get_LTE_Rsrp()**:
In the first project it is called in the following manner**
onCreate{
// some code
telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
final PhoneStateListener mListener = new PhoneStateListener() {
@Override
public void onSignalStrengthsChanged(SignalStrength sStrength) {
signalStrength = sStrength;
mRSRP = get_LTE_Rsrp();
//display mRSRP in a textview
}
Now, in the second project i have created a class named CellularSignalInfo and made get_LTE_Rsrp() as one of its methods.
onCreate{
// some code
telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
final PhoneStateListener mListener = new PhoneStateListener() {
@Override
public void onSignalStrengthsChanged(SignalStrength sStrength) {
signalStrength = sStrength;
mRSRP = cellularSignalInfo.get_LTE_Rsrp();
//display mRSRP in a textview
}
Now,
nt LteRsrpStrength = (Integer) mthd.invoke(signalStrength, new Object[]{});
return LteRsrpStrength;**
this particular line of code works in the first project(and a corresponding value say -111 dBm is returned)
but in the second case only the default value is returned. I have tried adding logs inside the for, if, catch, which shows the code do get executed upto that point, but the particular line of code is not executed.
What could be the reason behind this problem ?