How do I do which screen size is optimal for Android and iOS too?
Develop games in your browser. Powerful, performant & highly capable.
makkancs
You don't target just one screen size the best thing is to target Aspect Ratio's for mobile devices, so no matter in wich phone screen will play, it will adjust to the screen phone with Aspect Ratio's
Here is a tutorial very useful to start with:
https://www.scirra.com/tutorials/1126/multiple-screen-sizing-for-all-mobile-devices
and
https://www.scirra.com/tutorials/73/supporting-multiple-screen-sizes