registerReceiver is defined on Context and its descendants. SystemSensorManager receives context in constructor, but does not remember it. You should find a relevant Context
for your change.
BroadcastReceiver - cannot find registerReceiver inside SystemSensorManager
-
15-10-2022 - |
Question
I want to use BroadcastReceiver inside SystemSensorManager class (android.hardware). I managed to define an object of type BroadcastReceiver but when I tried to register this receiver using :
registerReceiver(BroadcastReceiver receiver, IntentFilter filter)
This method cannot be found and the source code doesnt compile.
I tried the to do similar thing in the Activity class and it succeeded. whats wrong with the SystemSensorManager class ?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow