I am attempting to determine whether or not the screen is on using the following code:
private void isScreenOn() {
if (Build.VERSION.SDK_INT >= 20) {
if (mPowerManager.isInteractive()) {
//Do stuff
}
} else {
if (mPowerManager.isScreenOn()) {
//Do stuff
}
}
}
I've had reports from the field that this is being logged:
com.aws.android I/dalvikvm: Could not find method android.os.PowerManager.isInteractive, referenced from method ...
Can anyone help me understand how this could be occurring? The isScreenOn() method is supposed to be valid up to API 19 and isInteractive() is supposed to be valid for API 20 and up. Am I doing something wrong here?