-1

Sorry if this is a blatantly obvious issue with a resolution. I can't seem to figure out how to fix it.

I'm importing.

import android.provider.Settings;

And attempting to run the code snippet below in Activities, Application, Broadcast Receivers, etc. It works fine in the paid version of my app. When I copy the code out into the free version and paste it in(same machine, same sdk) the compiler goes red.

boolean canDrawOverlays;

if(Build.VERSION.SDK_INT >= 23)
{
    canDrawOverlays = Settings.canDrawOverlays(getApplicationContext());
}
Captain Kirk
  • 350
  • 6
  • 24

1 Answers1

1

Solved. Blatantly obvious. Hopefully this will save someone the time and trouble in the future of this easily overlooked project setting.

  • Right click project.
  • Goto Module Settings.
  • Goto Compile SDK Version.
  • Set API Level as appropriate. In my case I was at level 19 and needed 23 to get canDrawOverlays coming through.
  • Alternatively open your project's build.gradle and set compileSdkVersion there.
Captain Kirk
  • 350
  • 6
  • 24