-1

I got the below error log and not sure how this could be fixed

Caused by: java.lang.NoSuchMethodError: android.os.PowerManager.isInteractive
    at com.example.myapp.app.ActivityLifecycleCallbackListener.onActivityPaused(ActivityLifecycleCallbackListener.java:131)
    at android.app.Application.dispatchActivityPaused(Application.java:217)
    at android.app.Activity.onPause(Activity.java:1295)
    at android.support.v4.app.FragmentActivity.onPause(FragmentActivity.java:384)
Sweety Bertilla
  • 972
  • 10
  • 35

1 Answers1

1

isInteractive id added in API level 20 as stated by developer.android.com.

You need to check the API level before call the method:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH) {
    //isInteractive() call
}
Mattia Maestrini
  • 32,270
  • 15
  • 87
  • 94
  • I don't call this method at all in my code.. I suppose it been called by default in some scenario when the Activity goes to pause state. – Sweety Bertilla Oct 28 '15 at 15:54
  • The app with a package name `com.comcast` has a class named `ActivityLifecycleCallbackListener` that call `isInteractive` inside the method `onActivityPaused`. – Mattia Maestrini Oct 28 '15 at 16:29
  • yes you were right, this was a temporary code and I forgot about it. You answers seems to be right for users for face this issue. So I am going to accept the and – Sweety Bertilla Oct 28 '15 at 16:35