My code is as follow:

 val executor = this.mainExecutor
        if (Build.VERSION.SDK_INT >= VERSION_CODES.S) {
            tm.registerTelephonyCallback(executor, MyTelephonyCallbackSignalStrengthListener())
        }
@RequiresApi(Build.VERSION_CODES.S)
class MyTelephonyCallbackSignalStrengthListener() : TelephonyCallback(),TelephonyCallback.SignalStrengthsListener {
    @SuppressLint("MissingPermission")
    override fun onSignalStrengthsChanged(p0: SignalStrength) {
         Log.d("test",p0.toString())
    }
}

I want to invoke onSignalStrengthsChanged method when network signal strengths changes, but it is invoked only in registration time and I can't update my signal information.

0

There are 0 best solutions below