Getting screen dimensions in a shell script
you nearly answered your question already. wm size shows you the current resolution.

Saving the output of the screen reoslution into a shell variable: A=$(wm size | busybox cut -c16-)