I want to run my script for both android and ios at a time with devices connected

I want to run my test script for both android and ios at a time?How to know that which platform has requested.I should know the platform before creating the instance of the driver.