0

I have a task to check if the android device supports 4K or not before playing a specific video. I’ve tried to check some options but could’t find a neat solution for this task. One of them is to use MediaCodec for getting videoCapabilities but It doesn’t give me what i'm looking for. I also tried a solution that i saw: Detecting 4K UHD screens on Android Is there a way to detect if a device is capable of outputting at 4K UHD in advance ?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Tal Levi
  • 9
  • 2

1 Answers1

0

You can just check the pixels on the screen and do the action accordingly. We know that 4K UHD screen has 3840 x 2160 pixels. So in your code:

Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
int width = size.x;
int height = size.y;

if(width >= 2160 && height >= 3840)
   //means support UHD. do the job.
  • 1
    You forgot to mention you took your answer from here:https://stackoverflow.com/questions/1016896/get-screen-dimensions-in-pixels – RonTLV Mar 25 '18 at 15:09
  • Sorry about that. I'm new to stackoverflow so, next time I'll make sure to refer to the topic. :) – A. Gokdemir Mar 25 '18 at 15:12