Android Question How to get Refresh Rate (60/120Hz, etc) of phone screen ?

emexes

Expert
Licensed User
On a less-painful note:

there's probably a system call somewhere, accessible via some JavaObject call magic, but that is still a bit beyond me. If it's just something you want to know about your own phone, then my first idea would be to move a panel about on screen, one tick (millisecond) per step, and adjust the number of steps in the repetitive path until the strobing effect (beating? as in two similar frequencies alternating between being in and out of phase) made the panel appear stationary.

Eg if you move the panel in a circle, 16 steps, ie 360 / 16 degrees per step, one step per millisecond, then it will take the panel 16 ms to do one lap of the circle. So the panel would be doing about 60 laps a second, and if the screen refresh rate was 60 Hz then the panel would always be at the same spot on the circle when the flinger refreshes the display, and look like it's not moving.

We use a similar technique at work to calibrate speed on our equipment, using a mains-frequency (50 Hz) strobe to check that the part is indeed rotating exactly 50 times per second ie 3000 rpm.
 
Last edited:
Upvote 0

agraham

Expert
Licensed User
Longtime User
B4X:
    Dim jo As JavaObject
    jo.InitializeContext
    Dim windowmanager As JavaObject = jo.RunMethod("getSystemService", Array("window"))
    Dim display As JavaObject = windowmanager.RunMethod("getDefaultDisplay", Null)   
    Dim refreshrate As Float = display.RunMethod("getRefreshRate", Null)
    Log(refreshrate)
 
Upvote 2

TelKel81

Active Member
Licensed User
<joke> all these years I thought it was M for Martin, only to discover now that it might be M for masochist </joke>
you made me realize I can use quotes to narrow my searches on the forums :)
refresh rate : 7 pages of results
"refresh rate" : 5 pages
 
Upvote 0

TelKel81

Active Member
Licensed User
B4X:
    Dim jo As JavaObject
    jo.InitializeContext
    Dim windowmanager As JavaObject = jo.RunMethod("getSystemService", Array("window"))
    Dim display As JavaObject = windowmanager.RunMethod("getDefaultDisplay", Null)  
    Dim refreshrate As Float = display.RunMethod("getRefreshRate", Null)
    Log(refreshrate)
U da man !!
 
Upvote 0

max123

Well-Known Member
Licensed User
Longtime User
I know that probably you want do it by code, but Android 11 has an option on Developer Options that if picked show actual screen refresh rate on the top-left screen. You can try it with physical device or with emulator.
 
Upvote 0

emexes

Expert
Licensed User
you made me realize I can use quotes to narrow my searches on the forums :)
refresh rate : 7 pages of results
"refresh rate" : 5 pages

Also in Google to indicate "I want hits that actually have this exact word on them" eg try searching for quoted "paralel" vs unquoted paralel ?
 
Upvote 0

Sifu

Active Member
On a less-painful note:

there's probably a system call somewhere, accessible via some JavaObject call magic, but that is still a bit beyond me. If it's just something you want to know about your own phone, then my first idea would be to move a panel about on screen, one tick (millisecond) per step, and adjust the number of steps in the repetitive path until the strobing effect (beating? as in two similar frequencies alternating between being in and out of phase) made the panel appear stationary.

Eg if you move the panel in a circle, 16 steps, ie 360 / 16 degrees per step, one step per millisecond, then it will take the panel 16 ms to do one lap of the circle. So the panel would be doing about 60 laps a second, and if the screen refresh rate was 60 Hz then the panel would always be at the same spot on the circle when the flinger refreshes the display, and look like it's not moving.

We use a similar technique at work to calibrate speed on our equipment, using a mains-frequency (50 Hz) strobe to check that the part is indeed rotating exactly 50 times per second ie 3000 rpm.
Mmmh, but the main frequency is not always 50Hz, you'd need an calibrated generator to be most exact. Keepin Measurement Uncertainty at it's lowest.
 
Upvote 0
Top